Skip to content

test: add deeper smoke tests for binary and npm bundle#1013

Merged
BYK merged 3 commits into
mainfrom
byk/deeper-smoke-tests
May 22, 2026
Merged

test: add deeper smoke tests for binary and npm bundle#1013
BYK merged 3 commits into
mainfrom
byk/deeper-smoke-tests

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented May 22, 2026

Problem

Our current smoke tests only run --help and --version, which exercise none of the lazy-loaded code paths (SQLite, telemetry, auth DB, Ink sidecar). This allowed two critical bugs to ship:

  1. _require("../telemetry.js") in the CJS bundle — --help never triggers the lazy DB init
  2. with { type: "file" } crashing in tsx dev mode — --help never loads the Ink sidecar

Changes

CI Build Smoke Tests (.github/workflows/ci.yml)

build-binary job: Added a "Smoke test (deep)" step that runs auth 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-npm job: Same test via node dist/bin.cjs auth status on both Node 22 and Node 24.

E2E Bundle Tests (test/e2e/bundle.test.ts)

Three new tests:

  1. auth status — exercises SQLite + telemetry + auth DB via npm bundle. Asserts exit 10, "not authenticated", no module resolution errors.
  2. cli defaults — exercises SQLite metadata KV store without requiring auth. Asserts exit 0.
  3. Ink sidecar import — directly imports dist/ink-app.js and verifies it exports mountApp as a function. Catches sidecar bundling bugs.

Why auth status?

  • Sets auth: false on the command, so Stricli's auth guard is skipped — the command itself checks auth state
  • Exercises: SQLite init, DB schema + migrations, getAuthConfig(), getUserInfo(), getDefaultOrganization/Project(), getDbPath(), telemetry lazy import, error formatting pipeline
  • When unauthenticated: exits with code 10 deterministically, no network calls, ~200-500ms

Why a direct sidecar import test?

init --dry-run is not viable for smoke testing because: (a) init requires auth, (b) --dry-run forces LoggingUI not InkUI, (c) non-TTY CI forces LoggingUI regardless. 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

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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 4231 uncovered lines.
✅ Project coverage is 81.89%. Comparing base (base) to head (head).

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        -3

Generated 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.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread test/e2e/bundle.test.ts Outdated
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.
@BYK BYK merged commit 13ef543 into main May 22, 2026
27 checks passed
@BYK BYK deleted the byk/deeper-smoke-tests branch May 22, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add deeper smoke tests for binary and npm bundle

1 participant