Skip to content

Change CardDef.id to be RRI#4845

Merged
backspace merged 6 commits into
mainfrom
carddef-id-rri-cs-11042
May 20, 2026
Merged

Change CardDef.id to be RRI#4845
backspace merged 6 commits into
mainfrom
carddef-id-rri-cs-11042

Conversation

@backspace
Copy link
Copy Markdown
Contributor

@backspace backspace commented May 15, 2026

Another step toward @cardstack/base: changing the id field of CardDef (and FileDef) changes the interfaces of functions that work with ids. In some cases, the rri cast function is no longer needed because both sides now use RRIs.

One thing I’m uncertain about is the actual type definition:

@field id: RealmResourceIdentifier = contains(
  ReadOnlyField,
) as unknown as RealmResourceIdentifier;

Would defining something like this be better so it could be contains(RRIField)?

export class RRIField extends ReadOnlyField {
  static [primitive]: RealmResourceIdentifier;
}

backspace and others added 3 commits May 14, 2026 13:10
…tifier

Brands the live runtime card identifier type and the consumer-side
identifier strings that flow from it. Picks up where CS-10750 stopped:
that ticket branded the wire-shape types (CardResource.id,
ResolvedCodeRef.module); this one brands CardDef.id and the host- and
matrix-side fields and parameters that hold the same values.

Branded:
- CardDef.id, FileDef.id (via explicit field annotation + cast over
  contains(ReadOnlyField))
- setId(), SaveCardFn
- OperatorModeStateService.{openCardIds, getOpenCardIds,
  codePathString, getSummaryForAIBot, makeRemoteIdsList}
- PlaygroundSelection.cardId
- BoxelContext.{openCardIds, previewPanelSelection.cardId}
- extractRelationshipIds() return

Call-site fixes propagate the brand through the host command/component
graph (10 sites) and remove a redundant id: string redeclaration on
three TaskCard interfaces.

Deferred to follow-ups:
- ~42 test-fixture sites still pass raw strings into PlaygroundSelection
  literals
- @field openCardIds = containsMany(StringField) in base/command.gts
  still produces string[] (cast at the open-create-listing-modal
  boundary)
- autoAttachedCardIds is TrackedSet<string> in several components
  (cast at the room.gts boundary)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
With CardDef.id and getOpenCardIds() now branded RealmResourceIdentifier
(prior commit), the explicit rri() casts in search.ts and workspace.gts
are redundant. Removing them is one of the goals called out by the
ticket.

Test fixtures still construct PlaygroundSelection-shaped literals and
card.id assignments with raw strings. Wrap those with rri(...) so the
fixtures satisfy the brand.

Verified clean:
- pnpm --filter @cardstack/host run lint:types
- pnpm --filter @cardstack/runtime-common run lint:types
- pnpm --filter @cardstack/realm-server run lint:types
(all show zero cascade-related errors; remaining noise is pre-existing
TS2307 module-resolution and CssVariableFieldEntry issues unrelated
to this work.)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts:
#	packages/host/tests/integration/components/ask-ai-test.gts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

Preview deployments

Host Test Results

    1 files      1 suites   1h 50m 59s ⏱️
2 712 tests 2 697 ✅ 15 💤 0 ❌
2 731 runs  2 716 ✅ 15 💤 0 ❌

Results for commit a5353d5.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   8m 18s ⏱️ +21s
1 453 tests +3  1 453 ✅ +3  0 💤 ±0  0 ❌ ±0 
1 544 runs  +3  1 544 ✅ +3  0 💤 ±0  0 ❌ ±0 

Results for commit a5353d5. ± Comparison against earlier commit 9e41423.

@backspace backspace marked this pull request as ready for review May 20, 2026 19:32
@backspace backspace requested a review from a team May 20, 2026 20:05
@backspace backspace merged commit 838df0e into main May 20, 2026
102 of 103 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.

2 participants