test: add deeper smoke tests for binary and npm bundle#1013
Merged
Conversation
Add smoke tests beyond --help that exercise lazy-loaded code paths (SQLite, telemetry, auth DB, Ink sidecar). This catches require resolution and bundle bugs that --help alone misses. CI build smoke tests (ci.yml): - build-binary: run `auth status` (unauthenticated) after build - exercises SQLite init, schema migrations, telemetry lazy import - asserts exit code 10 (AUTH_NOT_AUTHENTICATED) - build-npm: same test via `node dist/bin.cjs auth status` E2E bundle tests (bundle.test.ts): - auth status: SQLite + telemetry + auth DB via npm bundle - cli defaults: SQLite metadata KV store without auth - Ink sidecar import: verify dist/ink-app.js loads and exports mountApp Closes #1010
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 4231 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.87% 81.89% +0.02%
==========================================
Files 328 328 —
Lines 23359 23359 —
Branches 15114 15114 —
==========================================
+ Hits 19123 19128 +5
- Misses 4236 4231 -5
- Partials 1621 1618 -3Generated by Codecov Action |
- Add explicit SENTRY_AUTH_TOKEN="" and SENTRY_TOKEN="" env overrides to CI smoke test steps to prevent future env leakage on main/release branches where production secrets are available. - Move Ink sidecar import test to a subprocess via spawnCollect to avoid polluting the vitest process with React/Ink globals from the sidecar's bundled dependencies.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9da45e2. Configure here.
Address Cursor Bugbot review: string interpolation `file://${path}`
produces invalid URLs on Windows where join() uses backslashes.
Use pathToFileURL() which correctly normalizes to file:///C:/... URLs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Our current smoke tests only run
--helpand--version, which exercise none of the lazy-loaded code paths (SQLite, telemetry, auth DB, Ink sidecar). This allowed two critical bugs to ship:_require("../telemetry.js")in the CJS bundle —--helpnever triggers the lazy DB initwith { type: "file" }crashing in tsx dev mode —--helpnever loads the Ink sidecarChanges
CI Build Smoke Tests (
.github/workflows/ci.yml)build-binaryjob: Added a "Smoke test (deep)" step that runsauth status(unauthenticated) on the compiled binary. Exercises SQLite init, schema migrations, telemetry lazy import, and CJS require chain. Asserts exit code 10 (AUTH_NOT_AUTHENTICATED) — any other code (1=crash, 127=missing) fails the step.build-npmjob: Same test vianode dist/bin.cjs auth statuson both Node 22 and Node 24.E2E Bundle Tests (
test/e2e/bundle.test.ts)Three new tests:
auth status— exercises SQLite + telemetry + auth DB via npm bundle. Asserts exit 10, "not authenticated", no module resolution errors.cli defaults— exercises SQLite metadata KV store without requiring auth. Asserts exit 0.dist/ink-app.jsand verifies it exportsmountAppas a function. Catches sidecar bundling bugs.Why
auth status?auth: falseon the command, so Stricli's auth guard is skipped — the command itself checks auth stategetAuthConfig(),getUserInfo(),getDefaultOrganization/Project(),getDbPath(), telemetry lazy import, error formatting pipelineWhy a direct sidecar import test?
init --dry-runis not viable for smoke testing because: (a)initrequires auth, (b)--dry-runforcesLoggingUInotInkUI, (c) non-TTY CI forcesLoggingUIregardless. The direct import test catches the exact class of sidecar bundling bugs without needing auth, a TTY, or a mock server.Timing Impact
~1-2 seconds added per build job (well under the 2-3s budget from the issue).
Closes #1010