Move runtime-dependency-tracker tests to the host browser suite - #5926
Open
habdelra wants to merge 1 commit into
Open
Move runtime-dependency-tracker tests to the host browser suite#5926habdelra wants to merge 1 commit into
habdelra wants to merge 1 commit into
Conversation
The runtime dependency tracker's entire production caller set runs in a browser tab: the host app's render route, store, and search resources, packages/base's card API and serialization, and the Loader whose import-time module-graph walk feeds the tracker its module deps. No node code constructs a Loader — packages/realm-server does not import it at all — so a tracker suite under node drove a runtime that ships nothing. Three of the 21 tests built a real Loader to drive the tracker through loader.import(). Those would have stayed green while the browser-side behavior they stand for diverged, and they made the Loader read as node-supported to anyone scanning the test tree. The remaining tests drive the tracker's session and snapshot API directly and are environment-agnostic (the context stack is a plain synchronous stack, not AsyncLocalStorage), so the whole file moves rather than splitting: the subject under test is browser-side in full. Test inventory is unchanged — the same 21 tests and 64 assertions, including the guards for transitive runtime dependency capture during prerendering and for the canonical-RRI form the tracker records. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X124uTcZNdxDxbRZfNEu1p
Contributor
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
runtime-dependency-tracker-test.tsmoves from the realm-server node suite tothe host browser suite (
packages/host/tests/unit/).Why this shape
Every production caller of the runtime dependency tracker runs in a browser tab:
packages/host/app— the render route and its meta route, the store, the search resource, the GC card store, the file-extract runner, the render service, the card-prerender componentpackages/base— the card API, card serialization, query-field supportpackages/runtime-common/loader.ts— theLoader's import-time module-graph walk, which is what feeds the tracker its module depsNothing constructs a
Loaderunder node, andpackages/realm-serverdoes notimport it at all. Three of the suite's tests build a real
Loaderand drive thetracker through
loader.import(), so under node they exercised a runtime thatships nothing: they would stay green while the browser-side behavior they stand
in for diverged. They also made the loader read as node-supported to anyone
scanning the test tree.
The whole file moves rather than splitting. The other 18 tests drive the
tracker's session, context, and snapshot API directly, and the tracker's context
propagation is a plain synchronous stack rather than
AsyncLocalStorage, sothey are environment-agnostic and belong beside their subject — which is
browser-side in full.
Only the file header changed: the qunit import and the module name (from a
node
basename(import.meta.filename)to'Unit | runtime dependency tracker'),plus comments stating why the suite is browser-side and why the
afterEachcleanup is load-bearing. All 910 lines of test bodies are byte-identical.
Coverage
Test inventory is unchanged: the same 21 tests and 64 assertions, name for name.
That includes the guards for transitive runtime dependency capture during
prerendering and for the canonical-RRI form the tracker records.
No
Loaderis constructed outside a browser suite anywhere in the repo —new Loader(appears only underpackages/host/and inruntime-common/loader.tsitself.The host shard packer gives a test file absent from
tests/test-module-timings.jsonthe median known weight, so the moved file runson exactly one shard without the timings file needing regeneration.
Test plan
(
ember test --path dist --filter="Unit | runtime dependency tracker",headless Chrome 141), including all three loader tests.
64 assertions.
packages/host:pnpm lint:typesandpnpm lint:jsclean.packages/realm-server:pnpm lint:jsclean.lint:typesreports onlypre-existing unresolved
@cardstack/boxel-icons/boxel-uipaths underpackages/base, none in files this touches.packages/realm-server/tests/index.tsrequires each entry asrequire(file + '.ts'), so a stale entry throws at load: all 185 remainingentries were confirmed to resolve on disk, with no duplicates. The moved file
exported nothing and its only top-level statement was its
module()registration, so no other node test could depend on it. The node suite itself
needs the dockerised test postgres, so it runs in CI rather than here.
Generated by Claude Code