GeezerVison is showing github.com — impl(pm-stack): E1 — tenancy schema + migration baseline (#9083) · Issue #12796 · developing-today/code
impl(pm-stack): E1 — tenancy schema + migration baseline (#9083) #12796DescriptionImplementation slice E1 of #9083 (tenancy architecture, component E of epic #9078).
Design record: doc/2026-11-17T16-55-00Z_design_hosted-tenancy-architecture/2026-11-17T16-55-00Z_design_hosted-tenancy-architecture.md §2.1, §11 item 1 (merged via PR #11325).
Work
Create the tenancy DB schema (§2.1) as a migration baseline: central registry of accounts, database registry, roles, and peer/account configuration (peer classes from #9106 are configuration, not a parallel trust model).
Invariant
The "never central" list stays never-central: no content, key, or token columns may appear in the tenancy schema — tokens are metadata only, never stored values.
Acceptance
- Tenancy schema lands as a migration implementing §2.1.
- A test fails if a content/key/token column appears in the schema.
- Peer-principle honoured: hosted, Rust-binary, and self-hosted nodes are the same participant kinds; no special-casing.
Sequencing (design §11)
E1 and E6 are parallel. E2, E3, E4, E5 depend on E1.
Filed by Lane BZ (archer) 2026-11-22 as the §11 follow-up pass for #9083. Activitydeveloping-today commented on Nov 23, 2026 dezren39 commented on Nov 23, 2026 Pickup — xaltha lane taking E1 (tenancy schema + migration baseline).
Plan: implement design §2.1 (doc/2026-11-17T16-55-00Z_design_hosted-tenancy-architecture) as the baseline migration for the central tenancy DB — tables account, binding, tenant_db, role_grant, peer_policy, publish_record, credential — plus the acceptance guard test: a test that fails if any content/key/token column appears in the schema (§2.3 "never central"), and a peer-principle check (one participant_kind vocabulary for hosted / native / self-hosted / public; no hosted-only tables).
File footprint (coordination with the sibling #12825 lane, which is on the tenant-plane PM store in a different DB): new files under pkgs/id/hosted-worker/tenancy/, one new test under pkgs/id/hosted-worker/test/, and the hosted-worker package.json test list. No overlap with #12825's PM tenant-store schema (tenant DB) — this is the central tenancy DB only.
Branch: xaltha/12796-tenancy-schema. dezren39 commented on Nov 23, 2026 E1 landed as PR #13042 (branch xaltha/12796-tenancy-schema, commit 511c3a2df).
What landed:
pkgs/id/hosted-worker/tenancy/migrations/0001_tenancy_baseline.sql — the §2.1 schema as the tenancy DB migration baseline: account, binding, tenant_db, role_grant, peer_policy, publish_record, credential (metadata only) + meta carrying schema_version.
pkgs/id/hosted-worker/tenancy/README.md — plane rules and migration discipline for the E slices that follow.
pkgs/id/hosted-worker/test/tenancy-schema.test.ts — guard suite, wired into npm test and the id.hosted-worker.routing registry entry.
Acceptance evidence:
- Schema-as-migration: suite applies the migration to in-memory SQLite and pins the result table-for-table, column-for-column against §2.1. Also applied independently under Python sqlite3 (8 tables,
schema_version = 1).
- Never-central guard: every column of every table is scanned for content/key/token names; a planted-violations test (
token_value, private_key, note_body, blob_bytes, api_secret) proves the guard fails the suite if such a column appears. content_hash (address), iroh_id (public key) and jti (revocation handle) stay legal.
- Peer principle: one
participant_kind vocabulary (user_hosted | user_native | self_hosted_node | public) on the shared registry row; all four kinds insert identically; no hosted-only schema objects.
Tests: new suite 8/8 pass; full hosted-worker suite 44/44 pass; tsc --noEmit clean. Registry check shows no violation for the new file (the 3 it reports are the pre-existing #12230 gaps fixed by open PR #12870).
Two documented statements of the design's rules over its sketch DDL (migration header + PR body): the at-most-one-active-binding rule is a partial unique index (the sketch's table-level UNIQUE would break the rebind chain), and the vocabularies the record names as closed carry CHECK constraints.
No overlap with #12825: that slice is the tenant-plane PM store (different DB, disjoint tables); this PR's footprint is the central tenancy schema only.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|