Skip to content

Move runtime-dependency-tracker tests to the host browser suite - #5926

Open
habdelra wants to merge 1 commit into
mainfrom
claude/cs-12649-sqmj21
Open

Move runtime-dependency-tracker tests to the host browser suite#5926
habdelra wants to merge 1 commit into
mainfrom
claude/cs-12649-sqmj21

Conversation

@habdelra

Copy link
Copy Markdown
Contributor

What

runtime-dependency-tracker-test.ts moves from the realm-server node suite to
the 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 component
  • packages/base — the card API, card serialization, query-field support
  • packages/runtime-common/loader.ts — the Loader's import-time module-graph walk, which is what feeds the tracker its module deps

Nothing constructs a Loader under node, and packages/realm-server does not
import it at all. Three of the suite's tests build a real Loader and drive the
tracker through loader.import(), so under node they exercised a runtime that
ships 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, so
they 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 afterEach
cleanup 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 Loader is constructed outside a browser suite anywhere in the repo —
new Loader( appears only under packages/host/ and in
runtime-common/loader.ts itself.

The host shard packer gives a test file absent from
tests/test-module-timings.json the median known weight, so the moved file runs
on exactly one shard without the timings file needing regeneration.

Test plan

  • The moved suite runs green in the host browser suite: 21 passed, 0 failed
    (ember test --path dist --filter="Unit | runtime dependency tracker",
    headless Chrome 141), including all three loader tests.
  • Test inventory diffed before and after the move: identical, 21 names and
    64 assertions.
  • packages/host: pnpm lint:types and pnpm lint:js clean.
  • packages/realm-server: pnpm lint:js clean. lint:types reports only
    pre-existing unresolved @cardstack/boxel-icons / boxel-ui paths under
    packages/base, none in files this touches.
  • packages/realm-server/tests/index.ts requires each entry as
    require(file + '.ts'), so a stale entry throws at load: all 185 remaining
    entries 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

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
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   2h 21m 24s ⏱️
4 616 tests 4 602 ✅ 14 💤 0 ❌
4 631 runs  4 617 ✅ 14 💤 0 ❌

Results for commit 0846095.

Realm Server Test Results

    1 files      1 suites   22m 59s ⏱️
2 330 tests 2 330 ✅ 0 💤 0 ❌
2 413 runs  2 413 ✅ 0 💤 0 ❌

Results for commit 0846095.

@habdelra
habdelra requested a review from a team August 28, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant