Repository navigation
Commit e2f3094
fix(cli): a config that fails to load is no longer reported as "Compile failed" (#35463)
Fixes #32439
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`os dev` / `os start` / `os serve --dev` / `os environments bind
--build` 在 `os compile` 子进程失败时的收尾行,以及 `os dev` 监听重编译的失败行,不再说 "Compile
failed",改为 "objectstack.config did not load or compile — the reason is
printed above; fix it before …"。
- 为什么改:配置在加载时被拒(例如许可证或 KMS 拒绝启动)也走这一行,运维人员读到 "Compile failed"
会去找代码错误;按裁决 D 只改为中性措辞,不做分类。
- 风险与回滚:只改文案,不改退出码、错误码和子进程输出;若有脚本匹配旧文案 "Compile failed"
会不再命中;仓内唯一一处(sql-perf bench)已在本 PR 改为匹配新文案。回滚即 revert 本 PR。
-
先看:`packages/cli/src/commands/dev.ts`(启动编译与监听重编译两处)、`packages/cli/src/commands/compile-child-failure-line.pin.test.ts`、`packages/cli/src/commands/serve.ts`
的 dev boot 一行。
- 两分钟验证:`pnpm --filter @objectstack/cli exec vitest run --project unit
src/commands/compile-child-failure-line.pin.test.ts
src/commands/dev-watch-compile-refusal.pin.test.ts`,预期 14 个测试全部通过。
- 需要你做的:无,席位落地。
## What changes
When the `os compile` child exits non-zero, the parent sees only the
exit status. A syntax error in the config, a refusal thrown while it
loads, and a refusal that prints and calls `process.exit(1)` all reach
the same branch. The closing line there said `Compile failed — fix
errors above …`, which sent an operator whose boot was refused at config
load looking for a code error.
Ruling-ref 6998194814, letter D (verbatim): "D. Neutral wording, no
detection. The closing line printed when the `os compile` child exits
non-zero stops asserting a code error. It says the config did not load
or compile and that the reason is printed above."
| Site | Before | After |
|---|---|---|
| `dev.ts` boot compile | `Compile failed — fix errors above before
starting dev server` | `objectstack.config did not load or compile — the
reason is printed above; fix it before starting dev server` |
| `start.ts` | `… before starting the server` (+ `--artifact` hint) |
same phrase, `fix it before starting the server`; hint unchanged |
| `serve.ts` dev boot | `✗ Compile failed — fix errors above before
starting the dev server.` | `✗ RELATIVE_CONFIG did not load or compile —
the reason is printed above; fix it before starting the dev server.`
(the config path this boot compiled) |
| `environments/bind.ts` | `… before binding` | same phrase, `fix it
before binding` |
| `dev.ts` watch recompile | `✗ compile failed (Nms)` | `✗
objectstack.config did not load or compile (Nms)`, compile output after
it as before |
The watch recompile line is a fifth site the ruling's list did not name.
It is printed on the same condition (the child exits non-zero) and made
the same "compile failed" claim, so it is covered as the same closing
line. It says nothing about "above", because its relayed output comes
after it.
`objectstack.config` names the file family on purpose. `os compile` with
no positional auto-detects `objectstack.config.{ts,js,mjs}`, so naming
`.ts` would be false for the other two. `serve.ts` knows the actual path
and prints it.
The one in-repo consumer that matched the old text, the boot-log check
in `packages/qa/dogfood/bench/sql-perf/bench.mjs` (~line 194), now
matches `did not load or compile` and keeps its own `fixture compile
failed` message. The area granted this as a file-surface addendum.
Not changed: exit statuses, error codes, the child's own output, and
cloud. Per the ruling, a classifying fix (a new `os compile` exit
status, a typed refusal code, cloud refusals that throw instead of exit)
is out of scope here.
## Tests
- New `src/commands/compile-child-failure-line.pin.test.ts`: a source
pin over the four boot sites, for the reason
`child-env-source-loader.pin.test.ts` gives (driving these sites means
spawning the built CLI). For each site it checks that exactly one code
line carries the neutral phrase, that the line carries that site's tail,
that it sits in a `status !== 0` branch, and that it says neither
"compile error" nor "refused". For each file it checks that no code line
says "compile failed".
- `dev-watch-compile-refusal.pin.test.ts` (the existing harness that
drives the real `startWatchRecompile`) gains a top-level describe. Two
fixtures exit 2 and 1, and for both the head line must say
"objectstack.config did not load or compile" and must say none of
"compile error", "refused", "compile failed". The file also gains 11
factory `vi.mock`s for dynamic loads that `check:test-source-alias`'s
source reach finds through `dev.ts`, which the watch loop never calls
(that gate judges an edited test file).
- `child-env-source-loader.pin.test.ts`: the quoted transcript in the
comment now shows the new line.
Ablation (committed fix first, `scripts/ablation-replace.mjs`, anchor
counts and blob hashes verified on disk, restore checked with `git diff
HEAD` empty):
1. `dev.ts` watch line set back to `✗ compile failed (${dt}ms)`: 3 tests
fail (both new watch cases, plus the source pin's dev.ts "no code line
still says compile failed"), and 11 pass.
2. `start.ts` line set back to the old literal: 2 tests fail (start.ts
neutral-line and start.ts stale-line), and 6 pass.
These are vitest relative imports of `src/`, so no `dist/` is involved.
## Acceptance notes
- `packages/qa/dogfood/bench/sql-perf/bench.mjs` (~line 194) matched
`text.includes('Compile failed')`, and this PR would have made that
match dead. It was changed in this PR to the new phrase under the
granted file-surface addendum (commit `c041c7fe`). The bench's own error
message is unchanged.
- `docs/qa/platform-checklist/areas/cli.json` items[0].variants[6]
quoted the old line. It now quotes the new dev.ts closing line under the
granted file-surface addendum (commit `392fd9a2`); nothing else in that
file changed.
- `CHANGELOG.md` entries quoting the old text are release-owned and were
not edited.
## Verification
Readings below are on head `a45eef1c` unless marked otherwise. Head is
now `c041c7fe`, which adds only the bench literal; its own readings are
in the last block.
<details><summary>Unit tests and typecheck</summary>
- `pnpm --filter @objectstack/cli exec vitest run --project unit` over
the three pin files: Test Files 3 passed (3), Tests 18 passed (18). Lock
VERDICT command-exit 0.
- `pnpm --filter @objectstack/cli typecheck`: VERDICT command-exit 0.
`check:test-typecheck: OK`, with the debt held at 3 files, 28 errors and
6 pinned signatures.
- Full CLI unit layer, on `efabd6ff`, which differs from head only in
the watch harness's added `vi.mock` lines: Test Files 428 passed and 2
failed (430), Tests 6121 passed and 29 skipped. The 2 failures were
suite-level throws: `packages/cli is not built (./dist/index.js is
absent)`. After `pnpm --filter @objectstack/cli build`, those two files
(`test/published-subpath-console.pin.test.ts`,
`test/published-subpath-hook-body.pin.test.ts`) pass 2/2, 29/29 tests,
VERDICT command-exit 0.
- The `integration` layer was not run locally and is left to CI. The
diff touches no integration file, no `bin/` and no spawn helper.
</details>
<details><summary>Derived gate families (dispatch-gates --commands,
73)</summary>
- Reconciliation: `dispatch-gates --ran` reports 73 derived, 70 run, 3
NOT-MEASURED, 0 UNRUN, and every line carries its exit code.
- 70 families exited 0. `check:test-source-alias` first went red on the
edited watch harness, because its source reach finds 11 dynamic loads
through `dev.ts`. Commit `a45eef1c` answers each with a factory mock,
and the gate now exits 0.
- NOT MEASURED: `check-plugin-teardown-shape --self-test` exited 3
(shallow clone; its pinned fixture commit is unreachable).
`check:dual-build-cjs-loads` exited 3 (needs a full `pnpm build`).
`check:i18n-coverage` exited 3 (COULD NOT MEASURE: 1 of 14 configs
failed to lint, unrelated to this diff). CI's Lint and Repo Gates job
runs all three.
- `overlap-check`: VERDICT clean exit 0 against `origin/main`
`9fea3168`, with 0 PR heads sharing a file.
- `check:nul-bytes`: exit 0. `check:cli-command-ids`: exit 0 (no new
segment opens with "os ").
</details>
<details><summary>Head c041c7f: the bench path</summary>
- `dispatch-gates --commands
packages/qa/dogfood/bench/sql-perf/bench.mjs` derives 46 families. The
`--ran` reconciliation reports 46 derived, 44 run, 2 NOT-MEASURED, 0
UNRUN, all with exit codes. The 44 exited 0, including
`check:nul-bytes`, `check:doc-authoring`, `check:issue-citations` and
the spec source audits `check:liveness`, `check:empty-state`,
`check:strictness-ledger` and `check:variant-docs`. NOT MEASURED, each
exit 3: `check-plugin-teardown-shape --self-test` (shallow clone) and
`check:dual-build-cjs-loads` (needs a full build). CI runs both.
- The two pin files on `c041c7fe`: Test Files 2 passed (2), Tests 14
passed (14), lock VERDICT command-exit 0.
- `overlap-check`: VERDICT clean exit 0, with 0 PR heads.
</details>
<details><summary>Head 392fd9a: merged origin/main, plus the checklist
quote</summary>
- `git merge --no-edit origin/main` (`609b6751`) gave merge commit
`d3e973ed` with no conflicts and nothing pending regeneration. The PR's
delta against main is still exactly its 10 files.
- Gates derived for `docs/qa/platform-checklist/areas/cli.json`: 17 in
total, 16 exit 0. `pnpm check:platform-checklist` exits 1 with one
problem: `platform-core.json · platform-core.seed-mode-matrix: VARIANTS
STALE — SeedMode … now has 0 members`. It was measured identically on a
pristine `origin/main` `609b6751` (exit 1, same single problem), so it
is not from this diff. `cli.json` draws no finding.
- After the merge, per AGENTS.md §10, since the incoming commits moved
`packages/spec` and `packages/cli`: `@objectstack/spec check:generated`
passed 13 of 14 gates. Its `check:test-typecheck` crashed with "tsc
failed without diagnostics" when run without the heap flag; run alone
under the lock with `--max-old-space-size=4096` it exits 0 (52 files /
240 errors / 131 signatures held).
- `@objectstack/cli typecheck` and build: VERDICT command-exit 0.
- Full CLI unit layer (which includes both pin files): Test Files 431
passed (431), Tests 6156 passed (6156), VERDICT command-exit 0.
- `overlap-check`: VERDICT clean exit 0 against `origin/main`
`6f36818f`, 0 PR heads.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt)_
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgTyMahdAdhXSzgy2nt -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 819c067 commit e2f3094
10 files changed
Lines changed: 141 additions & 8 deletions
File tree
- .changeset
- docs/qa/platform-checklist/areas
- packages
- cli/src/commands
- environments
- qa/dogfood/bench/sql-perf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
79 | 96 | | |
80 | 97 | | |
81 | 98 | | |
| |||
274 | 291 | | |
275 | 292 | | |
276 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | | - | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
667 | 671 | | |
668 | 672 | | |
669 | 673 | | |
| |||
1227 | 1231 | | |
1228 | 1232 | | |
1229 | 1233 | | |
1230 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1231 | 1237 | | |
1232 | 1238 | | |
1233 | 1239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3784 | 3784 | | |
3785 | 3785 | | |
3786 | 3786 | | |
3787 | | - | |
| 3787 | + | |
| 3788 | + | |
3788 | 3789 | | |
3789 | 3790 | | |
3790 | 3791 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
0 commit comments