This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
test(app-shell): inherit the real @object-ui/collaboration surface in 33 vi.mock factories - #8082
Merged
baozhoutao merged 2 commits intoSep 6, 2026
Conversation
… 33 vi.mock factories Slice 4 of the per-specifier vi.mock sweep worklist. All 33 frozen `@object-ui/collaboration` factories now obtain the real module and spread it before their overrides, and the specifier joins COVERED_SPECIFIERS in `scripts/check-vi-mock-inherit.mjs` in the same change -- the gate's documented widening precondition. STEP 0 (the standing import-graph walk) measured `packages/collaboration/src` inert before any conversion: 11 modules reached from index.ts, 11 module-scope initialisers, all pure in-memory allocation, and zero registrations, timers, globals, fetch, storage or WebSocket at module scope. The guard's pin test held a hard-coded 12000-byte header window that this slice's header record pushed the asserted phrase past. It now reads the leading docblock itself, so the next slice's record cannot redden it without touching a word either assertion reads. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
…mock-inherit-slice4-collaboration
Contributor
✅ 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
|
Contributor
|
Standing down on Generated by Claude Code |
baozhoutao
marked this pull request as ready for review
September 6, 2026 15:11
baozhoutao
deleted the
claude/issue-6892-vi-mock-inherit-slice4-collaboration
branch
September 6, 2026 15:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #6892 — slice 4 of the per-specifier
vi.mocksweep worklist:@object-ui/collaboration, the largest row left on it after slice 3.All 33 frozen
@object-ui/collaborationfactories now obtain the real module and spread it before their overrides, and the specifier joinsCOVERED_SPECIFIERSinscripts/check-vi-mock-inherit.mjsin the same PR — the gate's documented widening precondition.STEP 0 — what does inheriting actually RUN?
Converting a freeze to inheritance loads the real barrel in every converted file, so a barrel with module-scope side effects has those effects restored in 33 files at once. Slice 3 made this a standing step rather than an auth special case, and a collaboration package is a priori the most likely one yet to fail it: presence, realtime subscriptions, sockets.
The whole static import graph was walked from
packages/collaboration/src/index.ts(98 lines) and every top-level statement of every reached module classified with the TypeScript parser. 11 modules, and exactly 11 module-scope initialisers, every one of them pure in-memory allocation:useConflictResolution.ts:58conflictCounter— aletat0useConflictResolution.ts:65versionIdCounter— aletat0CommentThread.tsx:152styles— an object literal of class stringsuseCollaborationTranslation.ts:46COLLAB_DEFAULT_TRANSLATIONS— the English defaults mapuseCollaborationTranslation.ts:121useCollaborationTranslation— onecreateSafeTranslation(...)callLiveCursors.tsx:29cursorStyles— an object literalPresenceAvatars.tsx:29sizeMap— an object literalPresenceAvatars.tsx:35statusColors— an object literalPresenceAvatars.tsx:58statusLabelKeys— an object literalPresenceProvider.tsx:44NOOP_SOURCE— an empty object literalPresenceProvider.tsx:46PresenceContext—React.createContext(NOOP_SOURCE)The one module-scope call was read rather than assumed:
createSafeTranslation(packages/i18n/src/useSafeTranslation.ts:19) allocates afallbackTclosure and returns a hook. It registers nothing, touches no global, and starts nothing.And zero of the things that would have stopped this slice: no registrations, no timers, no globals, no
fetch, no storage access, noWebSocketconstruction at module scope, and no side-effect-only imports. Two column-anchored greps back the AST walk, both returning no match (grepexit 1): module-scopewindow/document/globalThis/localStorage/sessionStorage/setTimeout/setInterval/fetch/navigator/WebSocket/EventSource, and module-scopeIDENT.register(/.init(/.configure(/.addEventListener(. Everynew WebSocket(...),setTimeout(...)andwindow.addEventListener(...)in the package is indented inside a hook body — 19 such lines inuseRealtimeSubscription.ts, 7 inusePresence.ts, and the walk attributes none of them to module scope.Transitively the barrel's only RUNTIME workspace import is
@object-ui/i18n(@object-ui/typesis imported type-only everywhere, including the barrel's own re-export block).@object-ui/i18nis already covered by this gate at 92 judged / 92 inheriting, so its real barrel is already loaded in these tests.⇒ Inert. Proceeding.
@object-ui/authcame with a free independent confirmation: 33 of its 135 sites already inherited the real barrel onmain, so the barrel demonstrably loaded in that test environment before anything was converted.@object-ui/collaborationhad ZERO inheriting sites, and a sweep of the whole tree finds no test that loads the real barrel at runtime (its package's own four component tests import relative paths; the fifth is a type-only spec-symbol pin). So there was no pre-existing green site to lean on, and the confirmation here is the suite run itself — weaker evidence, and recorded as such in the gate header so the next slice on a zero-inheriting specifier budgets for it.STEP 1 — the derived table
Re-derived on the merge base
0caacca37with the FIXED classifier, through the guard's exportedscan()withcoveredset to all 22 workspace specifiers the tree names. ⛔ The constant in the tree was never widened-and-reverted, so there was no window in which a mutated constant could have been committed. Nothing was inherited from the card's table or from the dispatch.@object-ui/collaborationAll-specifier population on this PR's own base: 211 → 178 frozen, judged unchanged at 643, 0 unreadable, and every other one of the 21 rows byte-identical between the two runs — zero sites moving the other way.
The dispatch's grep upper bound (33 files, all
packages/app-shell) turned out to be exact this time, distribution included: 33 of 33 underpackages/app-shell/src, none inapps/console.STEP 2 — the conversion
One shape, not three. Unlike
@object-ui/auth, all 33 sites are the multi-line object-literal arrow, so the conversion is uniform:() =plus arrow becomesasync (importOriginal) =plus arrow, and a spread ofawait importOriginal()(generic argument RECORD-OF-STRING-TO-UNKNOWN) becomes the first property of the returned object. Seven distinct override sets across the 33 files, all presence/realtime stand-ins.The span of every factory was delimited with the gate's own masking helpers (
deJsxClosingTagsplusjs-comment-mask), never with a naive regex over raw source, so avi.mockinside a comment or a string could not have been rewritten.No site was a deliberate freeze. Nothing in the 33 was written to prove a module is not loaded, so nothing was converted blindly or reported as an exception. ⛔ No exemption table, ⛔ no per-site opt-out.
No file died during collection. The 33 files report 33 passed / 280 tests both before and after the conversion — the same numbers, measured by restoring the base blobs of exactly those 33 paths under a restore trap and re-running. The failure class this worklist exists for did not fire once.
The pin test had to move, and why raising the number was the wrong repair
scripts/__tests__/check-vi-mock-inherit.test.tsread the gate's header as.slice(0, 12000)and asserted two phrases in it. This slice's header record pushedprecondition for widening is a sweepfrom byte 12512 past that window, reddening the pin without touching a word either assertion reads.Re-raising the constant would only defer the identical failure to slice 5. The window now IS the leading docblock — located by its own delimiters — plus an assertion that the window is still shorter than the whole file, so the two phrase checks cannot silently degrade into "matches anywhere in the source". 69 of 69 cases pass, unchanged in count.
Residuals — none
packages/app-shell/src/views/metadata-admin/inspectors/FlowNodeInspector.specKeys.test.tsx(held for Burn down the 21 known network escapes: serve each probe from a double and emptyKNOWN_ESCAPESin the network-escape guard #7307 batch 6 behind draft PR chore(deps): resolve @objectstack/spec at 17.3.0 in the lockfile #7685) is not a site — it carries no@object-ui/collaborationreference at all, so the named exclusion cost nothing.⇒ collaboration reads 0 frozen on this tree with nothing held back, so the
COVERED_SPECIFIERSline ships in full.Ablation — three legs, from the committed tree
Each leg mutates, proves the mutation reached the disk by counting the anchored text, reads the result, then restores with
git checkout HEAD -- ABSOLUTE_PATHunder atrapon EXIT INT TERM — restore proven bygit hash-objectequalling the HEAD blob and an emptygit diff HEAD, never by agit checkoutexit code.AppHeader.singleMembershipOrg.test.tsxffae1956b,git diff HEADempty, gate exit 0RecordDetailView.feedLoading.test.tsxd4ed32a0b,git diff HEADempty, gate exit 0check-vi-mock-inherit.mjs(the repaired pin)857bd0365,git diff HEADemptyThe first leg is the load-bearing one: that file holds four inheriting factories on different specifiers and the mutation removed exactly one, so the reversal is proven surgical rather than a broad delete. No dist preflight is needed — the root
vitest.config.mtsaliases@object-ui/collaborationtopackages/collaboration/src, and the gate is a source-text scanner.Gates — pinned to head
400db5cfcpnpm check:vi-mock-inheritvitest scripts/__tests__/check-vi-mock-inherit.test.tsvitest packages/app-shell/pnpm check:vi-mock-specifierspnpm type-check:scriptspnpm check:control-bytesgrep -naPcontrol-byte self-scan of all 36 changed paths, no matchnode scripts/check-changeset-presence.mjspnpm changeset:checknode scripts/check-lint-coverage.mjsnode scripts/check-governed-queue-guard.mjs --testtype-check(both programs)--listFilesnames 33 of 33 edited files in a 3951-file programlint(eslint .)--format json, 0 errors; every message intersected against this PR's own 66 added line numbers gives 0 messages on any added lineeslinton the two changedscripts/filesorigin/mainmoved 4 commits during verification and was merged (never rebased). It touched zero files underpackages/app-shell/, proven bygit diffover the whole package path returning empty between the sweep commit and the final head — so the four-shard suite reading transfers exactly. Every other gate above was re-run at400db5cfc, on a dependency closure rebuilt with real per-packagetscruns rather than a turbo replay.pnpm check:node-esm-loadexits 1 here, and it is not this PR's gate — its workflow is nightly plus a path filter onscripts/check-node-esm-load.mjs, which this diff does not touch. Its failure is its own documented shared-turbo-cache refusal (22 of 37 entries were replayed into this worktree from sibling worktreesobjectui-issue-5174-b23andobjectui-issue-7811, and the gate declines to grade artifacts this tree did not produce — objectui#7276, remedy--force-build). It names zero of this PR's 36 paths. The dependency closure was rebuilt afterwards so no type-check reading above sits on those foreign artifacts.Live E2E (informational)is red on every branch today for an upstream reason (#7990 / objectstack#16186) — not this change.One finding carried out of scope, filed separately
Now that the 33 factories inherit, the overrides that remain are visible as a set — and 13 of them stub
useRecordPresenceas an object while the real hook returns an array. Filed as afinding, ⛔ not fixed here (changing a stub's value shape is a behaviour change this slice was not dispatched to make).Next by yield
@object-ui/plugin-form(32 judged / 31 frozen), then@object-ui/components(47 / 27),@object-ui/plugin-grid(24 / 24) and@object-ui/app-shell(23 / 23 — still reads #6580 first, which is CLOSED, so that is now a git-history read). STEP 0 stays standing, and the census stays re-derived on the merge base at conversion time: the population moved under slice 3 twice, andmainmoved 4 commits under this one.Generated by Claude Code