This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
test(app-shell): deepen the three placeholder-branch DOM-leak fixtures - #5787
Merged
Merged
Conversation
…s (objectui#5630) `element:definition-list`, `element:repeater` and `element:metadata_viewer` were swept by the DOM-leak gate only through their empty-state placeholder branch, so their clean reading never covered the element each renderer actually spreads onto once it has real content (objectui#5630, filed against the widening in #5629/#5574). Deepens each fixture past the placeholder: - `element:definition-list`: authors `items` (pure schema, no host needed). - `element:repeater`: adds a per-target `AdapterCtx.Provider` fixture whose `find()` returns a row. Measured, not assumed: `useAdapter()` reads `AdapterCtx`, a channel `SchemaRendererProvider`'s `dataSource` prop (`FAKE_ADAPTER`) never populates — so the issue's own description of the mechanism ("FAKE_ADAPTER answers with no rows by design") undersold it; the renderer's effect short-circuits on `!adapter` before ever calling `.find()` on ANY fixture, and widening what `FAKE_ADAPTER` returns would have changed nothing. - `element:metadata_viewer`: adds a per-target `MetadataCtx.Provider` fixture resolving a `permission` metadata item, the third and independent data channel this family uses (`useMetadataItem()`). `FAKE_ADAPTER`'s empty answer stays exactly as load-bearing for the other 155 targets as before — both new hosts are additive and scoped to one target each. All three read CLEAN in the populated branch, same as the placeholder branch — traced, not just measured: neither `basic/data-list.tsx` nor `basic/metadata-viewer.tsx` spreads `{...props}` (or any rest of the props `SchemaRenderer` hands these components) onto a DOM element anywhere in either file, in any branch. Reverse-verified per target: a deliberately planted leak on each now-reachable populated-branch element failed the gate under the deepened fixture (confirmed via `git diff --stat` before revert) and was reverted without being committed — proving the instrument, not just predicting it. `READY_OVERRIDE_REASONS` shrinks from six entries to four, by TWO rather than the three predicted at dispatch time. `element:definition-list` and `element:repeater` drop their entries entirely: their populated `<dl>`/`<ul>` both fold `schema?.className` into their own `cn(...)`, so the shared readiness class reaches the DOM once there is real content, same as any plain target. `element:metadata_viewer` does NOT drop out — measured against that expectation, not assumed: its `Shell` wrapper's className is hardcoded in every branch (`ViewerProps` declares no `className` field at all), so no fixture depth changes that. Its entry is rewritten to name the real render instead of the not-found placeholder, not deleted. Test-only change — no renderer source touched, no published behaviour changes (empty-frontmatter changeset). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EuPCi56cnGyykygi3z9w4m
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
|
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.
Fixes #5630
What changed
element:definition-list,element:repeaterandelement:metadata_viewerwere swept bypackages/app-shell/src/__tests__/widget-dom-leak-sweep.test.tsxonly through their empty-state placeholder branch — the element each renderer spreads onto once it has real content was never reached, so their clean reading covered a branch that never spreads. This PR deepens all three fixtures past the placeholder, per triage's shape:element:definition-list— authorsitems(pure schema, no host needed).element:repeater— adds a per-targetAdapterCtx.Providerfixture (REPEATER_FAKE_ADAPTER) whosefind()returns a row.element:metadata_viewer— adds a per-targetMetadataCtx.Providerfixture (METADATA_HOST_CONTEXT) resolving apermissionmetadata item.FAKE_ADAPTER's empty answer stays exactly as load-bearing for the other 155 targets as before — both new hosts are additive and scoped to the one target that declares them.A premise correction, measured rather than assumed
The issue describes
element:repeater's mechanism as "the sweep'sFAKE_ADAPTERanswers with no rows by design." That undersold it.RepeaterRendererreads data throughuseAdapter()→AdapterCtx— a separate context fromSchemaRendererProvider'sdataSourceprop, whichFAKE_ADAPTERpopulates.AdapterCtxis never wired anywhere in this sweep, souseAdapter()always returnednull, and the renderer's effect short-circuits on!adapterbefore ever calling.find()— on any fixture. Widening whatFAKE_ADAPTERreturns would have changed nothing; the fix needed a new, additiveAdapterCtx.Providerhost instead. (Traced in source, then confirmed the hard way: an early attempt at authoringitems/objectdirectly on the schema top level did nothing either, for an unrelated reason below.)All three renderers read CLEAN — traced, not just measured
Neither
basic/data-list.tsxnorbasic/metadata-viewer.tsxspreads{...props}(or any rest of the propsSchemaRendererhands these components) onto a DOM element anywhere in either file, in any branch — every host element is hand-built from named fields only. So the canary families this sweep plants have no path to the DOM in any branch of these three renderers, regardless of fixture depth.Reverse-verified per target, not just traced: a deliberate leak (
zzinjectedleak="…") was planted on each now-reachable populated-branch host element (<dl>,<ul>, theShellwrapper<div>), confirmed present on disk (grep -c), and the sweep run again:Exactly the three deepened targets failed, nothing else regressed — proving the instrument catches a real leak on the branch this PR newly reaches, which the old placeholder-only fixture structurally could not (the injected line lives after the early-return the empty-state branch takes). The mutation was never committed — reverted via
git checkout -- <path>(both files were otherwise clean) before the real fix was built on top.READY_OVERRIDE_REASONS: shrinks by two, not threeTriage's dispatch predicted the list would shrink by exactly three (and flagged it explicitly as a prediction to verify, not assume). Measured: it shrinks from six entries to four.
element:definition-listandelement:repeaterdrop their entries entirely — their populated<dl>/<ul>both foldschema?.classNameinto their owncn(...), so once there's real content the shared readiness class reaches the DOM the same as any plain target, and the defaultCOMPONENTS_READYselector matches.element:metadata_viewerdoes not drop out.ElementMetadataViewerRenderer'sShellwrapper hardcodes its className in every branch —ViewerPropsdeclares noclassNamefield at all — so no amount of fixture depth changes that; it's a fact about the renderer, out of this test-fixtures-only card's scope. Its entry is rewritten, not deleted, to name the real populated render instead of the not-found placeholder.Testing
Repo convention:
pnpm exec vitest run <path>from repo root (neverpnpm --filter, perscripts/vitest-invocation-guard.mjs).pnpm --filter @object-ui/app-shell type-check— clean (tsc --noEmit && tsc -p tsconfig.test.json), after building the package's full dependency closure (pnpm --workspace-concurrency=4 --filter '@object-ui/app-shell^...' build, 29 packages, all succeeded) sincetsconfig.test.jsondeliberately resolves@object-ui/*through built.d.ts.pnpm exec eslint packages/app-shell/src/__tests__/widget-dom-leak-sweep.test.tsx --no-inline-config— clean.node scripts/check-control-bytes.mjs— clean.node scripts/check-changeset-presence.mjs/check-changeset-no-major.mjs— clean (empty-frontmatter changeset added; test-only, no release).All at
94d9cb4df(this PR's current head).Scope
Test fixtures only — no renderer source touched (
basic/data-list.tsx,basic/metadata-viewer.tsxare byte-identical tomain), noLEAK_LEDGERrows added (none of the three leak in the populated branch either).Fence note honored: no files under
packages/app-shell/src/views/metadata-admin/**touched.Generated by Claude Code
Generated by Claude Code