Convert hostHome into hostRoutingMap#4943
Draft
backspace wants to merge 7 commits into
Draft
Conversation
Extends the CS-11150 backfill so that the sidecar's `hostHome` (a string URL) is materialized as a `/`-rooted entry in the realm.json card's `hostRoutingRules`. `interactHome` is dropped from the sidecar unconditionally — `index.json` already covers the interact-mode home case so no card field is needed. Three migration shapes coexist in one pass: - new card created from any sidecar with migratable keys - existing card augmented with a `/`-rule when sidecar has hostHome and the card doesn't already have one (existing rule wins; we log if it points elsewhere) - sidecar always trimmed of every key the card now owns Two correctness fixes while in there: - `hostRoutingRules` from a sidecar is now split into the canonical shape — paths in `attributes.hostRoutingRules[i]`, instance linksTo under `data.relationships["hostRoutingRules.<i>.instance"]` with a relative `./Type/id` link. The previous code copied the field verbatim (instance as a URL string), which would not have produced a valid card. - Published-realm hostHome migration now requires the registry URL. When realm_registry is sparse (multi-instance startup race), we skip just the hostHome step for that realm and log; a future boot completes it. The card-keys-only migration still runs. 17 tests cover the new behavior end to end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Preview deploymentsHost Test Results 1 files ±0 1 suites ±0 1h 30m 23s ⏱️ - 4m 11s Results for commit 8f53ac1. ± Comparison against earlier commit 7b12a0d. Realm Server Test Results 1 files ±0 1 suites ±0 10m 12s ⏱️ -41s Results for commit 8f53ac1. ± Comparison against earlier commit 7b12a0d. |
…CS-10055) These fields no longer have a source-of-truth on disk: - hostHome was migrated to a `/`-rooted hostRoutingRules entry by the backfill in the previous commit - interactHome was already obsolete — index.json is the interact-mode home — and the backfill trims it from sidecars Removes: - `hostHome` / `interactHome` from the RealmInfo type - their defaults in parseRealmInfo - the sidecar overlay reads in parseRealmInfo - matching `hostHome: null` / `interactHome: null` initializers across the host service, runtime-common helpers, the realm-server mock-route helper, and ~70 places in host integration test fixtures Updates the REALM_CONFIG_CARD_PROPERTIES comment in runtime-common/realm.ts to drop the "until CS-10055" framing. Also fixes a latent typing edge in toRelativeInstanceLink to accept a nullable realm URL. setHostHome on the host service and the publish-time hostHome rewrite in handle-publish-realm.ts still write to the sidecar; both are addressed in the next two commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…CS-10055) After CS-10055 the home card is the `/`-rooted entry in `hostRoutingRules`, whose linksTo target lives at `data.relationships["hostRoutingRules.<i>.instance"].links.self` on the realm.json card. Replaces the previous sidecar-based hostHome rewrite with a card-relationship walk: when a published realm's card carries an absolute link still pointing at the source realm, rewrite it to the published realm URL. Relative links (./Type/id) survive copySync and need no rewrite. `rewriteHostHomeForPublishedRealm` is gone — sidecars no longer carry hostHome after the CS-11150 backfill + the previous commits in this chain. The existing publish-rewrite test was rewritten to seed a card with one absolute and one relative routing-rule link and assert that only the absolute one is rewritten. Not run locally: the publish-unpublish suite needs the wait-for-servers harness (Synapse + realm servers). Typecheck is clean and the helper is a pure function; full suite to run via `pnpm test:wait-for-servers` in CI / locally before merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After the backfill + read-path + publish-rewrite changes, no surface still writes hostHome via the sidecar PATCH path. setHostHome (both the per-realm method and the service-level wrapper) is dead code with no remaining callers — removed, along with `'interactHome' | 'hostHome'` from the RealmInfoProperty union. Operators that want to set a host- mode home now PATCH the realm.json card's hostRoutingRules directly. create-realm.ts's hostHome/interactHome comment is updated to drop the "until CS-10055" framing — a fresh realm has neither field; host mode picks them up from the realm.json card once an operator sets routing rules via /_config. patchRealmConfig isn't touched: hostHome / interactHome are no longer in REALM_CONFIG_CARD_PROPERTIES or REALM_CONFIG_METADATA_PROPERTIES, so a PATCH carrying those keys falls through to the sidecar catch-all — same handling as any other unrecognized attribute. That fallthrough will go away with the rest of the sidecar in CS-11131. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two small cleanups now that hostHome / interactHome are gone:
- The realm_metadata migration comment predicted hostHome / interactHome
would land as columns on that table; instead CS-10055 unified hostHome
into the RealmConfig card's hostRoutingRules and removed interactHome
entirely. Comment rewritten so future readers don't go looking for
them in realm_metadata.
- Deleted realm-endpoints-test.ts's "realm-owner can patch multiple
properties including interactHome and hostHome" — both keys no longer
appear on RealmInfo, and the multi-property PATCH behavior it was
actually exercising is already covered by:
* "can clear card-owned URL fields by patching null" (multi-card
PATCH against backgroundURL + iconURL)
* "allows any property except showAsCatalog" (unrecognized keys
still pass through the handler).
Other CS-10055 mentions remaining in the tree are descriptive ("this
is what CS-10055 introduced") rather than "until CS-10055 lands" — left
in place as tracking pointers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
My step-5 comment update to 1777591052962_create-realm-metadata.js was the EARLIEST migration file touched in this PR. CI's migration test auto-computes its rollback depth from that file's position, so the edit forced the test to roll back 13 migrations — which exposed a latent bug in `1779348449320_remove-legacy-catalog-realm-permissions`'s DOWN script (its unconditional INSERT collides with the next-rolled- back canonical-url-https-to-http migration's UPDATE on the realm_user_permissions PK). The bug exists on main but is dormant there — nothing touches that-old a migration. Reverting my comment edit pulls our rollback footprint back to the actual migration files added in this PR (none — we only edited comments + code in non-migration files), and the down-test covers what it covered before. Filed as a separate follow-up so the migration comment can be corrected once the DOWN bug is fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another step toward eliminating
.realm.json.hostHomeis a little-used feature that allows an override to what‘s shown at the root of a realm in host mode; usinghostRoutingMapwith a route for/accomplishes the same thing.This also eliminates
interactHome, which was never used, and which can be synthesised with settingindex.jsonto what you want to show.