Repository navigation
docs(id): design jurisdiction-aware hosted user stores - #3406
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4103339228
ℹ️ 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".
|
|
||
| The shared directory is the authoritative control plane. A user row has a unique pseudonymous `subject_key`, immutable subject-to-account binding, `jurisdiction` (active), `jurisdiction_pending` (nullable target), `migration_id`, `phase`, and monotonically increasing `routing_epoch`. A transaction creates this row with the policy value `us` **before** any DO ID is derived or request is sent. Duplicate signup reads the existing row; it never overwrites it or resets the policy. Thereafter only the migration state machine may change `jurisdiction`, with a compare-and-swap on migration ID, old jurisdiction, phase and epoch. Normal profile updates cannot change it, even before first DO creation. Invalid, absent, unsupported, or unprovisioned values fail closed. Legacy unrestricted objects must be inventoried and migrated by a separately reviewed procedure, not relabelled `us` or silently backfilled. | ||
|
|
||
| One routing module owns the raw binding and exports a function conceptually `userObjectId(sub: Subject, jurisdiction: Jurisdiction)` with **two required arguments and no default**, plus a `userStub(sub, jurisdiction)` that obtains both ID and stub from the *same* `env.USERS.jurisdiction(jurisdiction)` restricted namespace. `idFromName("google:" + sub)` is called only on that namespace. The module validates both values at runtime as well as statically; no subject-only overload, raw namespace access, unrestricted `get`, or fallback exists in application paths. Expose the raw binding only to this module and enforce this boundary by lint/static tests and code review. Each authenticated request resolves the authoritative row first and routes using its active jurisdiction and epoch; caches cannot authorize writes without the fencing protocol below. A missing jurisdiction must not silently produce a second, empty user store: unrestricted `idFromName` and restricted ID derivation produce different objects for the same name. A restricted namespace also rejects an ID from a different jurisdiction, unlike unrestricted `get`. |
There was a problem hiding this comment.
Reconcile object naming with the hosted provisioning contract
When implemented alongside the existing hosted provisioning spec, this router will address a different object from the one provisioning creates: doc/2026-10-30T22-45-00Z_design_hosted_provisioning_sso_binding.md §5.1 names the user DO with idFromName(binding_id), whereas this contract requires idFromName("google:" + sub). Restricting both to the same jurisdiction does not reconcile those different names, so provisioning and authenticated routing would disagree on the user's store. Specify one canonical naming scheme across both designs before handing these contracts to separate implementation slices.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Dispositioned in the design record for issue #2283 (triage task 5740): the finding is correct. Canonical scheme is userObjectId(bindingId, jurisdiction) — the name segment is the binding_id from this provisioning spec (§5.1, :261; stable across key changes, :46), with the jurisdiction design's two-required-arguments / no-default invariant unchanged. The "google:" + sub form came from investigation #2061's worked example, not a merged contract. The implementation packets for issue #3399 (task 5800) and issue #3400 (task 5801) carry the reconciliation as an explicit acceptance item, and the design doc in this PR should get the same one-line fix before merge.
Summary
Designs #2283 and links implementation follow-ons #3399, #3400, #3401, #3402, #3403, and #3404. Deployment support and residency guarantees remain subject to #2285.
Evidence
git diff --cached --checkpassed before commit. Documentation only; no runtime tests.Merge Danger
Door: two-way
Blast Radius: documentation
Proposed design only; production enablement is explicitly gated on account-level verification.
Need help on this PR? Tag
@codesmith-botwith what you need.