From 732fe0cbdccf45026343caaf970e66842b14cfc1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 02:51:16 +0000 Subject: [PATCH] test(cli): the built-CLI refusal said every boot times out; the child exits 2 at once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `RUN_JS_RESOLVES_FROM_DIST` ended "... and every boot below times out." The first clause is right; the second is not what happens. On a closure-only tree the child answers ` > Error: Command serve not found.` and exits 2 in ~200 ms, and all four `bin/run.js` spawners reject from their `child.on('exit')` handler with `serve exited 2 before ` — never from their 150 s timer. A reader following the old clause looks for a hang there is none of, while the real reason is already on the child's stderr. One clause, three sites: the constant, the byte-for-byte `.toBe()` pin that guards its wording, and the docblock in `serve-node-env-production-default.e2e.test.ts` that quotes the clause and vouches for it being true of the siblings. The pin moves in this same commit — that is the pin doing its job, not an obstacle — and stays `.toBe()`. The tree already refuted itself in three places, all left intact: the comment above the constant, this pin file's own header, and the paragraph two below the vouching docblock, each recording `serve exited 2 before "Server is ready"`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01UjujZN219uFzBhSYfMykCd --- packages/cli/test/helpers/serve-process.ts | 3 ++- .../cli/test/serve-built-cli-prerequisite.test.ts | 14 +++++++++----- .../serve-node-env-production-default.e2e.test.ts | 5 +++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/cli/test/helpers/serve-process.ts b/packages/cli/test/helpers/serve-process.ts index 1774cee8bd..3147b0cb60 100644 --- a/packages/cli/test/helpers/serve-process.ts +++ b/packages/cli/test/helpers/serve-process.ts @@ -60,7 +60,8 @@ export const TSX = resolve(HERE, '../../../../node_modules/.bin/tsx'); export const RUN_JS_RESOLVES_FROM_DIST = 'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' + 'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' + - '"command serve not found" and every boot below times out.'; + '"command serve not found" and every boot below fails immediately with "serve exited 2", ' + + 'not a timeout.'; /** * The refusal itself, separated from the check so its WORDING can be pinned. diff --git a/packages/cli/test/serve-built-cli-prerequisite.test.ts b/packages/cli/test/serve-built-cli-prerequisite.test.ts index e48fbbf243..731c36d394 100644 --- a/packages/cli/test/serve-built-cli-prerequisite.test.ts +++ b/packages/cli/test/serve-built-cli-prerequisite.test.ts @@ -89,15 +89,19 @@ describe('#12539: the unbuilt-CLI refusal is legible', () => { expect(message).not.toContain('transpiling src/'); }); - it('reproduces, byte for byte, what the three private copies threw before the hoist', () => { - // #12539 moved this refusal out of three files; it did not reword it. The - // literal below is the message measured on `09b4f4e4e`, so a rewording has - // to be a deliberate edit here rather than a side effect of the move. + it('pins the whole refusal, byte for byte', () => { + // #12539 moved this refusal out of three files without rewording it, and + // the literal below was the message measured on `09b4f4e4e`. #12618 then + // reworded ONE clause — `every boot below times out` was false; the child + // exits 2 at once — and this literal moved in the SAME commit, which is + // the pin doing its job: a rewording has to be a deliberate edit here + // rather than a side effect of a move. expect(unbuiltCliError('/repo/packages/cli/dist/commands/serve.js', RUN_JS_RESOLVES_FROM_DIST).message).toBe( 'packages/cli is not built: /repo/packages/cli/dist/commands/serve.js does not exist.\n' + 'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' + 'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' + - '"command serve not found" and every boot below times out.\n' + + '"command serve not found" and every boot below fails immediately with "serve exited 2", ' + + 'not a timeout.\n' + 'CI declares the build (turbo: @objectstack/cli#test dependsOn build); a direct vitest run does not.\n' + 'Run: pnpm exec turbo run build --filter=@objectstack/cli', ); diff --git a/packages/cli/test/serve-node-env-production-default.e2e.test.ts b/packages/cli/test/serve-node-env-production-default.e2e.test.ts index 926b18f47b..0e70d0fcd4 100644 --- a/packages/cli/test/serve-node-env-production-default.e2e.test.ts +++ b/packages/cli/test/serve-node-env-production-default.e2e.test.ts @@ -186,8 +186,9 @@ const CLI = resolve(HERE, '../bin/run.js'); * Why THIS file needs `packages/cli/dist`, in its own terms (#12539). * * ⛔ NOT `RUN_JS_RESOLVES_FROM_DIST`, the constant the three sibling spawners - * pass. That sentence ends `… and every boot below times out`, which holds for - * a file whose every boot goes through `bin/run.js` with `NODE_ENV` unset. + * pass. That sentence ends `… and every boot below fails immediately with + * "serve exited 2", not a timeout`, which holds for a file whose every boot + * goes through `bin/run.js` with `NODE_ENV` unset. * This file is not one: of its three legs only the unset pin resolves from * `dist/`, and the other two hand the child `development`/`test` — exactly the * value that makes `@oclif/core`'s `isProd()` false and reroutes them to