Skip to content

Change loader to return RRIs for dependencies and identities#5468

Merged
backspace merged 2 commits into
mainfrom
cs-11716-loader-rri-native
Jul 17, 2026
Merged

Change loader to return RRIs for dependencies and identities#5468
backspace merged 2 commits into
mainfrom
cs-11716-loader-rri-native

Conversation

@backspace

@backspace backspace commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

With this, getConsumedModules and getKnownConsumedModules normalise to return prefix RRIs if mappings exist for them.

This doesn’t change the internal keys to RRIs, as that was causing problems in contexts where prefix mappings were added and removed dynamically. While we recently discussed that maybe that dynamicism isn’t worth preserving, it’s currently the case and this PR is a useful step regardless.

…ity APIs

getConsumedModules and getKnownConsumedModules now return module
identifiers in canonical RRI form (realm-prefix spelling where a prefix
mapping is registered), deduping spellings that collapse to one module
and excluding self references under any spelling. identify() already
recorded identities via unresolveURL; it now shares the same
canonicalIdentifier helper.

The runtime dependency tracker keys module nodes by http(s) URL, so the
loader exposes dependencyTrackingKey() for crossing that boundary, and
card-api's relationship module walk uses it. This also fixes prefix-form
identity.module values being silently dropped by the tracker's URL
guard.

Module-cache keys deliberately stay URL-keyed; the moduleCacheKey
comment explains why a realm-prefix-sensitive key would orphan cached
entries and split class identities when mappings change mid-life.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ±  0      1 suites  ±0   3h 7m 46s ⏱️ - 2m 54s
3 547 tests +176  3 532 ✅ +177  15 💤 ±0  0 ❌ ±0 
3 566 runs  +176  3 551 ✅ +178  15 💤 ±0  0 ❌  - 1 

Results for commit 6ff6b44. ± Comparison against earlier commit 4c25bf9.

Realm Server Test Results

    1 files  ± 0      1 suites  ±0   16m 53s ⏱️ + 5m 47s
1 875 tests +61  1 875 ✅ +61  0 💤 ±0  0 ❌ ±0 
1 954 runs  +61  1 954 ✅ +61  0 💤 ±0  0 ❌ ±0 

Results for commit 6ff6b44. ± Comparison against earlier commit 4c25bf9.

@backspace backspace changed the title Change loader to use RRIs internally Change loader to return RRIs for dependencies and identities Jul 15, 2026
@backspace
backspace marked this pull request as ready for review July 16, 2026 18:58

@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: 4c25bf9189

ℹ️ 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/loader.ts
@backspace
backspace requested a review from a team July 16, 2026 20:53
@habdelra
habdelra requested a review from Copilot July 16, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the runtime Loader API surface so module dependency lists and identities are emitted in a canonical identifier form: prefer realm-prefix RRIs (e.g. @cardstack/base/card-api) when a matching VirtualNetwork realm mapping exists, otherwise fall back to URL-form identifiers. It also introduces an explicit boundary helper for converting canonical RRIs back into URL-form dependency-tracker keys.

Changes:

  • Normalize getConsumedModules() and getKnownConsumedModules() to return canonical identifiers (RRI prefix form where mapped).
  • Record identify() module identities in the same canonical identifier form.
  • Update runtime relationship dependency tracking to convert canonical identifiers to URL-form tracker keys via the loader.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/runtime-common/loader.ts Canonicalizes outward-facing module identifiers to RRIs (when mapped) and adds a dependency-tracker boundary helper.
packages/host/tests/unit/loader-test.ts Updates and expands coverage to assert canonical prefix-form output from getConsumedModules() when a realm mapping exists.
packages/base/card-api.gts Converts loader-derived canonical identifiers into dependency-tracker keys at the tracking boundary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@backspace
backspace merged commit 4c973fa into main Jul 17, 2026
71 of 73 checks passed
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.

3 participants