Skip to content

feat(id-hosted): serve E4 credentials + H2 identity links through the tenancy entry point (#15481) - #16814

Merged
dezren39 merged 1 commit into
mainfrom
xaltha/15481-tenancy-entrypoint
Nov 29, 2026
Merged

dezren39 merged 1 commit into
mainfrom
xaltha/15481-tenancy-entrypoint

Conversation

@dezren39

@dezren39 dezren39 commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Refs #15481 — one bounded slice: the target credentials (E4) and identity-link (H2) modules are now served through the Worker entry point. The remainder is named at the bottom.

What this serves

New owner-scoped routes on TenantOpsDO, behind the same authenticated front-door edge (#15479 + registry gate) and the same per-object serialisation gate as the lifecycle routes (PR #16443):

Route Module Behaviour
POST /v1/tenant/credentials credentials.ts issueCredential §4 step 6: mint a scoped (read/readwrite), ≤15-minute credential for the caller's own active tenant
POST /v1/tenant/credentials/revoke credentials.ts revokeCredential Revoke one of the caller's own credentials; another tenant's id answers exactly like an unknown id (404)
GET /v1/tenant/identity-links identity-link.ts listIdentityLinks The session account's link rows, history retained
POST /v1/tenant/identity-links identity-link.ts linkDoor Link a completed-login proof on a new door to the session's own account
POST /v1/tenant/identity-links/unlink identity-link.ts unlinkDoor Unlink under the last-door guard; an optional replacement is linked first or nothing changes

Design choices, all following the modules' own contracts:

  • The session is minted server-side. The front door already mints the owner actor from the authenticated binding; these routes build the E4/H2 session from that actor — live, this binding only — and resolve the account id from the binding row in the tenancy store, never from the request. A missing binding row fails closed (503).
  • The token signer is a seam. TENANT_TOKEN_ISSUER on the object env is the only place a token value exists (§7's rule for TenantTokenIssuer); with no signer bound, issuance fails closed with 503 token_issuer_unavailable and mints nothing. Revocation works without a signer (metadata + best-effort deny-list hook when one is bound).
  • Refusals map, never mint. Module refusal reasons become statuses (invalid scope / bad door → 400, not-owner / wrong-binding → 403, inactive states / already-linked / door-claimed / last-door → 409, unknown rows → 404) in the object's existing {error, message} shape.
  • Identity-link runs under this object's gate — the serialisation identity-link.ts's header explicitly relies on ("the tenancy object's gate").

Tests

test/tenancy-services-entry.test.ts — through the Worker fetch handler (the issue's Done-when), against a real TenantOpsDO over the real tenancy migrations, with a fake issuer at the seam: issuance happy path + metadata row, invalid scope mints nothing, unbound issuer fails closed, revoke (incl. deny-list hook + unknown id), and the full link/list/duplicate/last-door-guard/unlink ceremony. Wired into the package test script.

Verification: full id-hosted-worker suite 451/451 pass (45 test files, incl. the 6 new tests) at this head, run locally with the package's own node test command; a remote dispatch of the same suite is filed as an aid and its result will be noted on the PR.

Remainder for #15481 (stays open)

Named in the issue's module list and still unserved after this slice: provisioning-surface.ts, enablement.ts, admission-gate.ts (the migration control surface is already served by the migration-operator routes). Each needs its own serving decision — provisioning-surface and admission-gate front the operator/platform side rather than the owner edge used here.

{
  "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-29T13:57:32Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch/workspace/github-work/w0647-l18",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch/workspace/github-work/w0647-l18",
      "repo": "developing-today/code",
      "branch": "xaltha/15481-tenancy-entrypoint",
      "sha": "0f524d517bc11dbb3a3004438d22acfd349cda2e"
    },
    "auth_subject": "xaltha",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

…antOpsDO (#15481)

New owner-scoped routes on the tenancy object, behind the same
authenticated front-door edge and serialisation gate as the
lifecycle routes:

- POST /v1/tenant/credentials — §4 step 6 issuance via the E4
  module (credentials.ts). The session is minted from the
  authenticated owner actor (live, this binding only); the
  account is resolved from the binding row, never the request.
  The token signer is the new TENANT_TOKEN_ISSUER env seam and
  fails closed (503) when unbound; module refusals map to
  400/401/403/409 without minting.
- POST /v1/tenant/credentials/revoke — revokes one of the
  caller's own credentials; another tenant's id answers exactly
  like an unknown id (404).
- GET/POST /v1/tenant/identity-links and
  POST /v1/tenant/identity-links/unlink — the H2 ceremony
  (identity-link.ts) served under the object's gate, which is
  the serialisation that module's header names.

Tests through the Worker fetch handler (the issue's Done-when):
test/tenancy-services-entry.test.ts, wired into the package
test script. Full hosted-worker suite: 451/451.

Refs #15481 — remainder (provisioning-surface, enablement,
admission-gate surfaces) named on the issue.
@coderabbitai

coderabbitai Bot commented Nov 29, 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 57 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: 680c4b9d-d191-4533-975d-aa63849ce7cb
Commits

Reviewing files that changed from the base of the PR and between b35747c and 0f524d5.

Files selected for processing: 3

  • pkgs/id/hosted-worker/package.json
  • pkgs/id/hosted-worker/src/tenant-ops.ts
  • pkgs/id/hosted-worker/test/tenancy-services-entry.test.ts
  • 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

@dezren39

Copy link
Copy Markdown
Member Author

Lane 0647-L18 verification note: merging on lane judgment per the work-loop core (CI is not a gate; the fleet runner pool is stalled with dozens queued). Verification behind this merge: full diff read against #15481's Done-when and the two modules' own contracts; the full id-hosted-worker suite run with the package's own test command — 451/451 pass at head 0f524d517, including the 6 new through-the-fetch-handler tests. A remote dispatch of the same suite (run 46270208503, node:22-bookworm) is queued as an aid; if it surfaces anything once the pool drains, I will fix forward on #15481.

@dezren39
dezren39 merged commit 17c0ed1 into main Nov 29, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/15481-tenancy-entrypoint branch November 29, 2026 13:58
@developing-today-fleet

Copy link
Copy Markdown
Contributor

Wake verdict — lane 0900-AD (xaltha, 2026-11-30): aid run 46270208503 concluded FAILURE, attributed firsthand from its log: 'Fleet target checkout fetch failed for repo=developing-today/code ref=xaltha/15481-tenancy-entrypoint' — the run started after this PR merged (2026-11-29T13:58:32Z, merge commit 17c0ed1) and the branch was deleted on merge. The target command never ran — NO-VERDICT, not a code failure. Re-verification on current main dispatched: run 46447759692 (node --experimental-transform-types --test test/tenancy-services-entry.test.ts in pkgs/id/hosted-worker, code@main). Its conclusion is the verification of record; FAILURE there = fix-forward owed on #15481.

@developing-today-fleet

Copy link
Copy Markdown
Contributor

Wake verdict (final) — lane 0900-AD (xaltha, 2026-11-30): re-verification run 46447759692 on current main concluded SUCCESS (node --experimental-transform-types --test test/tenancy-services-entry.test.ts, pkgs/id/hosted-worker). The merged change from this PR (head 0f524d5, merge commit 17c0ed1) is verified green on main. Wake fully discharged; no fix-forward owed.

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