Repository navigation
Commit b572289
test(spec): scoped-context and connector-author-shape compile their probes in one program, reading only the probe files' diagnostics (#23547)
Part of #23180
Clause-②: no
Two of the three `src/` rows this round claimed come off the card's
list. The third is left as it was, at a measured floor.
## Rows this PR closes, and the row it leaves
All readings are local, three runs per file, each through `bash
scripts/pm/os-verify-lock.sh -c`. They are shared-box seconds, because
the lock excludes only other locked runs.
The command was `env -u AI_AGENT -u CLAUDECODE -u CLAUDE_CODE -u
CURSOR_AGENT NODE_OPTIONS=--max-old-space-size=4096 pnpm --filter
@objectstack/spec exec vitest run --project local --maxWorkers=2 FILE
--reporter=default --reporter=json --outputFile.json=OUT`.
Two figures are given per run:
- the vitest module line, which is what the battery's per-file capture
reads;
- the run's whole `Duration`. One file compiled at collection time,
which falls outside the module line.
Before = `origin/main` at `5fd2c76d6c` (a detached worktree). After =
this branch at `2da2cbe14a`. The merge of `origin/main` that follows
touches no `packages/spec` file.
| row (the card's reading) | before: module line · Duration | after:
module line · Duration | verdict |
|:--|:--|:--|:--|
| `src/contracts/scoped-context.test.ts` (91.1 s) | 37327 / 25789 /
24079 ms · 38.19 / 26.63 / 24.85 s · 8/8 pass | 2927 / 2765 / 2689 ms ·
3.76 / 3.52 / 3.47 s · 8/8 pass | **closed**: under 4 s locally on all
three runs |
| `src/integration/connector-author-shape.test.ts` (49.5 s) | 12176 /
11723 / 11716 ms · 18.02 / 17.06 / 16.73 s, of which 5.64 / 5.17 / 4.85
s was at collection · 11/11 pass | 2947 / 3070 / 3020 ms · 3.96 / 4.11 /
4.05 s, of which 0.83 / 0.87 / 0.85 s was at collection · 11/11 pass |
**closed**: module line under 4 s on all three runs |
| `src/shared/alias-integrity.test.ts` (40.8 s) | 17717 / 16472 / 17538
ms · 20.03 / 18.99 / 19.80 s · 20/20 pass | untouched | **left open** at
its floor (section below) |
The card's other rows are not addressed here, and #23180 remains open
for them. The two dominant rows wait on decision card #23534.
## What changed
Both files drive `ts.createProgram` over this package's source to
compile probe snippets. Each compile then asked
`ts.getPreEmitDiagnostics(program)` for the whole program and kept only
the probes' diagnostics. The change is in each file's harness only, and
it has two parts.
1. **Diagnostics are requested per probe file**, as
`ts.getPreEmitDiagnostics(program, probeFile)`, which is the way
`shared/retired-key-tsc-diagnostic.test.ts` already asks.
- The whole-program request type-checked the body of every source file
the probes reach, and the filter then threw all of that away.
- A probe's own diagnostics still reflect every type it reaches.
- A probe that never entered the program now throws instead of reading
as empty.
2. **One program per file.** Each describe block registers its probes at
collection (`registerProbes`). The first case that reads a result
compiles every registered probe together, in one program.
- Before, scoped-context built four programs. connector-author-shape
built three, two of them at collection time.
- Every probe is its own module, so sharing a program changes no probe's
answer (the equivalence reading below measures this).
- A name registered twice must carry the same text. A read of a probe
the program never saw throws.
Every `expect` line is unchanged. The probe texts are the same strings:
only where they are built moved, from the case body to the describe
body. No test is deleted, no timeout is raised, and no file moves
project. The connector case's own `180_000` timeout stays where it was.
Its comment now says that the CI readings it cites were taken on the old
harness.
## Evidence
**Equivalence.** One-shot instrumented copies, never committed, ran the
old harness beside the new one: one program per call with whole-program
diagnostics, against the shared program with per-probe diagnostics. They
compared every probe's diagnostics as `category:start:length TScode:
full message chain`.
- scoped-context: 23 probe readings, all IDENTICAL (13 with zero
diagnostics, 10 with one).
- connector-author-shape: 9, all IDENTICAL.
**Ablations.** Both were predicted red and both were observed red. Each
ran through `node scripts/ablation-replace.mjs` in wrap mode, on
`2da2cbe14a`. No `dist/` is in the path, because the harness maps
`@objectstack/spec/*` to `src/` and tsc reads the source.
- **S1**: deleted `count` from `IScopedObjectRepository` in
`scoped-context.ts`.
- Landed: anchor count 1 to 0, blob `429e0ad0d846` to `370bfd11bd4c`.
- Result: scoped-context failed 1, passed 7. The failing case was
`legal-count must compile clean`, which received `TS2339: Property
'count' does not exist on type 'IScopedObjectRepository'.`
- Restore: blob equals HEAD's `429e0ad0d846`, and `git diff HEAD` is
empty.
- **C1**: changed the bare `Connector` alias in `connector.zod.ts` back
to the parsed shape (`z.input` to `z.infer`).
- Landed: anchor count 1 to 0, replacement count 0 to 1, blob
`84b04fa30ed2` to `ee0e5f7efbd0`.
- Result: connector-author-shape failed 3, passed 8:
- L3 example #1: TS2739, missing `authentication`, `requestTimeoutMs`
and `enabled`;
- the live-key control: TS2740 on `retryConfig`;
- `accepts the omitted defaults under the bare Connector`: TS2739.
- Restore: blob equals HEAD's `84b04fa30ed2`, `git diff HEAD` is empty,
and porcelain is 0.
## The row left open: `alias-integrity.test.ts`
This file's subject is every module in `packages/spec/src`. Its
`beforeAll` imports all 1,393 non-test modules and forces every schema,
so the `strictObject` registry is complete. An AST scan then proves that
every alias-table call site was reached. Profiled locally:
- **The import walk alone**, timed per import in a scratch copy: 15,078
ms of a 17.7 s module line. vitest's own counter puts `transform` at
12.4 to 13.2 s on the three readings above.
- **Inside the worker**, 14.7 s of a 17.3 s CPU profile is idle, waiting
on the main process's per-module transform. Evaluating the modules takes
about 2.6 s.
So the floor is vitest's transform of the whole package: about 15 s
locally, nearly 4x the 4 s margin. Two routes would reach the line, and
neither is a fix to the test:
- walk fewer modules, which removes the "every module" coverage the file
exists for;
- load the walk through a different loader, which is a rewrite in which
every helper the assertions use has to come from that loader's module
graph.
Under the dispatch's stop rule the file is untouched, and the choice
goes back to the card.
## Publish reading: nothing publishes
The two edited files are `*.test.ts` under `src/`. `@objectstack/spec`'s
`files[]` ships `src/**/*.zod.ts` only. Measured on the packed tarball
(`pnpm pack` after `pnpm --filter @objectstack/spec build`,
`18.0.0-next.1`):
- 2,091 files, of which `*.test.ts`: 0.
- Files containing `registerProbes`: 0. `__scoped_context_probes__`: 0.
`__connector_author_shape_probes__`: 0.
- Positive controls: `IScopedObjectRepository` is in 8 files and
`ConnectorParsed` in 7.
So `skip-changeset`.
## Gates, on `39d4bbdd5d` (this head)
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 76 commands. All 76 were run, each
exit captured before any pipe:
- 74 exited 0. `check:doc-formula-expressions` first exited 3
(`@objectstack/formula` and `@objectstack/lint` not built). After `turbo
run build` of those two, it exited 0.
- 2 are NOT MEASURED, exit 3 PREREQUISITE NOT MET: `pnpm
check:dual-build-cjs-loads` and `pnpm check:lean-entry-closure`. Both
load other packages' built `dist/` (objectql and the rest), and neither
can read a test file. CI runs both.
- The `--ran` verdict: `76 derived famil(ies) accounted for — 74 run, 2
NOT-MEASURED (2 DERIVED from a recorded exit 3)`, exit 0.
- `pnpm --filter @objectstack/spec build` exited 0.
- `pnpm --filter @objectstack/spec typecheck` exited 0. That includes
`check:test-typecheck`, and `tsc -p tsconfig.test.json --listFilesOnly`
lists both edited files. Neither file is in `test-typecheck-debt.json`.
- `eslint --no-inline-config` on the two files exited 0.
- Declared narrowing: the package's full `test` and `test:repo` were not
run locally. The two edited files are leaves that nothing imports, and
CI runs both projects.
## Acceptance notes
- The `alias-integrity.test.ts` floor above is reported to the card with
options, not filed.
- `check:dual-build-cjs-loads` and `check:lean-entry-closure` are NOT
MEASURED locally, as stated above.
---
_Generated by [Claude
Code](https://claude.ai/code/session_0121ooBYRmS8ziFXm9ai5YHm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 086fa46 commit b572289
2 files changed
Lines changed: 165 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
| |||
107 | 115 | | |
108 | 116 | | |
109 | 117 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
119 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
120 | 161 | | |
121 | 162 | | |
122 | 163 | | |
| |||
168 | 209 | | |
169 | 210 | | |
170 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
171 | 219 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 220 | + | |
178 | 221 | | |
179 | 222 | | |
180 | 223 | | |
| |||
215 | 258 | | |
216 | 259 | | |
217 | 260 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
222 | 265 | | |
223 | | - | |
| 266 | + | |
| 267 | + | |
224 | 268 | | |
225 | 269 | | |
226 | 270 | | |
| |||
259 | 303 | | |
260 | 304 | | |
261 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
262 | 320 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 321 | + | |
276 | 322 | | |
277 | 323 | | |
278 | 324 | | |
| |||
323 | 369 | | |
324 | 370 | | |
325 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
326 | 390 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 391 | + | |
344 | 392 | | |
345 | 393 | | |
346 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
| |||
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
134 | 174 | | |
135 | 175 | | |
136 | 176 | | |
| |||
191 | 231 | | |
192 | 232 | | |
193 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
194 | 245 | | |
195 | | - | |
196 | | - | |
197 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
198 | 252 | | |
199 | 253 | | |
200 | 254 | | |
| |||
205 | 259 | | |
206 | 260 | | |
207 | 261 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 262 | + | |
219 | 263 | | |
220 | 264 | | |
221 | 265 | | |
| |||
279 | 323 | | |
280 | 324 | | |
281 | 325 | | |
282 | | - | |
| 326 | + | |
283 | 327 | | |
284 | 328 | | |
285 | 329 | | |
| |||
291 | 335 | | |
292 | 336 | | |
293 | 337 | | |
| 338 | + | |
294 | 339 | | |
295 | 340 | | |
296 | 341 | | |
| |||
299 | 344 | | |
300 | 345 | | |
301 | 346 | | |
| 347 | + | |
302 | 348 | | |
303 | 349 | | |
304 | 350 | | |
| |||
382 | 428 | | |
383 | 429 | | |
384 | 430 | | |
385 | | - | |
| 431 | + | |
386 | 432 | | |
387 | 433 | | |
| 434 | + | |
388 | 435 | | |
389 | 436 | | |
390 | 437 | | |
391 | 438 | | |
| 439 | + | |
392 | 440 | | |
393 | 441 | | |
394 | 442 | | |
| |||
0 commit comments