Skip to content

Commit 1080f07

Browse files
test(cli): set the command-population vacuity floors at about two thirds of the measured counts (#26555)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XUx5K9iqwUoraf1W95bhw8P)_ Fixes #26523 Part of #26444 (the CLI half; the ui half and the two-sided baselines are other lanes' children, and the spec liveness floor is the spec seat's). Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:CLI 两个命令总体钉测试里的六个「防空跑」底线,从接近实测值降到实测值的约三分之二(`this.error` 只有 3 个模块,保留为非空底线),每个底线旁注明实测值与测量日期。 - **为什么改**:底线贴着实测值,删一个命令就会红;按 #26444 的规则(先例 `vite-dts-wiring-ratchet`:实测 22,底线 15)改为防空值。 - **风险与回滚**:只动两个测试文件,不动产品代码;回滚即还原本 PR。六个底线各自清空总体时仍然转红(见 Tests)。 - **先看**:`packages/cli/test/refusal-renders-once.test.ts` 的三个常量(`ERROR_FILE_FLOOR` 是原先唯一等于实测的那个),再看 `packages/cli/test/exit-signal.pin.test.ts` 的三个常量。 - **两分钟验证**:`pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 test/exit-signal.pin.test.ts test/refusal-renders-once.test.ts`,预期 2 个文件、127 个用例全绿。 - **需要你做的**:无,席位落地。 ## What changes Each anti-vacuity floor in the two command-population pins moves to about two thirds of its count, re-measured on `origin/main` `185512cc` (2026-10-27), rounded down: | File | Floor | Before | Measured | After | Margin | |---|---|---|---|---|---| | `exit-signal.pin.test.ts` | `POPULATION_FLOOR` (command modules) | 65 | 72 | 48 | 24 | | `exit-signal.pin.test.ts` | `SITE_FLOOR` (signal-raising calls inside a `try`) | 131 | 164 | 109 | 55 | | `exit-signal.pin.test.ts` | `JSON_FACE_FLOOR` (JSON-capable commands) | 46 | 53 | 35 | 18 | | `refusal-renders-once.test.ts` | `FILE_FLOOR` (command modules) | 60 | 72 | 48 | 24 | | `refusal-renders-once.test.ts` | `PRINTER_FILE_FLOOR` (modules calling a refusal printer) | 50 | 64 | 42 | 22 | | `refusal-renders-once.test.ts` | `ERROR_FILE_FLOOR` (modules raising `this.error`) | 3 | 3 | 1 (non-empty) | 2 | - A population of 3 or fewer keeps a non-empty floor rather than a fraction, so `ERROR_FILE_FLOOR` is 1 under the existing `toBeGreaterThanOrEqual`, which is `> 0`. - Each floor is written once, as one constant, with a one-line comment naming the measured value, the date and the commit. The docblocks above them now describe them as vacuity floors and drop the per-commit count history the old floors were derived from. - The three floor messages that read "than this pin was widened over" (or "written over") now read "than the vacuity floor", since the floor is no longer that count. ## Why A floor equal to today's count turns every legitimate deletion of a command into a red run and a floor bump (#26444, after #26343 needed five bumps for one deletion). A vacuity floor only needs to catch a discovery or scan that silently resolves nothing. ## Tests - **Each floor still reds on an emptied population.** One filter-to-empty ablation per floor, through `scripts/ablation-replace.mjs` on committed `f78d7c29`. Each landed (anchor 1 to 0), turned exactly one test red with the floor's own message, and was restored to the HEAD blob with `git diff HEAD` empty. - **Deleting one CLI command keeps every floor green.** `src/commands/datasource/introspect.ts` was deleted and both files were run. It is the worst single deletion for these floors: it is a command module, a refusal-printer module, and one of the three `this.error` modules. Result: 2 files, 126 of 126 tests green. The file was then restored to its HEAD blob. - **Control on the base.** The same deletion with both files at `185512cc` reds `ERROR_FILE_FLOOR` (`expected 2 to be greater than or equal to 3`). This is the defect the card describes. - Both files at HEAD: 2 files, 127 of 127 tests green. <details><summary>Ablations, one per floor (f78d7c2)</summary> ```text POPULATION_FLOOR expect(POPULATION.length, -> expect(POPULATION.filter(() => false).length, AssertionError: fewer commands discovered than the vacuity floor: expected 0 to be greater than or equal to 48 Tests 1 failed | 115 passed (116) · ok restored: blob == HEAD (e63791d) JSON_FACE_FLOOR POPULATION.filter((c) => !c.faces...) -> POPULATION.filter((c) => false && !c.faces...) AssertionError: fewer JSON-capable commands labelled than the first population held: expected 0 to be greater than or equal to 35 Tests 1 failed | 115 passed (116) · ok restored: blob == HEAD (e63791d) SITE_FLOOR [...FLOW.values()].reduce( -> [...FLOW.values()].filter(() => false).reduce( AssertionError: fewer signal-raising calls inside a try found than the vacuity floor: expected 0 to be greater than or equal to 109 Tests 1 failed | 115 passed (116) · ok restored: blob == HEAD (e63791d) FILE_FLOOR expect(FILES.length, -> expect(FILES.filter(() => false).length, AssertionError: fewer command modules than the vacuity floor: expected 0 to be greater than or equal to 48 Tests 1 failed | 10 passed (11) · ok restored: blob == HEAD (6256e9a) PRINTER_FILE_FLOOR SCANS.filter((s) => s.scan.printerCalls > 0) -> SCANS.filter((s) => false && s.scan.printerCalls > 0) AssertionError: refusal printers not found: expected 0 to be greater than or equal to 42 Tests 1 failed | 10 passed (11) · ok restored: blob == HEAD (6256e9a) ERROR_FILE_FLOOR SCANS.filter((s) => s.scan.errorCalls > 0) -> SCANS.filter((s) => false && s.scan.errorCalls > 0) AssertionError: `this.error` not found: expected 0 to be greater than or equal to 1 Tests 1 failed | 10 passed (11) · ok restored: blob == HEAD (6256e9a) ``` </details> <details><summary>One-command deletion dry run, and the base control</summary> ```text HEAD f78d7c2, src/commands/datasource/introspect.ts deleted: vitest exit 0 · Test Files 2 passed (2) · Tests 126 passed (126) restored blob 3d03b93 == HEAD blob; git diff HEAD empty base 185512c test files, same deletion: FAIL test/refusal-renders-once.test.ts > ... > the population is not vacuous — the floors hold AssertionError: `this.error` not found: expected 2 to be greater than or equal to 3 Test Files 1 failed | 1 passed (2) · Tests 1 failed | 125 passed (126) ``` </details> ## Acceptance notes - **The premise had partly drifted.** On `185512cc`, five of the six floors already sat below today's counts (65 of 72, 131 of 164, 46 of 53, 60 of 72, 50 of 64). The card's "equal to the measured values" matches the counts the old docblocks recorded, not today's. Only `ERROR_FILE_FLOOR` still equalled its count (3 of 3), and the base control shows that one deletion red it. All six were moved anyway, by the parent's rule ("every anti-vacuity floor moves to roughly two thirds of today's value") and this card's acceptance (every floor below its re-measured value by a stated margin). - **Both files floor the same population.** The command-module population (72) is floored in both files, once in each. A constant shared between the two files would need a helper module outside the claimed file surface, so it was not added. - **No census reads these floors.** A `git grep` for the two file names outside themselves finds only prose references in `refusal-renders-once.e2e.test.ts`, and no ledger carries their values. No open PR touched either file at start or before this PR was opened. - **Other `packages/cli` floors, not edited.** `test/option-b-reader-acceptance.pin.test.ts:312` has floor 38 and measured 38. It equals its count on purpose: its comment says "⛔ never lower it", so it is a raise-only ratchet. `test/platform-page-i18n-parity.test.ts:845` has floor 38, measured 40. `test/print-metadata-stats-zero-row.test.ts:258` has floor 18, measured 19. ## Verification - `pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2` under the verify lock: 336 files passed and 2 failed, because `packages/cli` itself was not built yet (`published-subpath-console.pin`, `published-subpath-hook-body.pin` say "packages/cli is not built"). After `pnpm --filter @objectstack/cli build`, those two pass (2 files, 29 tests). That makes 338 of 338 files green, 4890 tests passed and 29 skipped. The `integration` tier is left to CI: the diff touches only two unit-tier files and no spawn entry. - `pnpm --filter @objectstack/cli typecheck`: exit 0 (`check:test-typecheck: OK`). - `eslint --no-inline-config packages/cli`: exit 0. - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 48 commands on `f78d7c29`. 47 ran with exit 0. `pnpm check:dual-build-cjs-loads` exited 3 (PREREQUISITE NOT MET: it needs every package's dist), so it is NOT MEASURED. `check-plugin-teardown-shape --self-test` first exited 3 on the shallow clone and exited 0 after fetching its positive-control commit. Reconciliation: `✓ dispatch-gates --ran: 48 derived famil(ies) accounted for — 47 run, 1 NOT-MEASURED`. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran; `pnpm lint` passes. (eslint over `packages/cli` exit 0) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. (tests only: `skip-changeset`) - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (the 维护者速读 block is Chinese by the dispatch convention) - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5m4bTCRGQcuJTsnyfD)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 319d6fa commit 1080f07

2 files changed

Lines changed: 27 additions & 33 deletions

File tree

‎packages/cli/test/exit-signal.pin.test.ts‎

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -468,28 +468,20 @@ const FLOW = new Map(
468468
);
469469

470470
/**
471-
* Floors, not counts of today: the population and the `this.exit`-in-`try`
472-
* sites this was widened over, on `f9a8eb889e`. That is 65 commands: 46
473-
* JSON-capable (32 `--json`, 14 `--format json`, the first population) and 19
474-
* text-face only. It is 127 sites: 105 in the first population, 21 of them
475-
* `os build`'s through `compile.ts`, and 22 in the three text-face commands
476-
* the widening was filed on. A discovery or analyzer that silently stops
477-
* finding anything returns zero, and zero passes every per-member assertion —
478-
* these are what notice. A drop below them is a broken detector or a
479-
* deliberate removal; say which when you lower one.
480-
*
481-
* Seeding `this.error` raised the site floor to 131, measured on
482-
* `bee8d1c62c` over the same 65 commands: the 127 `this.exit` sites, plus
483-
* four `this.error` sites — `compile.ts`'s bundling refusal, counted for
484-
* `os compile` and again for `os build` through it, and `os init`'s two
485-
* refusals inside its outer `try`. Those four sites now spell `this.exit(2)`
486-
* (the status `this.error` raised, with the sentence rendered once): both
487-
* spellings are seeds, so the floor is unchanged.
471+
* Vacuity floors, not counts of today. A discovery or analyzer that silently
472+
* stops finding anything returns zero, and zero passes every per-member
473+
* assertion; these are what notice. Each sits at about two thirds of its
474+
* measured count, so deleting a command is an ordinary green change while a
475+
* walk or scan that resolves nothing is not. The site count is every
476+
* signal-raising call inside a `try` (`this.exit`, and `this.error`, which
477+
* raises the same signal in another spelling), summed over each member's
478+
* inheritance chain, so `compile.ts`'s sites count for `os build` too. Raise
479+
* one only alongside a reason that the smaller number is impossible.
488480
*/
489-
const POPULATION_FLOOR = 65;
490-
const SITE_FLOOR = 131;
491-
/** The first population's floor, kept so a face-label regression is seen too. */
492-
const JSON_FACE_FLOOR = 46;
481+
const POPULATION_FLOOR = 48; // measured 72 on 2026-10-27 (`185512cc`)
482+
const SITE_FLOOR = 109; // measured 164 on 2026-10-27 (`185512cc`)
483+
/** The first population (the JSON-capable commands), kept so a face-label regression is seen too. */
484+
const JSON_FACE_FLOOR = 35; // measured 53 on 2026-10-27 (`185512cc`)
493485

494486
// ---------------------------------------------------------------------------
495487
// 1. The analyzer, against fixtures — it must be able to fail
@@ -622,7 +614,7 @@ describe('every command lets the exit signal through', () => {
622614
});
623615

624616
it('the population is not vacuous — the floor holds and the commands this was filed on are in it', () => {
625-
expect(POPULATION.length, 'fewer commands discovered than this pin was widened over').toBeGreaterThanOrEqual(POPULATION_FLOOR);
617+
expect(POPULATION.length, 'fewer commands discovered than the vacuity floor').toBeGreaterThanOrEqual(POPULATION_FLOOR);
626618
// The population IS the walk: every module the walk lists is a member.
627619
expect(POPULATION).toHaveLength(COMMAND_FILES.length);
628620
expect(
@@ -643,7 +635,7 @@ describe('every command lets the exit signal through', () => {
643635

644636
it('the scan reaches the sites — including the completed-apply exit and the text-face refusals this was filed on', () => {
645637
const total = [...FLOW.values()].reduce((n, f) => n + f.sites.length, 0);
646-
expect(total, 'fewer signal-raising calls inside a try found than this pin was widened over').toBeGreaterThanOrEqual(SITE_FLOOR);
638+
expect(total, 'fewer signal-raising calls inside a try found than the vacuity floor').toBeGreaterThanOrEqual(SITE_FLOOR);
647639
expect(FLOW.get('migrate recorded-by')?.sites.map((s) => s.call)).toContain(
648640
"this.exit(result.status === 'completed' ? 0 : 1)",
649641
);

‎packages/cli/test/refusal-renders-once.test.ts‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,22 @@ const FILES = commandFiles(COMMANDS_DIR);
216216
const SCANS = FILES.map((file) => ({ file: relative(PKG_ROOT, file), scan: scanRefusalPairs(file, readFileSync(file, 'utf8')) }));
217217

218218
/**
219-
* Floors, measured on `fd5a1cd597`: 65 command modules, 57 of them calling a
220-
* refusal printer, and `this.error` raised from 3 (`os datasource introspect`,
221-
* `list-tables`, `validate`) once `init.ts` and `compile.ts` stopped. A scan
222-
* that silently finds nothing reports zero pairs, and zero passes every
223-
* assertion below; these are what notice. A drop below them is a broken
224-
* detector or a deliberate removal — say which when you lower one.
219+
* Vacuity floors, not counts of today. A scan that silently finds nothing
220+
* reports zero pairs, and zero passes every assertion below; these are what
221+
* notice. Each sits at about two thirds of its measured count, so deleting a
222+
* command is an ordinary green change while a walk or scan that resolves
223+
* nothing is not. `this.error` is raised from only 3 modules (`os datasource
224+
* introspect`, `list-tables`, `validate`), too few for a fraction, so that
225+
* floor only says the population is not empty. Raise one only alongside a
226+
* reason that the smaller number is impossible.
225227
*/
226-
const FILE_FLOOR = 60;
227-
const PRINTER_FILE_FLOOR = 50;
228-
const ERROR_FILE_FLOOR = 3;
228+
const FILE_FLOOR = 48; // measured 72 on 2026-10-27 (`185512cc`)
229+
const PRINTER_FILE_FLOOR = 42; // measured 64 on 2026-10-27 (`185512cc`)
230+
const ERROR_FILE_FLOOR = 1; // non-empty: measured 3 on 2026-10-27 (`185512cc`)
229231

230232
describe('no command renders a refusal and also raises it with this.error', () => {
231233
it('the population is not vacuous — the floors hold', () => {
232-
expect(FILES.length, 'fewer command modules than this pin was written over').toBeGreaterThanOrEqual(FILE_FLOOR);
234+
expect(FILES.length, 'fewer command modules than the vacuity floor').toBeGreaterThanOrEqual(FILE_FLOOR);
233235
expect(SCANS.filter((s) => s.scan.printerCalls > 0).length, 'refusal printers not found').toBeGreaterThanOrEqual(PRINTER_FILE_FLOOR);
234236
expect(SCANS.filter((s) => s.scan.errorCalls > 0).length, '`this.error` not found').toBeGreaterThanOrEqual(ERROR_FILE_FLOOR);
235237
});

0 commit comments

Comments
 (0)