Repository navigation
test(vi-mock): inherit the real @object-ui/components surface in 27 vi.mock factories - #8143
Conversation
…nents vi.mock factories to the inheriting form Slice 6 of the per-specifier vi.mock worklist. All 27 frozen `@object-ui/components` factories now obtain the real module through `importOriginal` and spread it FIRST, and the specifier joins `COVERED_SPECIFIERS` in `scripts/check-vi-mock-inherit.mjs` in the same change, as the gate's documented widening precondition requires. Inheriting the real barrel made 15 of the 27 files die during COLLECTION on one cause: the barrel reaches `notifications/severity.ts`, which reads four icons from `lucide-react` at module scope, and those files carried their own frozen `lucide-react` factory that never listed them. Repaired in the neighbouring FACTORY, never in product source. Part of #6892 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
…ubled barrel forced The two DeclaredActionsBar suites reached `hasDeclaredVisibilityGate` through `../../../../components/src/renderers/action/visibility-gate` because their `@object-ui/components` factory hand-listed its exports and could not supply it. With the barrel inherited, the real re-export arrives on its own, so the deep path and the paragraph justifying it are both stale; the prose is rewritten rather than left describing a doubled barrel that no longer exists. Both suites stay green (50 tests), which is what shows the re-export is the same function the deep import used to fetch. Part of #6892 Co-Authored-By: Claude Fable 5.1 <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
|
|
Standing down on
Every other check on Generated by Claude Code |
|
Armed — squash auto-merge enabled and the PR is in the merge queue,
On MERGED: content probe on re-fetched Generated by Claude Code |
|
LANDED — merged at 2026-09-06T19:55:39Z as Content probe on re-fetched
#6892 stays open ( Generated by Claude Code |
Part of #6892 — slice 6 of the per-specifier
vi.mocksweep worklist:@object-ui/components.All 27 frozen
@object-ui/componentsfactories now obtain the real module throughimportOriginaland SPREAD it first, and the specifier joinsCOVERED_SPECIFIERSinscripts/check-vi-mock-inherit.mjsin the same change — the gate's documented widening precondition, never a judgement.Base (merge-base)
336a9eb8a. Head214d5d5a6, after mergingorigin/mainmid-slice. Every figure below is pinned to that head unless it says otherwise.STEP 0 — the barrel walk, and why the slice proceeded
packages/components/srcis the largest barrel this worklist has met: 205 modules and 1173 module-scope statements reached fromindex.ts. It is NOT inert, and it was never expected to be — objectui#7837 had already counted the registrations. What decided the slice is the CLASS of the effect, measured three independent ways.Statically. 112 module-scope
ComponentRegistry.register(...)call sites, and every one of them passes a namespace (ui85,element10,page7,action5, plus the loop-drivenprotocol-placeholdermarks; the five inlayout/page.tsxthat look bare carrynamespace: 'ui'through the spreadpageMeta).register()itself was READ, not assumed —packages/core/src/registry/Registry.ts:433is aMap.setinto an in-memory registry, aconsole.warnon the un-namespaced spelling that therefore cannot fire, a bare-name collision guard, and anotify()over a listenerSetthat is empty at import time. Beyond registration there is exactly one non-allocation statement in the whole graph:hooks/related-count-store.tscallssubscribeDataChanges, whichpackages/react/src/data-invalidation.tsimplements as aSet.addinto a module-level listener set — no timer, no window listener, no request.By grep, column-anchored, over all 205 reached modules. The timers / globals / storage / network / DOM pattern matches nothing (grep exit 1). The IDENT-dot-method pattern (
register/init/configure/addEventListener/subscribe/on/start/connect/listen) returns theComponentRegistry.registerlines and nothing else.Empirically. Importing the real barrel in the happy-dom environment moves the registry from 0 to 295 keys over 159
register()calls, exports 351 names, and emits ZEROconsole.warnand ZEROconsole.error. (159 exceeds the 112 static sites because three module-scope loops register per element — the seven semantic tags, the raw HTML tags, and the four palette placeholder blocks.)The consuming side, which is the failure class the ruling names. Of the 27 converted files, none names
ComponentRegistryat all — so nothing asserts registry emptiness, a registration count, or aget()of a key the barrel now claims. Sixconsole.warnspies exist across four of them; all six are installed insideit(...)bodies (after import, so a collection-time registration is invisible to them) AND filter their calls by message content. No assertion in the swept set can observe a registration.The CSS question (A3). The barrel has exactly one side-effect import and it is CSS —
./sidebar-fixes.css, plain CSS by construction; the barrel's own comment explains at length why the Tailwind entry is deliberately NOT imported there. The root Vitest config declares nocssoption, so CSS is not processed and the import is inert under happy-dom. That is corroborated rather than argued: 20 sites on this specifier already inherited the real barrel onmainand passed, 8 of them inpackages/app-shellunder the LIGHTdomproject. That is the free confirmation slice 4 did not have.Verdict: PROCEED, on the benign class slices 2 and 5 absorbed.
STEP 1 — the census, re-derived, never inherited
Derived through the gate's exported
scan()withcoveredset to all 22 workspace specifiers anyvi.mockcall site in the tree names.COVERED_SPECIFIERSwas never widened-and-reverted in the tree.@object-ui/componentsbefore@object-ui/componentsafterAll-specifier population over the same 22 specifiers: 150 frozen before, 123 after, over 659 judged, 0 unreadable. A diff of the two per-specifier tables with the components row removed is empty — every other one of the 21 rows byte-identical, zero sites moved the other way. Identical on the merged head.
The gate's own verdict line at
214d5d5a6:486 judged over eleven covered specifiers, up from 439 over ten.
The dispatch's grep upper bound was exact in total (47 files naming the specifier) and the frozen subset distributes 24
packages/app-shell/ 2packages/plugin-detail/ 1packages/plugin-timeline— the remaining 20 were the already-inheriting sites, 12 of them inpackages/plugin-form.The three syntactic shapes
async (importOriginal)and the awaited spread is the first property.return— 6 sites. The factory awaits intoactualon its first line and the returned object spreads it first, so hand-written helpers defined in the body still close over what they need.async, and still frozen — 5 sites. These awaited something OTHER than the module under mock (React, or one deep-relative source module) and returned a hand-listed object. This is precisely the shape a name-matching gate waves through and the semantic recogniser does not; all five now awaitimportOriginalas well.In every shape the real module is spread FIRST and the hand-written overrides come after, so every stub the suite depends on still wins and every other export is the real one.
⭐ What inheriting actually broke, and where it was repaired
This is the first slice where converted files died during COLLECTION, which is the failure this whole worklist describes, observed from the other side. 15 of the 27 died at once, on one cause:
The real barrel reaches
notifications/severity.ts, which reads four icons fromlucide-reactat module scope into aconsttable — and those 15 files carried their own frozenlucide-reactfactory that had never listed them. Product source was not touched: the repair is the neighbouring factory, converted to the same inheriting form (spread the real module first, keep every hand-written icon stub after it). A frozen THIRD-PARTY factory can therefore be the thing that blocks a workspace-specifier sweep, even though this gate never judges one — worth carrying into the remaining slices.One follow-up commit removes something the freeze had forced: both
DeclaredActionsBarsuites reachedhasDeclaredVisibilityGatethrough a deep relative path intopackages/components/src, with a paragraph explaining that the barrel "stays doubled". With the barrel inherited the real re-export arrives on its own, so the path and the paragraph are both gone; the suites stay green at 50 tests, which is what shows it is the same function.Residuals
Zero. No site was left frozen and none was excluded. The one file that documented itself as deliberately doubling the barrel was
DeclaredActionsBar.test.tsx— its stated reason was the lightdomproject's setup cost, not a semantic claim about the barrel not being loaded, and 8 app-shell files in that same project already inherit the barrel today. It was converted, and its prose rewritten rather than left describing a tree that no longer exists.Cost — measured, not absorbed silently (A2)
The
dom/dom-heavyproject split exists precisely to keep this package's graph out of the light project's setup, so a converted file now pulls it through its own imports instead. Per file, twice each, on one app-shell suite:lucide-reactAt the WHOLE-PACKAGE level it does not aggregate, because the module graph is shared within a worker across a run:
packages/app-shellon four disjoint shards totals 792s over 635 files here, against the 961s over 634 files slice 5 measured on the same suite by the same method. So the honest reading is "a converted file costs about half again as much cold, and the package suite does not move" — recorded rather than accepted in silence.Tests
git diff HEADnaming zero paths.packages/app-shell: exit 0 on four disjoint shards whose union is the package — 159 + 159 + 159 + 158 = 635 files, 1570 + 1326 + 1706 + 1506 = 6108 passed plus 1 skipped. A single invocation exceeds this container's foreground cap; each shard ran in the foreground to completion.packages/plugin-detail+packages/plugin-timeline: exit 0, 158 files / 1508 tests, one invocation.Ablation — three legs, ONE PER SHAPE, each taken from the committed tree, each mutation proven on disk by anchored marker counts BEFORE the result is read, each restore proven by
git hash-objectequalling the HEAD blob AND bygit diff HEADnaming zero paths — never by a checkout exit code:packages/plugin-timeline/src/ObjectTimeline.test.tsx@object-ui/react, whose factory shares the marker — the leg removes both)packages/app-shell/src/hooks/__tests__/sharedInboxFeed.twoSurfaces.test.tsx...actualfrom the returned object (1 to 0)packages/app-shell/src/layout/__tests__/ContextSelectors.scopeKey.test.tsx...actualfrom the returned object (1 to 0)Legs 2 and 3 exercise the gate's "obtaining without SPREADING is still frozen" rule specifically:
importOriginalis still called on the line above. Restored, the gate reads exit 0 each time. No dist preflight is needed — the root Vitest config aliases the specifier topackages/components/srcand the gate is a source-text scanner.Gates
pnpm check:vi-mock-inheritpackages/app-shell(four disjoint shards)packages/plugin-detail+packages/plugin-timelinepnpm check:vi-mock-specifierspnpm type-check:scriptspnpm check:control-bytesgrep -naPcontrol-byte self-scan of all 30 changed paths (grep exit 1, no match)node scripts/check-changeset-presence.mjspnpm changeset:checknode scripts/check-governed-queue-guard.mjs --testtype-checktsc --noEmithalf excludes tests by design and is recorded as covering none of themlint(eslint ., whole package)--format jsonlists 1304 files including all 27 edited ones, 0 messages at severity 2, and 0 messages on any of this branch's 116 added linesLive E2E (informational)is red on every branch today for an upstream reason (objectui#7990 / objectstack#16186), not this change.Out of scope, filed not fixed
objectui#8141 — the gate's covered set is exact-match, so a SUBPATH of an already-swept package is counted and never judged. Measured at this head: 2 such call sites exist (
@object-ui/components/ui/sonner), both already inheriting, so tightening it is free today. Not touched here: changing what the scope resolver accepts is a different decision from sweeping one specifier.Generated by Claude Code