Repository navigation
Commit 92ca4cd
test(spec): three src/ test-budget rows trimmed, two at a one-program floor left listed (#23819)
Part of #23180
Clause-②: no
The five `packages/spec/src/` rows of the test-budget census, measured
first. Three rows are trimmed in the test, with every `expect` line
unchanged. Two rows are left unchanged: each one is already at its floor
of one TypeScript program, which is neither of ruling record
`6181973363`'s two classes, so they get no declaration (see the last
section). This PR counts no row off the card: the next refresh list
decides each one, per the card's pin.
## Readings, per file
CI readings are the vitest module line (seconds) in the `Test Core
(1/6)` shard of the hourly runs that executed `@objectstack/spec` (no
`cache hit` for it in the log): `38833767749` (01:11, head
`4fe8b3def0`), `38838260718` (02:01, head `ec44cf60bf`) and
`38848429828` (04:01, head `9b799e6fb5`). Run `38843417737` (03:01)
replayed spec from the cache and is not used. The job-log blob host is
unreachable from this container, so only each log's last 5000 lines were
readable; that is why 04:01 has no reading for `view` and `app`.
Local readings are the sum of the file's case durations (ms), from
vitest's JSON reporter. Each one is a five-file run with
`--maxWorkers=2` under `os-verify-lock.sh` (shared-box ms), interleaved
between a base worktree at `f846cc2020` and this branch. Three runs on
each side.
| file (`src/`) | census | CI 01:11 / 02:01 / 04:01 | local before (ms)
| local after (ms) | disposition |
|:--|--:|:--|:--|:--|:--|
| `contracts/scoped-context.test.ts` | 91.1 | 14.7 / 14.0 / 16.7 | 2296
/ 2050 / 2251 | file unchanged | unchanged: at its floor, no class |
| `integration/connector-author-shape.test.ts` | 49.5 | 16.8 / 15.9 /
18.1 | 2723 / 2323 / 2305 | file unchanged | unchanged: at its floor, no
class |
| `kernel/metadata-type-registry-allow-org-override-absence.test.ts` |
11.4 | 8.8 / 11.1 / 10.3 | 1308 / 1244 / 1285 (alone) | 817 / 805 / 805
(alone) | trimmed |
| `ui/view.test.ts` | 10.9 | 9.1 / 10.7 / not readable | 3574 / 3226 /
3193 | 223 / 194 / 187 | trimmed |
| `ui/app.test.ts` | 10.8 | 10.2 / 10.8 / not readable | 1772 / 1723 /
1716 | 1244 / 1257 / 1172 | trimmed |
The allow-org row was re-measured alone, three runs on each side, after
its second commit; the five-file runs before that commit read 1570 /
1359 / 1311 against 1235 / 1118 / 1102. If each file keeps its own
CI-to-local ratio (slowest CI reading over the slowest local
before-reading), the after-readings project to about 7.0 s (allow-org),
0.7 s (view) and 7.7 s (app) in the battery. That is NOT MEASURED on CI;
this PR's own `Test Core (1/6)` run is the first post-trim reading.
The census premise still holds for all five: each row read over 10 s in
at least one of the three executed runs.
## Trimmed: what each one waited on
- **`ui/view.test.ts`**: two cases took 1.1 to 1.6 s each, and all of it
was `await import('../shared/index')`, `'../ui/index'` and
`'../api/index'` inside the case, which loads three published entries.
The three loads are now static imports at module top, which the census
line does not count (AGENTS.md: "Clocked windows measure behaviour,
never loading"). The four cases read the same module namespaces as
before, so identity (`toBe`) assertions compare the same objects. Honest
accounting: the load cost is moved, not removed. The five-file run's
import phase rose from 2.4 to 2.9 s to 5.4 to 5.9 s, and its total wall
went from 7.7 to 7.9 s to 7.2 to 7.7 s.
- **`ui/app.test.ts`**: the compiler-API case loaded `typescript` (about
300 ms) and `node:path` / `node:url` with `await import()` inside the
case. They are now module-top imports. The rest of the case is one
`ts.createProgram` over `app.zod.ts` (about 330 ms) and resolving
`NavigationArea`'s members (about 640 ms). Neither the compiler options
nor the lib set changes the latter, so that stays as is.
-
**`kernel/metadata-type-registry-allow-org-override-absence.test.ts`**:
the walk reads 8,792 files (about 290 ms, the declared radius) and
parsed every file mentioning either name. Two costs were removable:
1. A file holding both names was parsed twice. The two largest files in
the radius are among them: `spec/src/migrations/registry.ts` (2.6 MB)
and `metadata-protocol/src/protocol.ts` (1.8 MB). Each file is now
parsed once, and both names are read off that one tree
(`codeReferencesByName`; the matcher's predicate is unchanged, and
`codeReferences` is the one-name view of it).
2. The new-name readers are asserted only by `arrayContaining` of three
named files, so a reader anywhere else cannot change that verdict. Only
those three files are now asked the new name (`NEW_READERS`, the same
list the assertion uses). The old name is still read off every file in
the radius that mentions it.
Parsed bytes went from 14.6 MB to about 6 MB.
## Ablations: the changed allow-org paths still go red
Run through `scripts/ablation-replace.mjs` in wrap mode on
`packages/metadata-protocol/src/sys-metadata-repository.ts`, which holds
both names and is one of the three `NEW_READERS`. The expected direction
was red every time, and red was observed every time. Each restore was
proven by the tool: blob `5630b9de7b42` equals HEAD, and `git diff HEAD`
is empty. No `dist/` is on the path, because the test reads source text.
- **A1**, `.filter((e) => e.allowEnvironmentOverlay)` changed to
`.filter((e) => e.allowEnvironmentOverlay && !e.allowOrgOverride)` (blob
to `b96bfd450123`): 1 of 2 failed, on the offenders assertion, naming
`packages/metadata-protocol/src/sys-metadata-repository.ts:406:52`. This
is the old-name leg on a file parsed once for both names.
- **A2**, the same anchor changed to `.filter((e) => e.overlayGone)`
(blob to `6132dc4d627f`): 1 of 2 failed, on
`expect([...newReaders]).toEqual(expect.arrayContaining(NEW_READERS))`.
This is the new-name leg.
The `view` and `app` changes move import statements and change no logic,
so they have no ablation.
## Verification
- The five files pass at ``2b6764e25d``: 586 tests across the five.
- `pnpm --filter @objectstack/spec typecheck`: VERDICT command-exit 0.
It includes `check:test-typecheck`, which compiles `src/**/*.test.ts`
through `tsconfig.test.json` and held its debt ledger.
- `eslint --no-inline-config` on the three changed files: exit 0.
- Gates: `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `2b6764e25d` derived 76 commands from the
3 changed paths (merge base `f846cc202`). All 76 ran here, each exit
captured before any pipe. 74 exited 0. Two of them
(`check-plugin-teardown-shape --self-test` and `lint`'s
`check:doc-formula-expressions`) first exited 3 (PREREQUISITE NOT MET: a
shallow clone, and an unbuilt `@objectstack/formula`); they exited 0
after `git fetch --unshallow` and a build of `@objectstack/lint`'s
dependency closure. `--ran` reports "76 derived famil(ies) accounted for
— 74 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)". The two
are `check:dual-build-cjs-loads` and `check:lean-entry-closure`, which
need every package's `dist/` built. Neither reads a test file. CI runs
both.
- No publish: `npm pack --dry-run` of `@objectstack/spec` 18.0.0-next.2
lists 2094 files, 0 of them `*.test.ts`. The positive controls
`dist/index.js` and `src/ui/view.zod.ts` are present. So
`skip-changeset`.
- Local test scope: only the five named files ran here. The diff is test
files only, and no other test imports them. CI's `Test Core` runs both
spec projects.
## Not trimmed: `scoped-context` and `connector-author-shape` are at
their floor
PR #23547 already folded each file's probes into one `ts.createProgram`.
Timing that program per probe (an instrumented local copy, not
committed) shows where the time goes. The first probe whose diagnostics
are asked pays the whole type-graph resolution: 740 ms (`jsdoc-usage`)
and 860 ms (`doc-l3-connector-0`). Every other probe takes 0 to 7 ms,
except the second connector example at 117 ms. Program construction
parses 586 and 614 files (the spec entry barrels a hook or connector
author imports, `lib.dom.d.ts` and `@types/node`) in about 1.45 s each
under two workers. Changing `lib` or `types` did not change the file
count, because the spec source itself pulls those in.
So each file's floor is one compile of the spec's type graph. That is
neither "spawns the real producer once per single-cause fixture" nor
"whole-package import", so these files carry no `// test-budget:` line,
and they stay listed. Whether a third class is wanted is a question for
the seat (the report's `open_questions`); it is not decided here.
## Acceptance notes
- The `view` trim moves load time from the clocked window to the import
phase, as the repository's own rule for clocked windows says it should.
It does not make the file cheaper end to end. The census line counts
only the clocked window.
- The vitest module line excludes import time, so the census and these
readings measure the clocked window only. This is the same caveat PR
#23752 records.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01VTJ1Sey3QK5wZbayQXfFfH)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f606ba2 commit 92ca4cd
3 files changed
Lines changed: 53 additions & 36 deletions
File tree
- packages/spec/src
- kernel
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
61 | | - | |
62 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | | - | |
65 | | - | |
| 81 | + | |
| 82 | + | |
66 | 83 | | |
67 | | - | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | | - | |
71 | | - | |
| 87 | + | |
| 88 | + | |
72 | 89 | | |
73 | 90 | | |
74 | 91 | | |
75 | 92 | | |
76 | | - | |
| 93 | + | |
77 | 94 | | |
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
81 | 98 | | |
82 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
83 | 103 | | |
84 | 104 | | |
85 | 105 | | |
| |||
122 | 142 | | |
123 | 143 | | |
124 | 144 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
128 | 150 | | |
129 | 151 | | |
130 | 152 | | |
| |||
140 | 162 | | |
141 | 163 | | |
142 | 164 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 165 | + | |
148 | 166 | | |
149 | 167 | | |
150 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
| |||
1587 | 1593 | | |
1588 | 1594 | | |
1589 | 1595 | | |
1590 | | - | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
| 1596 | + | |
1595 | 1597 | | |
1596 | 1598 | | |
1597 | 1599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| |||
4050 | 4058 | | |
4051 | 4059 | | |
4052 | 4060 | | |
4053 | | - | |
4054 | | - | |
4055 | | - | |
4056 | | - | |
| 4061 | + | |
4057 | 4062 | | |
4058 | 4063 | | |
4059 | 4064 | | |
4060 | 4065 | | |
4061 | 4066 | | |
4062 | 4067 | | |
4063 | | - | |
4064 | | - | |
4065 | | - | |
4066 | | - | |
| 4068 | + | |
4067 | 4069 | | |
4068 | 4070 | | |
4069 | 4071 | | |
| |||
4154 | 4156 | | |
4155 | 4157 | | |
4156 | 4158 | | |
4157 | | - | |
4158 | | - | |
4159 | | - | |
4160 | | - | |
| 4159 | + | |
4161 | 4160 | | |
4162 | 4161 | | |
4163 | 4162 | | |
| |||
4173 | 4172 | | |
4174 | 4173 | | |
4175 | 4174 | | |
4176 | | - | |
4177 | | - | |
4178 | | - | |
| 4175 | + | |
4179 | 4176 | | |
4180 | 4177 | | |
4181 | 4178 | | |
| |||
0 commit comments