Skip to content

Fix catalog remix leaving base-realm module refs unresolvable in the install destination#5478

Draft
richardhjtan wants to merge 4 commits into
mainfrom
fix/catalog-remix-adopts-from-base-realm
Draft

Fix catalog remix leaving base-realm module refs unresolvable in the install destination#5478
richardhjtan wants to merge 4 commits into
mainfrom
fix/catalog-remix-adopts-from-base-realm

Conversation

@richardhjtan

@richardhjtan richardhjtan commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • isInBaseRealm (used by planInstanceInstall/resolveTargetCodeRef to decide whether a module needs to be copied into the install destination) only recognized a base-realm module via its resolved real backing URL (e.g. https://localhost:4201/base/skill, via VirtualNetwork.unresolveURL()). A module still in its literal symbolic https://cardstack.com/base/ form — which is how base refs actually appear in serialized cards/specs, and in a VirtualNetwork with no realm mappings registered — fell through and got wrongly treated as needing to be copied, producing a broken adoptsFrom.module relative to the new install folder instead of the actual base realm module. Now checks both forms.
  • live-test.js already patched resolvedCatalogRealmURL for its own bootstrapping loader, but only on a throwaway spread copy of the config module — not the shared module object every test's own app instance imports via setupApplicationTest. One-line fix: mutate the shared object directly. No production runtime code (network.ts) needs to change at all.

Companion fix in boxel-catalog#652 addresses the actual adoptsFrom rewrite bug this uncovered; both are needed for a catalog remix/install to correctly resolve module references end to end.

Test plan

  • pnpm lint:types clean in packages/runtime-common
  • Unit | Catalog | Install Plan Builder suite (13/13 pass, including the base-realm-literal-URL case flagged by Codex review)
  • Full live test suite against a real catalog realm: 137 tests, 86 pass, 51 skip (unrelated pre-existing skips), 0 fail
  • Verified end-to-end against boxel-catalog#652's own CI (temporarily pinned its checkout to this branch, confirmed both Lint and Live Tests pass, then reverted the pin)

…install destination

planInstanceInstall/resolveTargetCodeRef checked base-realm membership
against the symbolic https://cardstack.com/base/ URL, but a resolved
codeRef.module is the base realm's real backing URL, so a base-realm
instance (e.g. a Skill) was wrongly treated as needing to be copied into
the install destination — producing an adoptsFrom.module relative to the
new install folder instead of the actual base realm module.

Also restores the @cardstack/catalog/ virtual-network mapping for live
test runs specifically (resolvedCatalogRealmURL is nulled for
environment === 'test', which breaks module resolution for content that
imports catalog-realm commands, like the Listing card class).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 214355e4b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/runtime-common/catalog.ts
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ±0      1 suites  ±0   2h 30m 51s ⏱️ - 5m 24s
3 470 tests +1  3 455 ✅ +2  15 💤 ±0  0 ❌ ±0 
3 489 runs  +1  3 474 ✅ +3  15 💤 ±0  0 ❌  - 1 

Results for commit 2ccc65a. ± Comparison against earlier commit b29ceea.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   11m 13s ⏱️ -35s
1 816 tests ±0  1 816 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 895 runs  ±0  1 895 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 2ccc65a. ± Comparison against earlier commit b29ceea.

@richardhjtan richardhjtan marked this pull request as draft July 13, 2026 11:11
richardhjtan and others added 3 commits July 13, 2026 19:24
…ealmURL param

live-test.js already passes the catalog realm's real address into every
live-test browser session via the realmURL query param (used to discover
which realm to load test files from) — no need for a parallel
rawCatalogRealmURL build-time config field duplicating the same
skipCatalog logic. NetworkService now reads realmURL directly, the same
way live-test.js's own config/environment shim already does.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
network.ts already reads config.resolvedCatalogRealmURL normally — the
gap was that live-test.js only patched a spread copy of the config module
for its own bootstrapping loader, never the shared module object that
every test's own app instance (via setupApplicationTest) imports
normally. Mutating that shared object directly means every later-created
app instance sees the real catalog realm address with no production
runtime code touched at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
isInBaseRealm only normalized via VirtualNetwork.unresolveURL(), which
requires a registered realm mapping to recognize a base-realm module —
but a module ref built without one (the existing plan-install unit test
uses a bare VirtualNetwork with no mappings, and this is also how base
refs appear in serialized cards/specs) stays in the literal
https://cardstack.com/base/ form and was wrongly treated as needing to
be copied into the install destination. Check the literal form first,
matching what the RealmPaths-based check did before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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