Repository navigation
Commit 451bf61
Part of #23181 (slice 8). The card is a series and stays open.
Clause-②: no
Metadata-protocol: none
## Rows this PR addresses
Eight `@objectstack/cli` unit-tier rows from the card's table, the `os
doctor` in-process suites. They share one cause, which this PR removes:
| file (unit tier) | card CI reading | local before (3 runs) | local
after (3 runs) | after / before (medians) | CI reading × ratio | status
|
|:--|--:|--:|--:|--:|--:|:--|
| `src/commands/doctor-ledger-read-failure.test.ts` | 17.0 s | 34.35 /
28.07 / 26.37 | 16.50 / 13.85 / 13.03 | 0.49 | 8.4 s | reduced,
projected under 10 s, not proven |
| `src/commands/doctor-ledger-posture-independence.test.ts` | 16.6 s |
24.46 / 29.89 / 27.00 | 17.37 / 15.12 / 14.69 | 0.56 | 9.3 s | reduced,
projected under 10 s, not proven |
| `src/commands/doctor-unexamined-spec-tree.test.ts` | 14.3 s | 18.02 /
18.65 / 19.55 | 10.41 / 11.20 / 11.12 | 0.60 | 8.5 s | reduced,
projected under 10 s, not proven |
| `src/commands/doctor-node-env-default.test.ts` | 14.0 s | 24.42 /
18.29 / 18.08 | 13.00 / 13.86 / 14.47 | 0.76 | 10.6 s | reduced, **not
closed** |
| `src/commands/doctor-deprecation-hint-commands.test.ts` | 11.6 s |
13.70 / 17.26 / 14.19 | 7.03 / 6.64 / 6.91 | 0.49 | 5.6 s | done |
| `src/commands/doctor-config-load-cause.test.ts` | 11.6 s | 13.58 /
12.94 / 14.16 | 6.41 / 6.50 / 5.77 | 0.47 | 5.5 s | done |
| `src/commands/doctor-ledger-dir-authority.test.ts` | 10.3 s | 18.78 /
19.57 / 14.62 | 7.28 / 7.08 / 6.45 | 0.38 | 3.9 s | done |
| `src/commands/doctor-config-env-overlay.test.ts` | 10.2 s | 12.23 /
11.89 / 12.32 | 5.37 / 5.01 / 4.71 | 0.41 | 4.2 s | done |
The pin is the card's: the next landed refresh's per-file list no longer
names a "done" row. The "projected" rows rest on a ratio applied to the
card's old CI reading, so CI decides them, not this table.
## The cause and the fix
Each suite drives the real command with `Doctor.run(argv, { root:
CLI_ROOT })`. Given a root, oclif loads a fresh `Config`.
`@objectstack/cli` ships no `oclif.manifest.json`, so that load builds
the command manifest by importing every compiled command under
`dist/commands` (73 commands). Measured in-process: **6.6 s** for that
`Config.load`, paid by each file's first test. `doctor.ts` never reads
`this.config`, so the command list is pure overhead for these suites.
`packages/cli/src/utils/__tests__/doctor-config.ts` (new, 36 lines)
loads one `Config` per file from the package's own `package.json` with
only `oclif.commands` dropped. Hooks still load (the `preparse`
separator strip is present: `hooks` = `["preparse"]`), and the load
takes 36 ms. The eight files pass `await doctorConfig()` instead of `{
root: CLI_ROOT }` (12 call sites) and drop the now-unused `CLI_ROOT` /
`HERE` / `fileURLToPath` lines.
- It lives under `src/**/__tests__/`, the path `tsconfig.build.json`
already excludes, next to `src/utils/__tests__/server-body.ts`. It is
not under `test/helpers/`, because `tsconfig.json`'s `rootDir: src`
refuses a `src/` test importing from `test/` (TS6059, measured). It is
not under `src/commands/`, because `environments.test.ts` walks every
`.ts` there as a command source and would have modelled a phantom
`__tests__ doctor-config` command id (measured: the unit tier went from
4812 to 4813 tests).
- No test was deleted, renamed or re-tiered, and no timeout changed. All
139 tests pass in every run, with test full names identical before and
after, file by file.
## Why these rows (A2: win per changed line)
One 36-line helper plus 12 one-line call-site swaps (+57 / −48) removes
6.6 s from each of eight rows and brings four under the line. Rows
looked at and not taken:
- The `@objectstack/cli` integration files at 90 to 301 s
(`data-commands.absent-database`, `stack-conversion-record-door`,
`package-install-local-*`, ...). Each spawns the real CLI per fixture.
Their fix is either a per-file restructuring or the `test-budget:`
header method (slice 6), and that method needs a CI reading this
container could not obtain (see A1).
- `test/scaffold-emission-typechecks.test.ts` (unit, 33.3 s): a
type-graph compile, a `test-budget` class candidate, so the same
CI-reading constraint applies.
- `migrate-meta-*` and `explain-rule-id` unit rows (10.2 to 18.1 s): not
measured in this slice.
- The other packages' rows: slices 1 to 5 and 7 took `runtime`,
`client`, `verify`, `rest` and `create-objectstack`.
## A1: the work list
PR #25409 (`97be89bb3b`), the newest landed refresh, carries **no
per-file list**: its `--diff` refused (exit 1) on
`packages/cli/src/commands/migrate/audit-mail-bodies.archive.integration.test.ts:2`
(`test-budget: 85`, off the 10 s grid). `origin/main` at `e649c2d9`
already reads `90` there, so the next refresh can list files.
Reproducing the diff locally was not possible: the
`test-core-timings-N-of-6` captures are retained one day, so only 2 of
the window's 8 runs still had them, and this container's proxy refuses
the artifact blob host (HTTP 403). So the rows above come from the
card's table, each re-measured on `e649c2d9` (every one still read over
10 s locally before the change).
## What the remaining time is (for the next slice)
Measured per warm `Doctor.run` (about 0.6 to 0.9 s): the three real tool
probes `pnpm -v` (0.4 to 0.9 s under vitest's PATH), `tsc -v` (0.1 to
0.4 s) and `git --version` (about 15 ms). On top of that, each file's
first run pays the lazy `@objectstack/cloud-connection` import (4.3 s).
The files still near or over the line are the ones with 13 to 18 runs.
Stubbing the probes is a separate decision, because the suites then stop
seeing the real probe rows. It is not taken here.
## Proof
- Measurement, same way before and after: `bash
scripts/pm/os-verify-lock.sh -c 'cd packages/cli && pnpm exec vitest run
--project unit --maxWorkers=2 --reporter=json --outputFile=FILE' + the 8
files`. Per-file = the json reporter's `endTime − startTime` (the
per-file module line CI reports; it sums to vitest's `tests` total).
"Before" restored the 8 files from `e649c2d9` (tree only), then restored
from `HEAD` (`git diff HEAD` empty afterwards). Shared box: absolute
seconds are box readings, so ratios are the comparable figure.
- Shared fixture check: the helper is new and only these eight files
import it. `doctor.ts` and every other `Doctor.run` suite
(`doctor-env-provenance`, `doctor-tenancy-posture-report`) are
untouched.
- `pnpm --filter @objectstack/cli typecheck` (tsc +
`check:test-typecheck` OK): exit 0 at `f0e74dd1d`. The `--noEmit`
program includes the helper; the build program (`tsconfig.build.json
--listFilesOnly`, 1318 files, `doctor.ts` among them) includes nothing
under `__tests__`.
- cli unit tier at `f0e74dd1d`: 326/327 files, 4811/4812 tests. The one
failure is `src/utils/boot-preparation-parity.test.ts`, a 5 s vitest
timeout under load (9.15 s) in a file this diff does not touch. Re-run
alone: 37/37, exit 0. The two earlier full runs passed it (327/327). The
integration tier is declared to CI: the diff touches no integration file
and no spawn entry.
- `node scripts/pm/dispatch-gates.mjs --commands` at `f0e74dd1d`: 58
commands, all exit 0. `--ran`: "58 derived, 58 run, 0 NOT-MEASURED, 0
UNRUN".
- `eslint --no-inline-config packages/cli`: exit 0.
- `pnpm lint` (`eslint . --no-inline-config`, the whole repo): exit 0 at
`f0e74dd1d`.
## Changeset
`skip-changeset`: nothing published changes. Every changed file is a
`*.test.ts` or sits under `src/**/__tests__/`, which
`tsconfig.build.json` excludes, so no changed file reaches `dist/`
(`files: ["dist", ...]`).
## Acceptance notes
- `@objectstack/cli` ships no `oclif.manifest.json`, so any
`Config.load` from the package root imports every command. Whether the
published `os` binary pays the same cost per invocation was NOT MEASURED
here. This is an observation only.
- `src/utils/boot-preparation-parity.test.ts` "every SERVE_ONLY entry is
still used by serve.ts" ran 9.15 s against vitest's 5 s default in one
contended full-tier run. Observed once.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_013fXj9gbwakFbBp5U9x4EjF
---
_Generated by [Claude
Code](https://claude.ai/code/session_013fXj9gbwakFbBp5U9x4EjF)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent b694e56 commit 451bf61
9 files changed
Lines changed: 57 additions & 48 deletions
File tree
- packages/cli/src
- commands
- utils/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | 66 | | |
71 | 67 | | |
72 | 68 | | |
| |||
257 | 253 | | |
258 | 254 | | |
259 | 255 | | |
260 | | - | |
| 256 | + | |
261 | 257 | | |
262 | 258 | | |
263 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 59 | | |
64 | 60 | | |
65 | 61 | | |
| |||
199 | 195 | | |
200 | 196 | | |
201 | 197 | | |
202 | | - | |
| 198 | + | |
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
254 | | - | |
| 253 | + | |
255 | 254 | | |
256 | 255 | | |
257 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | 51 | | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 65 | | |
70 | 66 | | |
71 | 67 | | |
| |||
258 | 254 | | |
259 | 255 | | |
260 | 256 | | |
261 | | - | |
| 257 | + | |
262 | 258 | | |
263 | 259 | | |
264 | 260 | | |
| |||
410 | 406 | | |
411 | 407 | | |
412 | 408 | | |
413 | | - | |
| 409 | + | |
414 | 410 | | |
415 | 411 | | |
416 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | 68 | | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
| |||
224 | 220 | | |
225 | 221 | | |
226 | 222 | | |
227 | | - | |
| 223 | + | |
228 | 224 | | |
229 | 225 | | |
230 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | 89 | | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 103 | | |
108 | 104 | | |
109 | 105 | | |
| |||
439 | 435 | | |
440 | 436 | | |
441 | 437 | | |
442 | | - | |
| 438 | + | |
443 | 439 | | |
444 | 440 | | |
445 | 441 | | |
| |||
765 | 761 | | |
766 | 762 | | |
767 | 763 | | |
768 | | - | |
| 764 | + | |
769 | 765 | | |
770 | 766 | | |
771 | 767 | | |
| |||
837 | 833 | | |
838 | 834 | | |
839 | 835 | | |
840 | | - | |
| 836 | + | |
841 | 837 | | |
842 | 838 | | |
843 | 839 | | |
| |||
931 | 927 | | |
932 | 928 | | |
933 | 929 | | |
934 | | - | |
| 930 | + | |
935 | 931 | | |
936 | 932 | | |
937 | 933 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
| |||
337 | 334 | | |
338 | 335 | | |
339 | 336 | | |
340 | | - | |
| 337 | + | |
341 | 338 | | |
342 | 339 | | |
343 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 73 | | |
77 | 74 | | |
78 | 75 | | |
| |||
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
178 | | - | |
| 175 | + | |
179 | 176 | | |
180 | 177 | | |
181 | 178 | | |
| |||
289 | 286 | | |
290 | 287 | | |
291 | 288 | | |
292 | | - | |
| 289 | + | |
293 | 290 | | |
294 | 291 | | |
295 | 292 | | |
| |||
| 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 | + | |
0 commit comments