Skip to content

Build: fleet kv phase 3 — authenticated blob offload and reference-safe GC #13318

Open

Description

@dezren39

Phase 3 — blob offload only (threshold, streaming upload, capabilities, GC)

  • Parent issue: Design: fleet kv — namespaced key-value store (local + global), blob offload to content-addressed R2 #10359 (threshold/blob question; reference pattern from design(pm-stack): content-addressed media/data plane — R2 dedup, reference-based access, GC when the last reference drops #9084).
  • Parent design: reviewed decision record (§8 threshold D009, §9 upload/read D011, §10 dedup/reference D010/D012). Stable decision IDs: D009, D010, D011, D012, D015 (envelope versions kv:raw-v1/kv:ref-v1; D013 reversed/superseded — no lists/tables in this phase).
  • Prerequisite: design PR docs(fleet): settle namespaced KV storage, sweep and blob design (#10359) #13294 must merge before this phase starts. Depends on: Phase 2 Build: fleet kv phase 2 — central CAS, shared namespaces and session sweep #13316 (shared primary + CAS sweep + supported auth); its implementation PR must be merged before Phase 3 implementation begins. Phase 1 is Build: fleet kv phase 1 — local verbs, scoped SQLite and backup #13314.
  • Scope (blob-only): per-namespace threshold knob (default 256 KiB, subordinate to the shared partition policy — may only narrow, never widen past the partition ceiling/16 KiB conservative start); --force-blob one-directional override (forces blob at/below ceiling; no force-inline above ceiling); staged → verified → published upload through the trusted endpoint (streaming length + recomputed BLAKE3-256 over exact bytes in ≤ 64 KiB chunks, ≤ 1 MiB resident; multipart completion is not publication — publication is the CAS + ref-registration transaction); KvBlobRefV1 rows (profile raw-blake3-256, digest, bytes_len, partition {jurisdiction, tier}, opaque adapter locator, state=published); hash-never-bearer reads via short-lived (5 min) object+operation-scoped capabilities minted from live reference state; component-F mark-and-sweep GC per (jurisdiction, tier) over the full root set (published rows, retained versions, conflict-proposed refs, unexpired archive/snapshot refs, dedup pins) sharing the central per-partition serialization point; the effective-threshold formula effective = min(namespaceKnob, partitionCeiling) resolves the nominal-vs-effective gap (256 KiB knob nominal, 16 KiB partition start effective where component E governs); the proposed partition_fences table (no code in this issue) lives on the SHARED primary and orders publish-CAS against the delete-fence sequence in one transaction serialization — group DBs never fence; cross-partition references refused (partition_mismatch). No lists/tables, no manifests: any future shape arrives as a new envelope version under D015.

Acceptance

  1. At/below effective threshold: inline kv:raw-v1 row; above: kv:ref-v1 row after staged→verified→published; promotion is a new version with identical read semantics; --force-blob forces blob treatment at/below ceiling; any attempt to place bytes inline above the ceiling refuses with a typed error.
  2. Arbitrary-byte streaming: a value well above any threshold (test: ≥ 64 MiB random bytes — larger than the streaming buffer, with resident working set asserted ≤ 1 MiB, not larger than machine memory) pushes and pulls with bounded resident memory, and the pulled bytes hash to the identical BLAKE3-256 digest recomputed streaming on receipt.
  3. Central never accepts an unpublished blob reference; staged/verified-but-un-CASed objects are invisible to reads and reaped by staging TTL under the staging pin; crash after publish-CAS leaves a retained ref root retired only by grace/GC; a "published"-marked object without its CAS is an orphan under grace/GC, never staging-TTL-reaped.
  4. Read without a live authorized reference mints no capability; hash presentation alone serves nothing; capabilities expire at 5 min and are object+operation-scoped.
  5. GC sweep: unreferenced content per partition passes candidate → grace → re-verify → fenced delete + audit over the full root set (published rows, retained versions, conflict-proposed refs, unexpired archive/snapshot refs, dedup pins); a reference created during grace clears candidacy via the shared serialization point; cross-partition resolution refuses.
  6. The blob row's (jurisdiction, tier) is identified from the authenticated scope's placement policy, never from the session partitionId; a placement-policy lookup failure refuses the upload (no default partition).
  7. Done check from repository root: cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-kv blob runs the proposed blob_* property/model/integration suite with a nonzero test count. It must include threshold boundary cases, binary 64 MiB streaming with the documented buffer budget, corruption refusal, reference-authorized capability expiry, retained-history pins, and reference-create/delete-fence interleavings. Also run cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-kv to preserve Phases 1–2. A zero-match filter is failure, not evidence. Reuse the existing component-F endpoint/GC conformance tests rather than creating a parallel object-plane protocol.

Oracles

  • Property: threshold placement — a value's placement (inline vs reference) is a pure function of (effective threshold, --force-blob), and reads are placement-indifferent. (PBT over sizes ±1 byte around the threshold; override only ever moves toward blob.)
  • Property: publish-before-reference — no execution reaches a readable reference row without a prior publish-CAS (CAS + ref-registration transaction) for the same digest. (Trace property over upload/CAS interleavings.)
  • Property: streaming hash integrity — pulled bytes always re-hash to the row digest; any mismatch refuses rather than serving. (PBT over sizes, chunk splits, truncation/corruption injection.)
  • Property: GC safety — a delete event implies (no live reference at re-verify) AND (grace elapsed) AND (fence epoch recorded). (PBT over reference/GC interleavings; derived index drift may only delay, never cause, delete.)
  • Model: blob lifecycle state machine (staged → verified → published → candidate → deleted) against the reference-row oracle; cross-partition attempts as typed refusals.
{
  "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-23T13:23:04Z",
    "session_id": "ses_e5df79277fdffep9u8FJIv4AqN",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/.local/share/opencode/worktree/7c7733/lane-any-n-12892-fleet-kv-design",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/.local/share/opencode/worktree/7c7733/lane-any-n-12892-fleet-kv-design",
      "repo": "developing-today/code",
      "branch": "lane-any-n/12892-fleet-kv-design",
      "sha": "5ac3ddcec60017b05b655b8fe665b06c61369ec3"
    },
    "auth_subject": "oc-code-06",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Related program: #10359

Activity

  1. added
    kind/feature
    priority/normal
    effort/l
    on Nov 23, 2026
  2. developing-today commented on Nov 23, 2026

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

    @dezren39
    MemberAuthor

    Filed by lane any-n under #10359, design task 21123 / parent 20571. Same-pass pilot coverage: repo-health-code-pilot task 21318 (queued); do not implement before design PR #13294 and the phase prerequisites are merged. This run publishes design/build handoffs only.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Triage — Lane XI, 2026-11-23 (queue task 21318). Verdict: valid build handoff, correctly scoped; implementation blocked on its named prerequisites. No small fix applies; returned to the queue as dep-blocked.

    Premise validated first-hand:

    • The parent design record exists at the cited commit (doc/2026-11-23T12-45-00Z_design_fleet_kv/… at 5ac3ddcec600) and the issue's scope traces to its decisions D009–D012/D015 as stated.
    • Ownership: no lane claim on this issue (full comment thread read: Kaneo link + the filing note only).

    Prerequisites, checked 2026-11-23T13:2xZ:

    So there is nothing to implement in this pass and nothing to fix in the issue text — the handoff is accurate as written. Queue task 21318 is dep-blocked on #13316 (with PR #13294's merge as the co-gate) and will re-surface when the phase-2 implementation lands; the phase-3 build then starts from this issue's acceptance criteria and oracles as written.

  5. added 2 commits that reference this issue on Nov 23, 2026
  6. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Related program: #10359. This phase delivers one of the three implementation stages from the accepted fleet-kv design.

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

    effort/lkind/featurepriority/normal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions