Skip to content

impl(pm-stack): SSO relying-party H2 — identity_link table + link/unlink API (child of #9086) #14260

Backlog

Description

@dezren39

Child slice of #9086 (design: PR #14089, doc/2026-11-24T04-50-00Z_design_sso-relying-party-9086/ §4.3 + §5 slice H2). Depends on H1 (#14259). Parent of H3/H5.

What

New identity_link table in the CENTRAL tenancy DB (beside E's account/binding tables): one row per linked login door (door = github | google | microsoft | devtoday; provider_sub key; UNIQUE (door, provider_sub); email is contact-only, never a key). Link ceremony (authenticated session + new-door proof), last-door guard (single active link cannot be unlinked without a same-operation replacement), audit events on every link/unlink, history rows retained.

Acceptance

  • Migration + link/unlink round-trip tests including guard refusal and history retention.
  • DB-continuity proof: tenant rows untouched across relink (access keys off account_id/binding_id, never off a door).

Scope fence (binding, from #9086)

Tenancy account model aligns to #1253 roles — no parallel role system. SSO→ID binding ceremony itself is #2852's, consumed verbatim, not re-specified.

{
  "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-24T09:45:20Z",
    "session_id": "ses_e5df312c27dffeADY66CKCTD85",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code",
      "repo": "developing-today/code",
      "branch": "queue/21642-14039-native-lancedb-reader",
      "sha": "9e6b4adf64e54d8c623c329257bbac3b1f859266"
    },
    "auth_subject": "oc-code-07",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. added
    priority/normal
    effort/m
    app/pm-stack
    epic/pm-stack
    on Nov 24, 2026
  2. developing-today commented on Nov 24, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Triage verdict (task 23357, lane code-h, 2026-11-24): still open — remainder already routed and live.

    Fresh state: #14260 OPEN, no hold labels, no merged or open PR. Design PR #14089 merged; parent #9086 OPEN. Dependency H1 (#14259) still OPEN (its triage 22916 is blocked).

    No new packet filed: the implementation remainder is already owned by live feature_slice task 23353 (H2 of #14260, claimed by oc-code-05, lane any-occodejlldbejkoaghibjibcppglfbdajkgfoj). Enqueueing again would collide on the same work identity. This triage closes with that task as the recorded follow-up.

  4. developing-today-fleet commented on Nov 24, 2026

    @developing-today-fleet
    Contributor

    H2 implemented — PR #14418 (queue task 23353)

    Landed as PR #14418 (open, unmerged — the merge is Archer's; this lane does not merge):

    • Migration pkgs/id/hosted-worker/tenancy/migrations/0002_identity_link.sql: identity_link per design §4.3 (door CHECK for the closed vocabulary; UNIQUE (door, provider_sub) spanning history — one account per door-identity, ever; history rows retained via unlinked_at) + append-only identity_link_event audit table (the sketch DDL has no unlink-actor column; §§4.3/4.8 require every link/unlink audited with actor + timestamp — the deviation is stated in the migration header, per the baseline's precedent). schema_version 1 → 2.
    • pkgs/id/hosted-worker/src/identity-link.ts: link ceremony (authenticated session on the account + new-door proof; actor must be the account's active binding; links target only the session's own account), last-door guard with same-operation replacement (replacement links first; a refused replacement aborts untouched), door-identity-ever refusal across accounts, re-link reactivates the retained row, resolveAccountIdByDoor for the H1 front door. Refusals are returned reason codes, never thrown, never partially applied.

    Acceptance:

    • ✅ Migration + link/unlink round-trip tests incl. guard refusal + history retention — test/identity-link.test.ts (9 tests).
    • ✅ DB-continuity proof: the test snapshots account/binding/tenant_db/role_grant/credential across a relink and asserts identical rows; the module writes no tenant rows.

    Verification: targeted suites 17/17; full hosted-worker suite 186/186; tsc --noEmit clean. Tests ran on the laptop in the worktree (named fallback: the Actions exec runner cannot check out this repo/branch; repo CI runs on main only).

    Dependency note: H1 (PR #14323) is still open; this PR has no code dependency on it (the table shape is the design's) and lands behind no traffic per §6 rollout. Task 23353 is parked pr-bound on PR #14418: when it merges, the wake runs verify-disposition and completes 23353 as merged_verified; this issue closes from this record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/pm-stackeffort/mepic/pm-stackpriority/normal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions