Repository navigation
feat(id): identity_link table + link/unlink API (H2 of #9086, #14260) - #14418
Merged
developing-today-fleet[bot] merged 1 commit intoNov 24, 2026
Merged
Conversation
Migration 0002 in the central tenancy DB: identity_link (per #9086 design s4.3; door vocabulary CHECK; UNIQUE (door, provider_sub) over history — one account per door-identity, ever) + identity_link_event append-only audit table; schema_version 1 -> 2. src/identity-link.ts: the link/unlink store API — link ceremony (authenticated session on the account + new-door proof; the actor must be the account's active binding), last-door guard with same-operation replacement, re-link reactivates the retained history row, resolveAccountIdByDoor for the H1 front door. No tenant row is written or read for effect: relinking cannot touch tenant data (DB continuity, s4.3). Tests: test/identity-link.test.ts (round-trip, guard refusal, history retention, door-identity-ever, DB-continuity proof) + tenancy-schema pins updated to the amended schema of record. Full hosted-worker suite: 186/186 pass; tsc --noEmit clean. Refs #14260
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
developing-today-fleet
Bot
deleted the
queue/23353-14260-h2-identity-link
branch
November 24, 2026 14:33
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.
H2 of #9086 —
identity_linktable + link/unlink APIImplements slice H2 of the SSO relying-party design (
doc/2026-11-24T04-50-00Z_design_sso-relying-party-9086/§4.3 + §5), child issue #14260. Queue task 23353.What
tenancy/migrations/0002_identity_link.sqlin the central tenancy DB (beside E'saccount/bindingtables):identity_linkper the §4.3 DDL — one row per linked login door,provider_subis the key (email never appears),UNIQUE (door, provider_sub)over all rows ("one account per door-identity, ever"), history rows retained withunlinked_atinstead of deletes. Door vocabulary carries a CHECK (closed set, baseline precedent).identity_link_event— append-only audit table (actor binding + timestamp for every link/unlink, §§4.3/4.8; the sketch DDL has no unlink-actor column, so the audit trail lives here — stated in the migration header).meta.schema_version1 → 2.src/identity-link.ts— the store API over the same SQL seam the TenantOpsDO uses:resolveAccountIdByDoorfor the front door — takes the door explicitly, since (door, sub) is the key and no sub-only lookup is unambiguous.{ ok: false, reason }(front-door style), never thrown, never partially applied.Acceptance mapping (#14260)
test/identity-link.test.ts, 9 tests).account/binding/tenant_db/role_grant/credentialacross a relink and asserts byte-identical rows — access keys offaccount_id/binding_id, never off a door; the module writes no tenant rows.account_idonly.Verification
test/identity-link.test.ts+test/tenancy-schema.test.ts: 17/17 pass (schema pins updated to the amended schema of record).npm test): 186/186 pass.bunx tsc --noEmit: clean.Dependency note
H1's front-door library is PR #14323 (open). This PR has no code dependency on it — the table shape is the design's — and lands behind no traffic per the design's rollout (§6). The front door wires
resolveAccountIdByDoorin at H3.Refs #14260
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-24T14:31:12Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": null, "model": null, "lane_start_issues": [], "workspace_ref": null, "auth_subject": "archer", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.