Skip to content

ui-sdk: evaluate bounded deduplication for managed Git storage #3514

Closed

Description

@schlessera

Current delivered investigation and remaining ruling

PR #3737 is merged as 9a1cc6470110c5c41f015c1882bc1c0ef03ea1f5 on inspected main, with milestone 0.45.0. Its report is docs/plans/repository-storage-dedupe.md; retained commands are scripts/dedupe-bench.py and scripts/native-proof/dedupe-experiment.ts. The report recommends rejecting background dedupe because its measured savings violate current first-owner attribution, sealed-root accounting or checkpoint-delta assumptions. This is a recommendation, not a maintainer ruling.

Exact next action: the maintainer selects an outcome on #3515. A measured rejection makes app latency during dedupe, concurrent fetch/checkout/repack and manager restart during dedupe moot; record that disposition against this issue's conditional acceptance before closure. Selecting dedupe instead requires those three still-unmeasured cells here before implementation. Keep needs: decision and no agent-ready; preserve the original measurement criteria and 0.45.0 attribution. The latest comment explicitly released the implementation claim.

Out of scope

Enabling a timer or daemon, running on production data, full-filesystem scans by default, picking a new storage provider, relaxing capacity admission, or automatically deleting/rewriting user files. Deliverable is a measured recommendation and decision proposal, not deployment.

Context

The concrete storage owner is createNativeReferencePool (packages/ui-sdk/src/server/native-reference-pool.ts:272); root creation/reservations are at lines 605–653. Git fetch/checkout workers are packages/ui-server/src/brain/reference-transport.ts:133 and :149. The separate reference pool uses simple-quota first-owner attribution, while native brain checkpoints use a separate no-qgroup filesystem. Read docs/decisions/{reference-pool-accounting,native-brain-storage,reference-source-acquisition,managed-worktrees,provider-history}.md.

Btrfs exposes out-of-band deduplication; it does not deduplicate arbitrary writes automatically. Nightly maintenance is a candidate secondary optimization after acquisition and worktree sharing, not a substitute for it.

Scope

Compare incremental scheduled duperemove, bees, and no background dedupe plus preventive snapshots/reflinks, using reproducible offline Git workloads. Investigate each on the reference pool and assess brain-volume eligibility separately. Publish the compatibility matrix, measured cost/benefit, proposed owner/API boundary and an explicit selection or justified rejection.

Acceptance criteria

  • Cite exact tested kernel, btrfs-progs and tool versions and upstream sources. Measure first/repeated scans, hash/state growth, CPU/RAM/I/O, metadata growth, unique allocated bytes actually saved, app latency and subsequent deletion/reclamation. Include already-shared files, independent copies, small files, compressed data and Git repack/GC output; do not equate apparent bytes with savings.
  • Test simple-quota owner attribution/combined limits, retained source owners, admission/headroom ledgers and physical reclamation before/after dedupe and subsequent writes/deletion/restart. Determine whether cross-root or cross-principal sharing is permissible; no automatic widening of private sharing domains.
  • Check read-only/sealed roots, COW/NOCOW/checksum compatibility, concurrent fetch/checkout/repack/GC, snapshot creation/deletion, incremental send and journal metadata deltas. Define exclusion or host-owner serialization that prevents false content edits, incomplete deltas, unbounded observations or invalid quota assumptions.
  • Define identity-fenced eligible roots, mount/symlink escape refusal, privilege boundary, safe hash database location/permissions/quota/rotation, one-run locking, CPU/I/O/memory/runtime limits, low-space behavior, cancellation and crash recovery. A hash database is optimization state, never authoritative application state.
  • State whether nightly scheduling is justified and select a maintenance window, trigger or alternative based on measurements. Define numeric success/regression thresholds and observable last success/failure/skipped status without claiming predicted savings as free capacity.
  • Produce a maintainer decision prompt with acceptable outcomes: bounded duperemove, another qualified approach, or measured rejection with preventive sharing and residual-growth alerts. Identify exact changes to binding decisions and split any resulting implementation into bounded tasks. Do not enable bees merely because a nightly file-scoped tool is unsuitable.

Verification

Use disposable native Btrfs fixtures and generated Odysseus Git repositories, offline tool binaries/images and actual concurrent filesystem operations. Retain commands, version identities, metrics, failure/interrupt evidence and a content hash/Git fsck comparison. Benchmarking is separate from normal keyless tests; no production scan is authorized here.

Contract impact

Investigation only. Proposed new CLI/MCP/config/status surfaces must identify authoritative contract updates and additive/minor versus breaking/ruling requirements before implementation. Investigation delivery retains its existing 0.45.0 milestone; any safeguard implementation needs its own scope and release commitment.

Research starting points (checked 2026-11-03)

Triage 2026-11-08 at main 8752570331ffebdbb9233196412781f6cd71f3d9: Folded the merged investigation and conditional closure/measurement handoff into the current specification. No dedupe or safeguard branch is selected.

Maintainer decision — 2026-11-08

measured rejection of background dedupe (outcome 1 on #3515). Keep preventive snapshots/reflinks and implement the residual-growth safeguard on #3515.

The investigation's conditional acceptance is satisfied by this ruling. The three unmeasured cells (app latency during dedupe, concurrent fetch/checkout/repack, manager restart during dedupe) are moot and will not be measured. bees is not enabled. Closing as completed against this ruling. Attribution stays 0.45.0 (PR #3737).

Activity

  1. added
    type: spike
    area: ui-sdk
    area: ui-server
    priority: p2
    agent-ready
    on Nov 3, 2026
  2. self-assigned this
    on Nov 8, 2026
  3. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claimed (token claim-3514-fc54b9ff) on branch spike/3514-bounded-dedupe from main 69e45194f. Its offline Git workload builds on the efficiency case of #3513 (PR #3676), which waits only on the open red-main incident before merging. Tool-cost measurements run on a real Btrfs filesystem here, and the pool-side simple-quota/sealed-root cells run in the hosted native fixture.

  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Investigation delivered in PR #3737 (docs/plans/repository-storage-dedupe.md), with the retained commands scripts/dedupe-bench.py and scripts/native-proof/dedupe-experiment.ts, and their exact versions and runs.

    Recommendation: reject background dedupe, keep preventive sharing, and add a residual-growth safeguard. The maintainer decision prompt is on #3515.

    Not measured, and needed only if the ruling selects dedupe: app latency during a run, fetch/checkout/repack racing a dedupe, and manager restart after one. If the ruling is the measured rejection, those criteria are moot and this issue can close against that ruling.

  5. added this to the 0.45.0 milestone on Nov 8, 2026
  6. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Investigation merged: PR #3737, squash 9a1cc6470110c5c41f015c1882bc1c0ef03ea1f5 on main (candidate confirmation run 42523232298, milestone 0.45.0).

    • Evaluation and compatibility matrix: docs/plans/repository-storage-dedupe.md.
    • Retained commands: scripts/dedupe-bench.py and scripts/native-proof/dedupe-experiment.ts, with tested versions and run identities in the document.
    • Recommendation: measured rejection of background dedupe, preventive sharing, and a residual-growth safeguard. The decision prompt is on ui-sdk: add the selected bounded repository-storage maintenance safeguard #3515.

    Next action (maintainer): rule on #3515.

    Labelled needs: decision until then; releasing my claim.

  7. added
    needs: decision
    and removed
    agent-ready
    on Nov 8, 2026
  8. removed their assignment
    on Nov 8, 2026
  9. removed
    needs: decision
    on Nov 8, 2026
  10. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-08): measured rejection of background dedupe (outcome 1 on #3515). Keep preventive snapshots/reflinks and implement the residual-growth safeguard on #3515.

    The investigation's conditional acceptance is satisfied by this ruling. The three unmeasured cells (app latency during dedupe, concurrent fetch/checkout/repack, manager restart during dedupe) are moot and will not be measured. bees is not enabled. Closing as completed against this ruling. Attribution stays 0.45.0 (PR #3737).

  11. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Closed against the measured-rejection ruling recorded above and on #3515.

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

    area: ui-sdkarea: ui-serverpriority: p2type: spike

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions