Skip to content

fix(ci): update vitest e2e-brev include to .ts after rename#1743

Merged
cv merged 10 commits intomainfrom
fix/vitest-e2e-brev-ts-include
Apr 10, 2026
Merged

fix(ci): update vitest e2e-brev include to .ts after rename#1743
cv merged 10 commits intomainfrom
fix/vitest-e2e-brev-ts-include

Conversation

@cjagwani
Copy link
Copy Markdown
Contributor

@cjagwani cjagwani commented Apr 10, 2026

Summary

Test plan

  • Re-run the e2e-brev workflow with TEST_SUITE=full and confirm it finds the test file

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • E2E now runs TypeScript test files instead of JavaScript for better type consistency.
    • Setup always performs remote dependency synchronization; full test runs skip local plugin build and sandbox onboarding to streamline setup.
    • Reduced SSH wait retries and improved failure messaging with estimated wait time and progress logging.

The brev-e2e test was renamed from .js to .ts but vitest.config.ts
still pointed to the old .js path, causing "No test files found".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Switches the Vitest e2e project to run the TypeScript test file and centralizes beforeAll gating into a single needsBeforeAllSetup = TEST_SUITE !== "full" flag; reduces SSH wait retries and always runs remote npm install on the launchable path.

Changes

Cohort / File(s) Summary
Vitest config
vitest.config.ts
Changed e2e-brev project's include from test/e2e/brev-e2e.test.js to test/e2e/brev-e2e.test.ts.
E2E test setup logic
test/e2e/brev-e2e.test.ts
Consolidated gating into needsBeforeAllSetup = TEST_SUITE !== "full" (replaces prior needsBeforeAllSandbox logic). Reduced waitForSsh retries (90 → 40), added per-attempt progress logging and refresh log every 5 attempts, and appended estimated wait minutes to final error. In the launchable path, npm install now always runs after rsync; when TEST_SUITE === "full" local plugin build / npm link / onboard background / registry workaround block is skipped entirely.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as Test Runner
  participant Remote as Remote Host / Launchable
  participant Setup as Local Setup (build / npm link)
  participant Onboard as Onboard Background
  participant Registry as Registry Workaround

  Note over Runner,Remote: Start e2e run
  Runner->>Remote: waitForSsh (retries reduced, progress logs)
  Runner->>Remote: run remote rsync
  Runner->>Remote: run remote npm install
  alt needsBeforeAllSetup = true (TEST_SUITE !== "full")
    Runner->>Setup: build plugins & npm link
    Runner->>Onboard: start onboard background process
    Runner->>Registry: apply registry workaround
  else needsBeforeAllSetup = false (TEST_SUITE === "full")
    Runner--xSetup: skip plugin build & npm link
    Runner--xOnboard: skip onboard background
    Runner--xRegistry: skip registry workaround
  end
  Runner->>Runner: run tests
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from JS to TypeScript neat,
I trimmed the retries and quickened the beat,
One gate now gates the setup door,
Remote installs run forevermore,
I twitch my nose — the tests proceed!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: updating the vitest configuration to reference the renamed e2e test file (.ts instead of .js), which directly addresses the core issue of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vitest-e2e-brev-ts-include

Comment @coderabbitai help to get the list of available commands and usage tips.

@cjagwani cjagwani requested review from brandonpelfrey and cv April 10, 2026 13:55
@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

When TEST_SUITE=full, test-full-e2e.sh runs install.sh which handles
Node.js, OpenShell, NemoClaw install, and onboard from scratch. The
beforeAll was redundantly doing npm install, plugin build, and npm
link before that — wasting ~10 min on work install.sh redoes.

Now beforeAll only provisions the Brev instance, waits for SSH +
launchable, and rsyncs the code when TEST_SUITE=full.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@wscurran wscurran added CI/CD Use this label to identify issues with NemoClaw CI/CD pipeline or GitHub Actions. fix github_actions Pull requests that update GitHub Actions code labels Apr 10, 2026
@wscurran
Copy link
Copy Markdown
Contributor

@wscurran wscurran added Platform: Brev Support for Brev deployment enhancement: testing Use this label to identify requests to improve NemoClaw test coverage. labels Apr 10, 2026
@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

cjagwani and others added 3 commits April 10, 2026 08:04
Move npm install back outside the needsBeforeAllSetup guard.
The launchable caches node_modules for main's lockfile, but
rsync brings the PR branch's lockfile — without a reconciling
npm install, install.sh hits a cold cache and takes longer.

Still skip plugin build, npm link, and onboard for full suite.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 attempts × (5s sleep + 10s SSH timeout) = ~22.5 min wasted
when the instance never comes up. GCP instances are typically
SSH-ready within 5 min — 40 attempts (~10 min) is sufficient.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/e2e/brev-e2e.test.ts`:
- Around line 168-175: The waitForSsh readiness budget is hard-coded to 40
attempts; make it configurable via an env var (e.g., SSH_READINESS_ATTEMPTS or
BREV_SSH_MAX_ATTEMPTS) and use a safer default (higher than 40). Update the
waitForSsh function to derive its default maxAttempts from process.env
(parseInt/Number with a fallback safe default and clamp to a positive integer),
optionally allow intervalMs to be env-configurable too, and ensure the thrown
error and log messages reference the actual resolved maxAttempts so CI can be
tuned without code changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 36999b43-b145-4d91-adb1-90ff91d4b2a4

📥 Commits

Reviewing files that changed from the base of the PR and between 4b3e8fd and 574d64b.

📒 Files selected for processing (1)
  • test/e2e/brev-e2e.test.ts

Comment on lines +168 to +175
function waitForSsh(maxAttempts = 40, intervalMs = 5_000) {
for (let i = 1; i <= maxAttempts; i++) {
try {
ssh("echo ok", { timeout: 10_000 });
return;
} catch {
if (i === maxAttempts) throw new Error(`SSH not ready after ${maxAttempts} attempts`);
if (i === maxAttempts) throw new Error(`SSH not ready after ${maxAttempts} attempts (~${Math.round(maxAttempts * (intervalMs + 10_000) / 60_000)} min)`);
console.log(` SSH attempt ${i}/${maxAttempts} failed, retrying in ${intervalMs / 1000}s...`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make SSH readiness budget configurable to avoid flaky failures

Line 168 hard-caps SSH readiness to 40 attempts (~10 min total wall time with current timeout/interval). In busy/cloud-constrained runs, this can fail before the instance is actually usable and create false negatives in CI. Please make the budget env-configurable (with a safer default) instead of hard-coding this lower ceiling.

🔧 Proposed change
-function waitForSsh(maxAttempts = 40, intervalMs = 5_000) {
+const BREV_SSH_MAX_ATTEMPTS = parseInt(process.env.BREV_SSH_MAX_ATTEMPTS || "90", 10);
+const BREV_SSH_INTERVAL_MS = parseInt(process.env.BREV_SSH_INTERVAL_MS || "5000", 10);
+
+function waitForSsh(maxAttempts = BREV_SSH_MAX_ATTEMPTS, intervalMs = BREV_SSH_INTERVAL_MS) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function waitForSsh(maxAttempts = 40, intervalMs = 5_000) {
for (let i = 1; i <= maxAttempts; i++) {
try {
ssh("echo ok", { timeout: 10_000 });
return;
} catch {
if (i === maxAttempts) throw new Error(`SSH not ready after ${maxAttempts} attempts`);
if (i === maxAttempts) throw new Error(`SSH not ready after ${maxAttempts} attempts (~${Math.round(maxAttempts * (intervalMs + 10_000) / 60_000)} min)`);
console.log(` SSH attempt ${i}/${maxAttempts} failed, retrying in ${intervalMs / 1000}s...`);
const BREV_SSH_MAX_ATTEMPTS = parseInt(process.env.BREV_SSH_MAX_ATTEMPTS || "90", 10);
const BREV_SSH_INTERVAL_MS = parseInt(process.env.BREV_SSH_INTERVAL_MS || "5000", 10);
function waitForSsh(maxAttempts = BREV_SSH_MAX_ATTEMPTS, intervalMs = BREV_SSH_INTERVAL_MS) {
for (let i = 1; i <= maxAttempts; i++) {
try {
ssh("echo ok", { timeout: 10_000 });
return;
} catch {
if (i === maxAttempts) throw new Error(`SSH not ready after ${maxAttempts} attempts (~${Math.round(maxAttempts * (intervalMs + 10_000) / 60_000)} min)`);
console.log(` SSH attempt ${i}/${maxAttempts} failed, retrying in ${intervalMs / 1000}s...`);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e/brev-e2e.test.ts` around lines 168 - 175, The waitForSsh readiness
budget is hard-coded to 40 attempts; make it configurable via an env var (e.g.,
SSH_READINESS_ATTEMPTS or BREV_SSH_MAX_ATTEMPTS) and use a safer default (higher
than 40). Update the waitForSsh function to derive its default maxAttempts from
process.env (parseInt/Number with a fallback safe default and clamp to a
positive integer), optionally allow intervalMs to be env-configurable too, and
ensure the thrown error and log messages reference the actual resolved
maxAttempts so CI can be tuned without code changes.

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

brev delete is flaky and shouldn't fail the entire test run when
the actual tests passed. Log a warning with manual cleanup
instructions instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Brev E2E (full): FAILED on branch fix/vitest-e2e-brev-ts-includeSee logs

deleteBrevInstance was retrying 5x with sleeps because brev ls
still showed the instance in DELETING state. This took 35-40s
and exceeded vitest's 10s hookTimeout.

Now: fire brev delete once, treat DELETING/STOPPING as success
since Brev finishes teardown asynchronously. No retries needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Brev E2E (full): PASSED on branch fix/vitest-e2e-brev-ts-includeSee logs

cjagwani and others added 2 commits April 10, 2026 13:23
deleteBrevInstance treats DELETING/STOPPING as success, so the
warning is unreachable in practice. Remove it for clean logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cv cv merged commit bfff9a3 into main Apr 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Use this label to identify issues with NemoClaw CI/CD pipeline or GitHub Actions. enhancement: testing Use this label to identify requests to improve NemoClaw test coverage. fix github_actions Pull requests that update GitHub Actions code Platform: Brev Support for Brev deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants