GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — design(id): split tenant data between UserDO SQLite, per-user Turso and D1 (from #9080) · Issue #15482 · developing-today/code

design(id): split tenant data between UserDO SQLite, per-user Turso and D1 (from #9080) #15482

New issue
Copy link
New issue
Copy link
Done
Done
design(id): split tenant data between UserDO SQLite, per-user Turso and D1 (from #9080)#15482
Copy link
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/designA design proposal (design-architect): multi-step, phased, decision-bearingmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)status/needs-triageNot yet triaged; needs a first look

Description

@dezren39
dezren39
opened on Nov 26, 2026
Issue body actions

Gap from the #9080 gap analysis (component B of #9078). Design only.

What is missing

#9083 decided that a tenant has both the per-user Durable Object SQLite built by #3811 (UserDO, renamed TenantDO in docs) and a per-user Turso database as its data store. No record says which data lives where. The landed hosted store is DO SQLite only; the #5681 decision (Turso default and world primary, D1 for large shards) is not reflected in code. #14866 separately proposes moving data planes to Workers + D1, which may cut across this.

Done when

  • A dated design record decides, per data family (signed events and heads, KV, blob references, usage/metering, export state, world journals), whether it lives in DO SQLite, the per-user Turso DB or D1, and why.
  • It states how the decision squares with design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681, design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 and program: move PM Stack, queues, and all unblocked services to Workers + D1 (Cloudflare-first) #14866, and which issue implements the move (E6 impl(pm-stack): E6 — tenant DB store adapter in id-store (#9083) #12801 for the Turso adapter).

Generated by Claude Code

Acceptance criteria

  • The design states, per data class, whether it lives in UserDO SQLite, per-user Turso, or D1 — with the reason for each placement.
  • Migration/consistency implications of the split are named, not left implicit.
  • The design is recorded on this issue (or a linked doc) in enough detail for the sibling implementation slices to proceed without re-deciding placement.

Activity

  1. dezren39
    added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Nov 26, 2026
  2. dezren39
    added a parent issue on Nov 26, 2026
    • design(id): ID service, Workers edition — close the gaps on the #5524/#5681 serverless line to a workable hosted equivalent #9080
  3. developing-today-fleet
    added
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    status/needs-triageNot yet triaged; needs a first look
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 26, 2026
  4. developing-today-fleet commented on Nov 26, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 26, 2026 – with developing.today fleet
    Contributor
    More actions

    Intake review

    • Liveness: Merged PRs referencing this issue found in a title/body search: docs(id): Workers edition gap analysis for the hosted ID service (#9080) #15487 — none explicitly resolves it, so the issue stays open.
    • Notes: Design slice of the hosted-ID breakdown under design(id): ID service, Workers edition — close the gaps on the #5524/#5681 serverless line to a workable hosted equivalent #9080. This is a design issue (kind/design): done = the decision recorded, not code shipped.
    • Risks: Scope creep across sibling slices is the main risk; this issue's acceptance criteria (appended to the body) are the boundary.
    • Suggested approach: Work this slice against its acceptance criteria; cross-reference sibling slices rather than re-deciding shared contracts inside this issue.

    🤖 Agent note · handed off

    • Agent: fleet monitor (repo-fleet-monitor)
    • Session / ID: repo-fleet-monitor run 2026-11-26 02:14 CST
    • Found via: monitor reconciliation (intake enrichment, Duty 2)
    • Task: Intake enrichment — acceptance criteria appended, labels normalized, meta/enriched applied.
    • Expectation: Ready for triage/queue routing as labelled.
    • Links: n/a
  5. developing-today-fleet commented on Nov 26, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 26, 2026 – with developing.today fleet
    Contributor
    More actions

    Claimed by worker felix (agent felix, muse seat) — design pass: dated design record under doc/ deciding per-data-family placement across UserDO SQLite, per-user Turso and D1, squared with #5681, #9083 and #14866; implementation slices filed with dependency edges where a gap exists. PR will be left open for Felix's merge.

  6. developing-today-fleet commented on Nov 26, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 26, 2026 – with developing.today fleet
    Contributor
    More actions

    Design landed — PR #15495 (open, unmerged, for Felix)

    Record: doc/2026-11-26T09-00-00Z_design_id15482_tenant_data_split/ (+ doc/README.md index line), checked against main 65e69239a and the landed HW sources (user-do.ts, bridge-store.ts, export.ts, wrangler.toml).

    Decisions (design §1/§3):

    • Signed events and heads → per-user Turso (record); UserDO keeps rebuildable ingress session state.
    • KV → stays in UserDO SQLite.
    • Blob references → per-user Turso (record); bytes stay in R2; DO blobs becomes a rebuildable serving index.
    • Usage/metering → UserDO detail + tenancy-DB rollup (confirms design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 §3 rule 4; no per-event metering rows in the tenant DB).
    • Export state → stays in UserDO SQLite; export becomes two-source with both watermarks stamped.
    • World journals → per-user Turso (design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681 per-deployment rule; per-shard escalation inherited).
    • D1 → no per-tenant family (§4: program: move PM Stack, queues, and all unblocked services to Workers + D1 (Cloudflare-first) #14866 §2 owning-design rule; D1 has no per-tenant scoped credential, breaking design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 §7's token model; design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681 assigns D1 to shared-corpus shards). Reversal paths named: superseding ruling on design(pm-stack): PM service, Workers edition — TypeScript equivalent of aggregator/dashboard/reconcile as one hosted service #9079/design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681, or design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681 R1.

    Migration/consistency (§5): one write path, no dual-write (registry row in the tenancy DB is the placement fact), movement only by #5869 export/replay, read-at-watermark freshness, budget ladder meters both planes, never-central list untouched.

    Implementation (§7): E6 #12801 (adapter), #15483 (contract/budget/manifest), E3 #12798 (sync ingress), and one new slice filed — #15494 (rehome + migration + two-source export), sub-issue of #9080, blocked_by #12801 and #15483 (edges verified by readback). #15494 not enqueued: queue broker unreachable (amd-6 down, #15131); reason recorded on #15494.

    All three acceptance criteria are mapped in design §9. This issue is done when PR #15495 merges; left open for Felix's merge + done check.

  7. developing-today-fleet
    added a commit that references this issue on Nov 26, 2026

    Merge pull request #15495 from developing-today/felix/15482-design-te…

    f8d3231
  8. developing-today-fleet
    closed this as completedon Nov 26, 2026
  9. developing-today-fleet commented on Nov 26, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 26, 2026 – with developing.today fleet
    Contributor
    More actions

    Evaluation: this design under the owner ruling — tenant data moves to per-tenant D1

    Owner ruling 2026-11-26 (on #14866, comment 7189808145; superseding note on #9079, comment 7189808896): everything moves to Cloudflare with D1 as the database; Turso targets are superseded, including tenant data. That ruling is exactly the superseding mechanism this record's §4 named ("a superseding ruling recorded on #9079 or #5681"), so §4's "no per-tenant family in D1" is superseded, and the Turso placements in §1/§3 are retargeted. This comment is the evaluation; the revised implementation slice is #15538, which supersedes #15494's target. No doc PR in this pass — the evaluation fits here and in #15538's body, and a doc-lineage amendment for #9083 §7 is an acceptance item on #15538 so it lands with the implementation record, not ahead of it.

    Topology chosen: one D1 database per tenant

    One D1 database per tenant, created by the tenancy plane via the Cloudflare API at provisioning; the tenancy directory — itself one platform-only D1 database under the same ruling — holds the tenant → database_id mapping (tenant_db registry row, backend = d1). The tenant's data path reaches its database only through a Worker binding: the binding IS the credential boundary; no per-tenant API token, connection string, or password exists.

    Checked against Cloudflare's documented limits (fetched 2026-11-26):

    • Limits (https://developers.cloudflare.com/d1/platform/limits/): Workers Paid — 50,000 databases per account, 10 GB max per database (cannot be increased), 1 TB total per account (increasable on request); the page itself says D1 "is designed for horizontal scale out across multiple, smaller (10 GB) databases, such as per-user, per-tenant or per-entity databases." A footnote on the same page caps a single Worker script at ~5,000 D1 bindings (script metadata) — see the binding-mechanics caveat below.
    • Pricing (https://developers.cloudflare.com/d1/platform/pricing/): scale-to-zero; Workers Paid includes 100,000 databases before $0.10/database-month (note: the pricing page's 100,000 and the limits page's 50,000 disagree — flag for re-check at scale; both are far above near-term tenant counts), first 25B rows read / 50M rows written monthly included, storage $0.75/GB-month past 5 GB, empty database ≈ 12 KB.

    Binding mechanics, honestly: one global Worker statically binding every tenant does not scale past ~5,000 tenants and must not be built. The binding is delivered per tenant via Workers for Platforms — the tenant's User Worker is uploaded with its own D1 binding, and D1 custom bindings (https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/custom-bindings/ — D1 listed as available) let the Platform Worker intercept query() and enforce per-tenant scoping from props the User Worker cannot read or modify. Fallback: pooled Workers each holding a shard of tenants' bindings. Rejected as the data path: the D1 REST API from a Worker holding an account token — that reintroduces a broad bearer credential; the account API token lives only in the tenancy/provisioning plane (create/delete), never in a tenant path.

    Alternatives compared

    • Single shared D1 with tenant_id scoping — rejected. D1's 10 GB per-database cap becomes a 10 GB cap for all tenants combined; a cross-tenant SQL path exists by construction; one compromise is every tenant. It is the shared-DB alternative design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 already rejected, made strictly worse.
    • Shared D1 + per-tenant D1 only for large tenants — rejected. Two topologies and two code paths forever; the shared pool keeps the aggregate cap and the blast radius; the shared→own move is precisely the hard migration; and per-tenant databases cost nothing at small scale, so the hybrid buys nothing.

    The credential story — #9083 §7, amended

    §7's model (short-lived, audience-scoped, per-(tenant, database) Turso tokens; jti revocation; no token values centrally; issuance gated on account/binding/tenant_db state) cannot apply to D1 literally — D1 has no per-tenant scoped credential, which was §4 reason 2. Under the ruling, §7 is amended in effect, with its guarantees preserved by different mechanisms:

    • Audience scoping becomes structural: the binding names exactly one database; there is no bearer artifact to replay against another tenant's DB.
    • The leak window disappears as a category: there is no per-tenant credential to leak. The only bearer credential is the platform's account-level API token, held solely by the tenancy plane — §7's own carve-out for the platform management credential.
    • Issuance gating survives unchanged in order and place: provisioning/dispatch refuse unless account, binding and tenant_db are active, checked cheap-first at the front door.
    • Revocation: suspension = front-door refusal + unbinding; deletion = refuse first, then drop the database (the §4 step-10 ordering survives). credential metadata becomes audit-only on the D1 path.
    • Genuinely lost, named: direct endpoint access and embedded replicas. Native peers can no longer hold a scoped DB credential; they sync only via Worker routes carrying signed LogSync envelopes — which is what design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 already decided sync is. The public DB's short-TTL read tokens become read-only Worker routes / a read binding in a public-reader Worker.

    Per-family mapping (this record's §1, retargeted)

    Family Was (this record) Now
    Signed events and heads Per-user Turso; DO = ingress session state Per-tenant D1; DO role unchanged
    KV UserDO SQLite Unchanged
    Blob references Per-user Turso; bytes in R2; DO serving index Per-tenant D1; bytes still R2; DO index unchanged
    Usage / metering DO detail; tenancy-DB rollup Unchanged, except the rollup's home is now the tenancy D1
    Export state UserDO SQLite Unchanged
    World journals Per-user Turso (world primary) Per-tenant D1; >10 GB worlds shard (below)

    What happens to this record's Turso-premised decisions

    • Rebuildable ingress state in UserDO: unchanged. The premise never depended on the backend.
    • Dual-watermark export: unchanged in shape — tenant-store watermark (now D1's) + DO state watermark, both stamped, both replayed.
    • Read-at-watermark freshness: unchanged as the id: design: serverless storage contract (from #5681) #5863 contract; on D1 it is implemented against the tenant database's primary / session bookmark instead of a Hrana session.
    • The growth argument weakens — stated plainly. §3.1 moved the log to Turso partly to escape the DO's 10 GB ceiling. Per-tenant D1 has the same 10 GB hard cap, and it cannot be increased. What the move buys is a separate 10 GB for the log, apart from the DO's 10 GB of working state — not a higher ceiling. A tenant outgrowing 10 GB of log shards across multiple D1 databases or sinks cold data to the home-lab tier (design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681 §5.1 escalation, direction inverted: there is no bigger D1 database to escalate to), and the 1 TB account total binds the aggregate.
    • Migration rules (§5): unchanged, kept verbatim in impl(id): rehome hosted tenant event log and blob references onto per-tenant D1 — D1 retarget of the #15482 tenant-data split (supersedes #15494's Turso target) #15538. Movement only by id: design: backup, recovery & exit for serverless storage (from #5681) #5869 export/replay, one write path, no dual-write, registry flip, drain after one retention interval. The D1 topology forces no change to them.

    Blockers re-evaluated

    • id(hosted): storage contract, budget ladder and backend manifest on the hosted store (from #9080) #15483 still gates — contract, budget ladder and manifest are backend-agnostic, and the manifest is where backend = d1 + database_id is served from. impl(id): rehome hosted tenant event log and blob references onto per-tenant D1 — D1 retarget of the #15482 tenant-data split (supersedes #15494's Turso target) #15538 is blocked_by id(hosted): storage contract, budget ladder and backend manifest on the hosted store (from #9080) #15483.
    • E6 impl(pm-stack): E6 — tenant DB store adapter in id-store (#9083) #12801 no longer gates in its current form — its acceptance is a Turso-over-HTTP backend for Rust id-store; the hosted D1 path is a TypeScript Worker on a native binding. Its invariant (one interface, same conformance tests, no hosted-only special-casing) is carried into impl(id): rehome hosted tenant event log and blob references onto per-tenant D1 — D1 retarget of the #15482 tenant-data split (supersedes #15494's Turso target) #15538's acceptance criteria instead of a blocked_by edge. impl(pm-stack): E6 — tenant DB store adapter in id-store (#9083) #12801 needs a retarget-or-split decision from Felix.

    Needs a decision before implementation

    1. Felix: impl(pm-stack): E6 — tenant DB store adapter in id-store (#9083) #12801 — retarget, split (a D1/store_traits conformance slice), or close as superseded-in-part.
    2. Felix/Drewry: record the design(pm-stack): tenancy architecture — per-user Turso databases + central tenancy DB, served by Workers and Durable Objects #9083 §7 amendment in the doc lineage (acceptance item on impl(id): rehome hosted tenant event log and blob references onto per-tenant D1 — D1 retarget of the #15482 tenant-data split (supersedes #15494's Turso target) #15538) — the ruling authorizes it; the written amendment should not stay tribal.
    3. Implementation spike on impl(id): rehome hosted tenant event log and blob references onto per-tenant D1 — D1 retarget of the #15482 tenant-data split (supersedes #15494's Turso target) #15538 must confirm Workers for Platforms custom bindings for D1 vs the pooled-Worker fallback before provisioning work starts.

    — Felix (agent felix), evaluation + filing pass: no code, no deploys, no data movement.

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/idPackage/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/designA design proposal (design-architect): multi-step, phased, decision-bearingmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)status/needs-triageNot yet triaged; needs a first look

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.