Skip to content

design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083

Closed
0 of 7 issues completed

Description

@dezren39

Component E of epic #9078 (hosted editions program). Design first (design mill, under #9078).

What (Drew's sketch, 2026-11-12)

  • Per-user ID databases in Turso: each user gets their own hosted database(s), served and handled by Workers and Durable Objects (routing, auth, sync coordination, provisioning).
  • A central tenancy database: the registry of users, their databases, account state, and roles — the control plane the Workers consult.
  • Hosted per-user instances connect and sync their data (a user's local/native instance ↔ their hosted DB, both directions, with a conflict story).
  • A large public database we offer: everyone can connect to it too — public content published there is readable by all; how publishing works (component F's reference model) is designed with F.

Builds on / relations

Open design questions

  1. Tenancy DB schema: what lives centrally (accounts, DB registry, roles, publish index?) vs per-user — and what must NEVER live centrally (content? keys?)?
  2. DO responsibilities: one DO per user? per DB? — routing, presence, sync sessions, rate limiting, metering (vs id: implement hosted Worker API + per-user DO provisioning and metering (from #2046/#2852 slice 3) #3811's metering).
  3. Provisioning lifecycle: signup → tenancy row → Turso DB creation → credential issuance/rotation → suspension/deletion; who can do each step.
  4. Sync protocol: native instance ↔ hosted DB — change capture, ordering, conflict resolution, offline behavior; does sync ride component G's transports or direct Turso replication?
  5. Public DB: single shared Turso DB or a federation — write path (who may publish), moderation/abuse controls, and how per-user DBs reference its content (component F).
  6. Credential model for direct Turso access (component G): scoped, expiring tokens per user per DB — issuance and revocation from the tenancy plane.

Acceptance

Activity

  1. added
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    epic/pm-stackReprioritization program epic (2026-11-12)
    on Nov 12, 2026
  2. developing-today commented on Nov 12, 2026

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

    @dezren39
    MemberAuthor

    Amendment applied (Drew 2026-11-12 17:03, epic #9078): PEER PRINCIPLE. The tenancy/sync design treats hosted-CF nodes, Rust-binary nodes, and clustered self-hosted nodes (component I, #9087) as the SAME participant kinds with different backends. Our own server is a peer, not a special case — no protocol special-casing; the only differences are backend complexity and possible ID-service clustering.

  4. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    INPUT from program #9106 (Drew, 2026-11-12 18:29 CST): tenancy gains a federation dimension — peer classes (fully trusted / send-only / accept-signed-from), signed-data-only acceptance, federated query fan-out, and reputation are designed in Part B of #9106 (#9141-#9148, under #9108). The tenancy DB's peer/account model should expect those classes as configuration; don't invent a parallel trust model here.

  5. 22 remaining items

  6. added a commit that references this issue on Nov 18, 2026
  7. removed their assignment
    on Nov 20, 2026
  8. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Merged work, still open. Every pull request that references this issue has merged (#11325) and none is open, but the issue kept status:in-review. Tasks that name it as a blocker have been waiting on it.

    status:in-review is removed. Whoever takes this next: run the issue's done check against main. Close the issue if it passes; if not, list what is left here and carry on with it (AGENTS.md, "Finishing work").

    By: Claude, 2026-11-22 flow review.


    Generated by Claude Code

  9. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Component I adapter-design input from #9087: Self-hosted tier design. E/control-plane requirements are in “Component E/F boundaries”: authoritative tenant-scoped references and authorization, policy/holds and desired-vs-observed replica metadata, transactional/replayable outbox, and race-safe serialization of reference removal against GC. Physical replicas never grant access. This defines the boundary without deciding E’s tenancy schema or sync design.

  10. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done check passed — closing (Lane BZ, archer, 2026-11-22)

    Done check against main, per the 2026-11-22 flow-review instruction on this issue:

    Premise/singular-ownership check before this pass: issue open, no live claim by another worker in today's comments, no open PR referencing #9083; searches for TenantOpsDO / SyncCoord / PublishIndex returned only PR #11325, confirming E1–E7 were unfiled.

    All acceptance criteria pass — closing as completed. The implementation work continues in E1–E7 above.

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-stackpm-stack (Pad/Grist) in developing-today/codeeffort/lLarge: multi-day or open-ended; expect staged check-insepic/pm-stackReprioritization program epic (2026-11-12)priority/normalOrdinary priority (the default)status:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions