Skip to content

Change prefix-form RRI realms to serve RRI ids#5390

Open
backspace wants to merge 7 commits into
mainfrom
server-endpoint-rris-cs-11458
Open

Change prefix-form RRI realms to serve RRI ids#5390
backspace wants to merge 7 commits into
mainfrom
server-endpoint-rris-cs-11458

Conversation

@backspace

@backspace backspace commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

As seen here:

s 2026-07-03 at 17 14 17@2x

One thing I’m unsure about: does this ETag-related change make sense, for cache-breaking?

Make the realm server the RRI boundary for instance ids: getCard, create/patch
card responses, file-meta documents, and atomic-operation results now unresolve
the served id / links.self / relationship ids from URL to registered-prefix
form (via unresolveResourceInstanceURLs). Unmapped realms have no prefix
mapping, so this is a no-op there (ids stay URL) — the change is scoped to
prefix-mapped realms (base / catalog).

The write handlers derive the on-disk path from the request path / lid (not the
incoming data.id), so accepting a prefix-form id needs no change; only the
responses are canonicalized. Host wire consumers already accept RRI ids
(loadCardDocument passes them through opaquely; isResolvableInstanceId / asURL /
render.ts handle prefix form).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

  1 files  ±    0    1 suites  ±0   8m 34s ⏱️ - 2h 28m 47s
149 tests  - 3 227  147 ✅  - 3 214  2 💤  - 13  0 ❌ ±0 
149 runs   - 3 246  147 ✅  - 3 233  2 💤  - 13  0 ❌ ±0 

Results for commit 161e0b0. ± Comparison against earlier commit 12ca4b7.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   9m 38s ⏱️ +26s
1 674 tests ±0  1 674 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 753 runs  ±0  1 753 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 161e0b0. ± Comparison against earlier commit 12ca4b7.

@backspace backspace force-pushed the server-endpoint-rris-cs-11458 branch 2 times, most recently from 21c2c09 to abac808 Compare July 3, 2026 00:04
@backspace backspace force-pushed the server-endpoint-rris-cs-11458 branch from abac808 to 934330c Compare July 3, 2026 00:23
@backspace backspace marked this pull request as ready for review July 3, 2026 00:52

@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: 934330cd43

ℹ️ 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/realm.ts
Comment thread packages/runtime-common/realm.ts
@backspace backspace changed the title Update server endpoints to accept RRIs Change prefix-form RRI realms to serve RRI ids Jul 3, 2026
@backspace backspace force-pushed the server-endpoint-rris-cs-11458 branch from 0ae6b7c to 934330c Compare July 3, 2026 12:37
backspace and others added 5 commits July 3, 2026 08:42
Serving instance ids in canonical RRI (prefix) form changes the card-JSON
representation for mapped realms, but neither indexed_at nor the realm-info
hash moves on a serialization change — so a client/CDN holding a URL-form body
would send its old ETag and get a 304, keeping stale URL-form ids until the
card is reindexed. Bump CARD_JSON_ETAG_VARIANT ('card' -> 'card-rri') so cached
bodies revalidate and pick up the RRI representation.

Addresses PR review feedback on #5390.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The GET and PATCH ETag-shape assertions hard-coded the ':card' variant; the
serialization-change bump made it ':card-rri'. Update the patterns to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The realm now serves instance ids in canonical RRI (prefix) form, so a
client may reuse a served id as an atomic operation href. The atomic write
path parsed hrefs with new URL(href, realmURL), which treats an RRI href as
a relative path and produces the wrong local path. Resolve registered-prefix
hrefs to a real URL before path math; plain URL / relative hrefs are
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@backspace backspace force-pushed the server-endpoint-rris-cs-11458 branch 2 times, most recently from 06a075b to 12ca4b7 Compare July 3, 2026 20:01
@backspace backspace requested a review from a team July 3, 2026 22:16
@habdelra habdelra requested a review from Copilot July 3, 2026 23:06

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 realm responses so that, when a realm is prefix-mapped in the VirtualNetwork, card+json instance identifiers are served in canonical prefix-form RRI (instead of resolved URL form). It also bumps the Card+JSON ETag “variant” to intentionally invalidate previously cached card bodies after the serialization change.

Changes:

  • Serve data.id, links.self, and relationship instance ids in prefix-form RRI for prefix-mapped realms (no-op for unmapped realms).
  • Accept prefix-form RRI hrefs for /_atomic operations by resolving them to real URLs before computing local paths; return created ids in prefix form.
  • Bump the Card+JSON ETag variant from cardcard-rri and update realm-server tests accordingly; add a host integration test covering the new behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/runtime-common/realm.ts Canonicalizes served instance ids to RRI for mapped realms; resolves prefix-form atomic hrefs; bumps Card+JSON ETag variant.
packages/realm-server/tests/card-endpoints-test.ts Updates ETag assertions to expect the new :card-rri variant.
packages/host/tests/integration/realm-test.gts Adds integration coverage asserting URL-form ids without mapping and RRI-form ids once a mapping is registered.

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

Comment on lines +195 to +200
assert.strictEqual(
rriDoc.data.links.self,
'@test-prefix/dir/empty',
'links.self is served in canonical RRI form too',
);
});
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