Skip to content

Commit bed8731

Browse files
os-litantclaude
andauthored
test(cli): the built-CLI refusal said every boot times out; the child exits 2 at once (#12648)
`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 <waitFor>` — 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"`. Claude-Session: https://claude.ai/code/session_01UjujZN219uFzBhSYfMykCd Co-authored-by: Claude <noreply@anthropic.com>
1 parent de47336 commit bed8731

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

packages/cli/test/helpers/serve-process.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export const TSX = resolve(HERE, '../../../../node_modules/.bin/tsx');
6060
export const RUN_JS_RESOLVES_FROM_DIST =
6161
'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' +
6262
'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' +
63-
'"command serve not found" and every boot below times out.';
63+
'"command serve not found" and every boot below fails immediately with "serve exited 2", ' +
64+
'not a timeout.';
6465

6566
/**
6667
* The refusal itself, separated from the check so its WORDING can be pinned.

packages/cli/test/serve-built-cli-prerequisite.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,19 @@ describe('#12539: the unbuilt-CLI refusal is legible', () => {
8989
expect(message).not.toContain('transpiling src/');
9090
});
9191

92-
it('reproduces, byte for byte, what the three private copies threw before the hoist', () => {
93-
// #12539 moved this refusal out of three files; it did not reword it. The
94-
// literal below is the message measured on `09b4f4e4e`, so a rewording has
95-
// to be a deliberate edit here rather than a side effect of the move.
92+
it('pins the whole refusal, byte for byte', () => {
93+
// #12539 moved this refusal out of three files without rewording it, and
94+
// the literal below was the message measured on `09b4f4e4e`. #12618 then
95+
// reworded ONE clause — `every boot below times out` was false; the child
96+
// exits 2 at once — and this literal moved in the SAME commit, which is
97+
// the pin doing its job: a rewording has to be a deliberate edit here
98+
// rather than a side effect of a move.
9699
expect(unbuiltCliError('/repo/packages/cli/dist/commands/serve.js', RUN_JS_RESOLVES_FROM_DIST).message).toBe(
97100
'packages/cli is not built: /repo/packages/cli/dist/commands/serve.js does not exist.\n' +
98101
'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' +
99102
'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' +
100-
'"command serve not found" and every boot below times out.\n' +
103+
'"command serve not found" and every boot below fails immediately with "serve exited 2", ' +
104+
'not a timeout.\n' +
101105
'CI declares the build (turbo: @objectstack/cli#test dependsOn build); a direct vitest run does not.\n' +
102106
'Run: pnpm exec turbo run build --filter=@objectstack/cli',
103107
);

packages/cli/test/serve-node-env-production-default.e2e.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ const CLI = resolve(HERE, '../bin/run.js');
186186
* Why THIS file needs `packages/cli/dist`, in its own terms (#12539).
187187
*
188188
* ⛔ NOT `RUN_JS_RESOLVES_FROM_DIST`, the constant the three sibling spawners
189-
* pass. That sentence ends `… and every boot below times out`, which holds for
190-
* a file whose every boot goes through `bin/run.js` with `NODE_ENV` unset.
189+
* pass. That sentence ends `… and every boot below fails immediately with
190+
* "serve exited 2", not a timeout`, which holds for a file whose every boot
191+
* goes through `bin/run.js` with `NODE_ENV` unset.
191192
* This file is not one: of its three legs only the unset pin resolves from
192193
* `dist/`, and the other two hand the child `development`/`test` — exactly the
193194
* value that makes `@oclif/core`'s `isProd()` false and reroutes them to

0 commit comments

Comments
 (0)