Commit 13ef543
authored
test: add deeper smoke tests for binary and npm bundle (#1013)
## 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 #10101 parent e7dd817 commit 13ef543
2 files changed
Lines changed: 134 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
312 | 338 | | |
313 | 339 | | |
314 | 340 | | |
| |||
710 | 736 | | |
711 | 737 | | |
712 | 738 | | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
713 | 759 | | |
714 | 760 | | |
715 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
152 | 240 | | |
0 commit comments