Skip to content

docs(id): design jurisdiction-aware hosted user stores - #3406

Merged
dezren39 merged 1 commit into
mainfrom
queue/3447-2283-jurisdiction-design
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/3447-2283-jurisdiction-design

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

signup → authoritative jurisdiction → restricted user store + local bucket
migration → fence → export/import → verify → CAS switch → safe cleanup

Designs #2283 and links implementation follow-ons #3399, #3400, #3401, #3402, #3403, and #3404. Deployment support and residency guarantees remain subject to #2285.

Evidence

Merge Danger

Door: two-way

Blast Radius: documentation

Proposed design only; production enablement is explicitly gated on account-level verification.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 07:44
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 793207e8-063d-4524-9fd6-9a89c90642a9
Commits

Reviewing files that changed from the base of the PR and between 0f4731e and 4103339.

Files selected for processing: 1
  • doc/2026-11-01_jurisdiction_aware_user_store_design.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T07:46:09.844639Z 4103339 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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