Skip to content

Change more path handlers to support prefix RIs - #5741

Draft
backspace wants to merge 2 commits into
mainfrom
cs-12460-form-agnostic-realm-paths
Draft

Change more path handlers to support prefix RIs#5741
backspace wants to merge 2 commits into
mainfrom
cs-12460-form-agnostic-realm-paths

Conversation

@backspace

Copy link
Copy Markdown
Contributor

These are more places where realm identifiers are assumed to be URLs.

backspace and others added 2 commits August 11, 2026 13:32
`new RealmPaths(new URL(realm))` only works while every realm identifier is
URL-shaped. A prefix-form identifier throws `Failed to construct 'URL': Invalid
URL` at the constructor, so the code cannot tolerate one even where nothing
downstream cares about the form.

Use the RealmIdentifier overload instead. It applies the same
`ensureTrailingSlash` the URL branch does, so with URL-form identifiers the
resulting RealmPaths is identical — this is a no-op today and stops being one
only when identifiers change form.

Where the value then flowed through a method that requires a URL-based
RealmPaths (`fileURL`, `directoryURL`, `local(URL)`), switch to the identifier
counterpart (`fileRRI`, `directoryRRI`, `local(RealmResourceIdentifier)`),
which returns the same string for a URL-based instance. `create-file-modal`
keeps its `fileURL` calls: they feed `cardService.saveSource(url: URL)` and a
`Deferred<URL>`, so converting them means widening those signatures.

`validate-realm` gains a better error for garbage input — the membership check
now reports `Invalid realm: <input>` where the URL constructor reported
`Invalid URL`.

Co-Authored-By: Claude Opus 5 <[email protected]>
The file chooser modelled a workspace as `{ url: URL }`, parsed from the realm
list's keys. Every use of that URL is a comparison, a render key, or a
`RealmPaths` construction — none need URL structure, and parsing constrains the
realm list to URL-shaped identifiers.

`FileChooserRealm` now carries `id: RealmIdentifier`, and the upload service
takes `realm: RealmIdentifier` in place of `realmURL: URL`, building its target
with `fileRRI` and passing it to the VirtualNetwork-backed `authedFetch` and to
the store — both of which take an identifier.

The file tree still receives the same string it received before (`@realmURL` was
already fed `.url.href`), so the tree keeps its current contract.

Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   1h 50m 27s ⏱️
3 937 tests 3 923 ✅ 14 💤 0 ❌
3 955 runs  3 941 ✅ 14 💤 0 ❌

Results for commit 4b6e393.

Realm Server Test Results

    1 files      1 suites   15m 12s ⏱️
2 119 tests 2 119 ✅ 0 💤 0 ❌
2 198 runs  2 198 ✅ 0 💤 0 ❌

Results for commit 4b6e393.

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