Skip to content

design(pm-stack): content-addressed media/data plane — R2 dedup, reference-based access, GC when the last reference drops #9084

Open

Description

@dezren39

Component F of epic #9078 (hosted editions program). Design first (design mill, under #9078). This carries the program's CENTRAL open question.

Drew's sketch (posed, not decided — 2026-11-12)

Media is content-addressed and deduped in R2. Sensitivity tiers decide placement and access: R2 with access controls, CDN for public content, or inside the Turso DB where that fits.

Because everything is already Turso/Cloudflare, maybe data does NOT need to be copied into each database: the DB holds IDs/references; the content lives once in R2 and can be garbage-collected only when ALL references drop. Access rule candidate: a user may access an object iff their DB holds a reference to it, OR the object is public-published in one or more DBs.

Alternatives the design must evaluate against the sketch

  1. Reference-only (Drew's sketch above).
  2. Copy-into-each-DB (content replicated per tenant DB).
  3. Hybrid (small content inline in DB, large content referenced in R2; or hot/cold split by sensitivity/size).

Evaluation axes: storage cost under dedup, access-control soundness (can a reference be forged or enumerated?), GC correctness (reference counting vs mark-and-sweep across many DBs; races with new references), deletion/privacy (a user deleting content others still reference; jurisdiction rules per #3401), latency (extra hop through R2 vs local rows), and what 'published public' means mechanically.

Builds on / relations

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): the primitives designed here must be ADAPTER-FRIENDLY toward the self-hosted tier (component I, #9087): RustFS (S3-compatible) as R2's counterpart, NATS for streams/messaging, and tiered storage classes with per-tier retention and placement/movement. Design the object-store and reference/GC contracts against an adapter interface, not against R2 alone.

  4. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Cross-reference from the Atlas v1 program (2026-11-12) — inputs, not decisions

    The Atlas v1 program (starter #9091, proto design doc/2026-11-12T23-59-00Z_design_atlas_v1_proto/note.md) touches this issue's plane in two places, both as inputs to this issue's open evaluation — neither settles S10 (reference-vs-copy) or the GC design, which remain this issue's to decide:

    Atlas's in-domain prior art remains #3125 (provenance registry, content-addressed extracts), already noted in this issue as a different domain to consult.

  5. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    INPUT from program #9106 (Drew, 2026-11-12 18:29 CST): content-plane addressing is specified in Part A of #9106 — ID shapes + hash.metadata sidecars (#9113/#9114) and the harvested LOCATION INDEX (#9115: all locations per hash — R2 bucket, laptop hostname+path, Drive account-prefixed, Drive URL) are the shared addressing layer; this issue's reference-vs-copy evaluation should treat them as inputs, not alternatives. Shared-bucket tenancy (trusted vs untrusted) is designed in #9136; GC large-file priority in #9137.

  6. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged
    task: 18834 (queue repo-health-code-pilot, worker repo-worker-code, lane code-d)

    Triage verdict for issue #9084: TRIAGED — component F design issue of epic #9078; design-mill work, not yet produced. Verified fresh this shift (2026-11-17).

  7. removed their assignment
    on Nov 20, 2026
  8. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Component I adapter-design input from #9087: Self-hosted tier design. Requirements for F are in “Component E/F boundaries”: provider-neutral immutable object identity, staged/checksummed publication, explicit replica and placement state, authorization-aware reads/fallback, outbox references rather than bytes, and reference/retention-safe GC. R2 and RustFS must satisfy one contract; do not assume R2-only semantics. The design does not choose F’s reference-vs-copy model.

  9. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: claimed
    lane: lane-bw (archer, sandbox fix lane, Drew scale-up 2026-11-22 ~21:01 CST: 6-12 lanes)

    Claiming the next slice of #9084: the component-F design document under doc/ — the three placement models (reference-only / copy-into-each-DB / hybrid) compared on the issue's named axes, a sensitivity tier table, a GC design with its safety argument, and the granular implementation issues filed from it.

    Premise check (fresh, 2026-11-23): issue OPEN, no design for F on main yet, no live claim covering this slice in the comments (last triage note 2026-11-17, task 18834). Inputs treated as inputs, not decisions: #9106 Part A addressing + location index (#9113/#9114/#9115), #9136 shared-bucket tenancy, #9137 GC large-file priority, #9087 component-I adapter requirements (comment 2026-11-22), #3401 jurisdiction.

    The recommendation in the design is recorded as PROPOSED, not decided — Drew posed this question as not decided (2026-11-12), so ratification stays with the mill / Drew.

  10. added a commit that references this issue on Nov 23, 2026
  11. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: slice-landed
    lane: lane-bw (archer)

    Slice landed: component-F design doc

    PR #12811 merged (merge commit a8887554755ff91cae16a54d046b6935c41c846f, verified on main: the doc reads back at 17,613 bytes): doc/2026-11-23T03-04-00Z_design_content-addressed-media-data-plane/.

    Acceptance mapping:

    Inputs honoured as inputs: #9106 Part A addressing + #9115 location index, #9136 tenancy, #9137 GC priority, #9087 adapter requirements, #3401 jurisdiction.

    Remaining on this issue: ratification of the recommendation (mill or Drew). The issue stays open for that; slices #12803-#12808 do not depend on it except where a slice says otherwise.

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/codeepic/pm-stackReprioritization program epic (2026-11-12)status:in-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions