Repository navigation
test(vi-mock): inherit the real @object-ui/app-shell surface in 23 vi.mock factories (objectui#6892 slice 14) - #8407
Conversation
….mock factories Every one of the 23 frozen factories hand-listed between one and 26 of the barrel's exports, so the next export any module in the file's import graph reads at module scope would resolve to `undefined` against the stand-in and the file would die during collection -- with zero failed assertions, which is the failure shape check-vi-mock-inherit exists to catch. Each now spreads the real module first; every hand-written double stays after it as the override, which is the behaviour those tests assert. No assertion moved: all 23 removed lines in this diff are `vi.mock(` / `vi.doMock(` factory lines. Twenty-two are module-scope `vi.mock` calls. The twenty-third, `AppManagementPage.mutations.test.tsx:280`, is a `vi.doMock` inside a test body after `vi.resetModules()`, so its obtain sits in a bounded window rather than the unbounded import phase. objectui#8173 measured it before conversion: 459ms -> 660ms against a 5000ms testTimeout. `FormPage.predicateScope.test.tsx` gains a paragraph in the comment that documents its module-scope import, because this change reverses that comment's factual claim about where the barrel is loaded. Nothing was removed from it. 22 files, 150 tests green; the whole console project 89 files / 1069 tests green. Part of objectui#6892 (slice 14). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
The sweep in the previous commit took this specifier to zero frozen, so it
joins COVERED_SPECIFIERS -- the grow-only list whose documented widening
precondition is a sweep, not a judgement. Eighteen members become nineteen,
and the gate reads 648 of 648 inheriting, with `other workspace` falling 35
to 12: the covered count rose by exactly the converted sites and no site
moved the other way.
The header gains the slice-14 record in the shape slices 5 to 13 used, plus
two things specific to this specifier:
- The three-way count reconciliation. 22 is a FILE count (the worklist's
own recipe, and unreachable as a site count because one file carries two
sites); 23 is what `scan()` reports; 24 is an unmasked regex, whose extra
match is inside a BLOCK COMMENT, not a string literal. That distinction
matters because a commented occurrence is masked before CALL_RE runs and
lands in NO bucket -- reading it as the `embedded` bucket would have been
plausible and wrong.
- Why no maintainer ruling is owed on the cost that parked this specifier
under objectui#6580: the 220s extrapolation does not survive, because the
cost is a one-time per-process transform that ~67 of the console
project's 89 files already pay.
The record also states what is left: with this member in, every workspace
specifier any `vi.mock` call site in this tree names reads 660 judged, 660
inheriting, 0 frozen. The two specifiers still outside the list already read
all-inheriting, so their slices are membership flips rather than sweeps.
Part of objectui#6892 (slice 14).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
22 test files under a published package changed, so check-changeset-presence demands a declaration. It is test-only, hence the empty frontmatter. Part of objectui#6892 (slice 14). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
|
ACCEPT —
|
| number | what it counts | why |
|---|---|---|
| 22 | distinct files — the card's own recipe | unreachable as a site count: AppManagementPage.mutations.test.tsx carries two sites (vi.mock at :89, vi.doMock at :280) |
| 23 | call sites per scan() |
what this PR converted, one for one |
| 24 | vi.mock+vi.doMock occurrences, unmasked regex |
the extra one is the block comment above |
The census moved exactly as far as the diff, and no further
625 judged / 625 inherit / 0 frozen; 35 other workspace → 648 / 648 / 0; 12 other workspace. Covered rose by 23, other-workspace fell by 23, and 648 + 12 = 660 both before and after ⇒ no site moved the other way and nothing joined the judged population except these. @object-ui/app-shell went 23 frozen → 0. COVERED_SPECIFIERS is 19 and the header's count was updated with it.
⭐ The one site that could have gone wrong, and the reason it did not
FormPage.predicateScope.test.tsx is the file #6580 removed importOriginal() from, because the barrel load cost 10204 ms of hop1SessionPrincipal's 15000 ms budget. This slice puts it back. That is the highest-risk edit in the PR and it is safe for a reason the file's own comment already contained: the module-scope import { InternalFormRoute } above is the first VALUE request for the specifier, so the factory — and the barrel load inside it — runs during the IMPORT phase, which no timeout bounds. #8173 measured it: hop1SessionPrincipal 9 ms → 8 ms.
⭐ The dev appended eight lines to that comment rather than leaving it asserting the opposite of the code beside it, and declared the addition as its one non-factory edit. Nothing was removed from it. Checked in the diff: the factory now spreads importOriginal() first, with the pre-existing vi.importActual submodule spreads after it, so every current override still wins.
Assertions
23 removed lines, every one a factory line — 15 plain multi-line vi.mock, 3 single-line, 2 async arrows returning an object literal, 2 with block bodies, 1 vi.doMock. The vi.doMock at :280 is named in the PR body as the odd site, as the dispatch required: it runs inside a test after vi.resetModules(), so its obtain sits in a bounded window rather than the import phase — measured harmless at 459 → 660 ms against a 5000 ms budget.
⭐ The ablation near-miss is the most valuable line in the report
The first ablation used perl -0pi -e, silently matched nothing, and exited 0 — leaving the file byte-identical to HEAD. It was caught only because the harness compares on-disk marker counts and blob hashes before reading any result, and it was reported rather than quietly retried. A green from an ablation that never mutated anything is the exact "clean number bought by not looking" failure this lane has now hit three times today in different disguises. The redone leg mutates by exact-string replacement with an asserted anchor count (marker 4 → 3, frozen-form 0 → 1, blob 673e5690… → cef53498…), the gate then exits 1 naming ApprovalsInboxPage.cellIdentity.test.tsx:123, and the restore is proven by observation (git diff HEAD empty, hash back to 673e5690…), not by an exit code.
Verification reproduces #8173's figures exactly — 22 files / 150 tests, and the console project at 89 files / 1069 tests — which is itself a cross-check between two independent runs a day apart. The changeset check was run, not guessed: it exited 1 first and demanded the declaration. One NOT-MEASURED datum is recorded rather than reported as a pass: type-check before the dependency build exits 2 with a wall of TS2307, which is the missing-dist class and not a red typecheck.
⭐ What this changes about the worklist, and it is more than one slice
The dev measured the tail rather than assuming it: @object-ui/plugin-view reads 10 judged / 10 inheriting / 0 frozen, and @object-ui/core reads 2 / 2 / 0. ⇒ Slices 15 and 16 are pure membership flips of COVERED_SPECIFIERS with no test edits at all — this slice was the last one carrying frozen sites, and the tree-wide figure across all 21 specifiers any vi.mock names is now 660 judged, 660 inherit, 0 frozen. ⛔ Correctly not folded in: the dispatch forbade it and one-specifier-per-slice keeps a regression bisectable. But the card's remaining shape is now two cheap flips, not two sweeps, and that goes on the card at release.
Not governed surface (--test on all 24 paths ⇒ NOT GOVERNED). PR stays draft; the flip is this seat's read.
Next: CI convergence → flip ready → post-flip guard → auto-merge SQUASH → queue confirmation → landing probe ('@object-ui/app-shell' present in COVERED_SPECIFIERS on re-fetched origin/main; control: the gate's own CI run on merged main prints 648 judged, 648 inherit, 0 frozen, 12 other workspace — a census that did not move would mean the member was added without the sweep) → LANDED here and on #6892, which stays open and is RELEASED back to pm:queue with its assignee cleared, per Refs #6892 (slice 14).
Generated by Claude Code
|
Armed: PR #8407 flipped ready at 2026-09-07T18:30:06Z on head Landing probe on merge, on re-fetched Then LANDED here and on #6892, which stays open and is RELEASED back to Generated by Claude Code |
|
LANDED — merged into Content probe on re-fetched Control — read from the gate RUNNING on merged main, ⛔ not from a source grep. The post-merge push run (34152980787, head ⇒ 648 judged / 648 inherit / 0 frozen / 12 other workspace, exactly the figure the Armed note named in advance. ⭐ Why that is the right control for a sweep slice rather than a formality: a member added to ⭐ This was the last specifier in the tree carrying frozen sites. Across all 21 workspace specifiers any Generated by Claude Code |
Refs #6892 (slice 14)
Converts every frozen
vi.mock/vi.doMockfactory naming@object-ui/app-shellto the inheriting form used by slices 1 to 13, and adds the specifier to
COVERED_SPECIFIERSinscripts/check-vi-mock-inherit.mjsin the same PR.@object-ui/app-shellwas the LAST specifier in this tree carrying frozen sites.FIRST: the count. Three numbers were in circulation; here is the reconciliation
The number this PR converted is 23, and it is the one the gate's own exported
scan()reports. Command, run atfff250ff1:AppManagementPage.mutations.test.tsxcarries TWO sites, so a file count can never reach 23scan()— what this PR convertsvi.mock+vi.doMockOCCURRENCES from an unmasked regexFormPage.predicateScope.test.tsx:76and it is inside a block commentThe dispatch's hypothesis was that the 24th was a code SAMPLE inside a string
literal. That is falsified. It is a comment, and the difference is not
cosmetic:
scanSource()blanks comments BEFORECALL_REruns, so a commentedoccurrence never becomes a call site at all and is counted in no bucket. The
gate's
embeddedcounter reads 3 tree-wide and every one of those three namessomething else — two
@object-ui/reactsamples inside the gate's own header, one./depin an eslint-rule test. Measured directly against the mask:comment[offset] = 1,literal[offset] = 0.Before / after census
node scripts/check-vi-mock-inherit.mjs, exit 0 in both states:fff250ff1(base)0d163da2a)The covered count rose by exactly 23 and
other workspacefell by exactly 23, sono site moved the other way and nothing else joined the judged population.
Name the odd site
Twenty-two of the 23 are module-scope
vi.mockcalls whose factory runs during theimport phase, which no timeout bounds.
The twenty-third —
apps/console/src/pages/system/__tests__/AppManagementPage.mutations.test.tsx:280— is a
vi.doMockinside a test body, aftervi.resetModules(). Its obtaintherefore sits in a bounded window, which is exactly the shape AGENTS.md's
测试纪律 section warns about. It was measured before conversion rather than argued
about (objectui#8173): that test went 459 ms to 660 ms against a 5000 ms
testTimeout, whilehop1SessionPrincipal— the 15000 ms window objectui#6580was fighting — went 9 ms to 8 ms. Harmless, but shaped differently from the
other 22, and the next reader should not have to rediscover that.
The measured cost, carried forward so nobody re-derives it
objectui#8173 spent 11 vitest arms establishing this. Summary, so this PR is
self-contained:
10 s per file, times 22 files, equals 220 sextrapolation from objectui#6580. It does not survive.
one-time transform of the app-shell graph per vitest process, not a per-file
cost — and about 67 of the console project's 89 test files already load the real
barrel, so a realistic shard has already paid it before the first converted file
is transformed.
files land in one shard with no non-mocking console file beside them.
project at 1069/1069.
No maintainer ruling is owed and none was sought.
What is left after this slice
With this member in, running the classifier over every workspace specifier any
vi.mockcall site in this tree names — 21 of them — reads 660 judged, 660inheriting, 0 frozen. Two specifiers are still outside
COVERED_SPECIFIERS:@object-ui/plugin-view(10 sites) and@object-ui/core(2). Both already readall-inheriting when judged (10/10 and 2/2), so their slices are membership flips
rather than sweeps. They are deliberately NOT folded in here — one specifier per
slice is this worklist's convention through thirteen landings, and it is what keeps
a regression bisectable.
No assertion was edited or deleted
Every one of the 23 removed lines in this diff is a factory line:
One purely additive exception, declared rather than buried:
FormPage.predicateScope.test.tsxgains a paragraph inside an existing block comment. That comment documents the
module-scope import objectui#6580 added and states, as a load-bearing claim, that
"objectui#6580 took the barrel out of the factory". This PR puts the barrel back
in, so leaving the paragraph untouched would leave a comment asserting the opposite
of the code beside it. Nothing was removed from it; eight lines were appended.
Neighbour reading — zero repairs owed
Across the 22 files, all 28 workspace neighbours already inherit (16
@object-ui/auth, 11@object-ui/i18n, one@object-ui/plugin-markdown), and theonly third-party factory is
sonner(7 sites). The frozenlucide-reactneighbourthat killed 15 files in slice 6 cannot exist here — no file among the 22 mocks
it. The remaining 61 neighbours are local whole-module replacements, out of scope by
construction.
Verification
Heavy runs went through the shared verify lock; every verdict below is the line the
tool printed, not a bare shell status.
pnpm exec vitest runover the 22 converted filesTest Files 22 passed (22)/Tests 150 passed (150)— lockVERDICT command-exit 0pnpm exec vitest run apps/console/Test Files 89 passed (89)/Tests 1069 passed (1069)— lockVERDICT command-exit 0pnpm exec vitest run scripts/__tests__/check-vi-mock-inherit.test.ts …specifiers… …js-comment-mask-jsx-6891…Test Files 3 passed (3)/Tests 146 passed (146)node scripts/check-vi-mock-inherit.mjs648 judged (648 inherit),12 other workspacenode scripts/check-vi-mock-specifiers.mjsnode scripts/check-changeset-presence.mjsnode scripts/check-changeset-no-major.mjspnpm --filter @object-ui/console run type-checkturbo run build --filter '@object-ui/console^...'; without the dependency closure built it is TS2307-noise, i.e. NOT MEASURED, not red)turbo run lint --filter @object-ui/console0 errors, 210 warnings, all pre-existingeslint . --no-inline-config --format json(whole tree, no narrowing)no-explicit-anyon lines this PR did not writeReverse verification (ablation)
Run from the committed tree, with a trap-restore on absolute paths, and proven on
disk rather than by an exit code. Reverting one converted factory
(
ApprovalsInboxPage.cellIdentity.test.tsx) to the frozen form:Worth recording: the first attempt at this ablation used a
perl -0pi -esubstitution that silently matched nothing. It exited 0 and the file was
byte-identical to
HEAD; only the on-disk marker count and the hash comparisoncaught it. Had the run been read off the exit code, this PR would have reported a
green gate as evidence that the gate can fail.
Changeset
.changeset/vi-mock-inherit-slice14-app-shell.md, empty frontmatter — 22 test filesunder a published package changed, and the change releases nothing.
check-changeset-presencewas run rather than guessed at.Scope fences honoured
isCovered,coveredPrefixes),operandDenotesand theverdict line are untouched — PR fix(test-infra): judge a subpath of a swept package in check-vi-mock-inherit #8391 and PR fix(test-infra): require the spread operand to BE the obtained module #8406 are settled.
@object-ui/app-shellbarrel is untouched, including its 13 bareside-effect imports.
distalias, no named exclusion.@object-ui/plugin-viewand@object-ui/coreare not folded in..claude/,docs/adr/,skills/,AGENTS.md,CLAUDE.md) andcontent/docs/releases/are untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
Generated by Claude Code