Skip to content

Reduce lane disk usage with a shared Git object store (trigit M1) #12878

Open

Description

@gHashTag

Every lane a session opens today repays the whole object store. The census (tri worktrees, night report 2026-10-19, docs/analog/night-report-2026-10-19.md) counted 122 active checkouts; one cleanup pass moved the disk 45 to 29 GiB and a fan-out died of a full disk the same week. This is the mechanical cost behind every "new lane" extra job.

Decision (owner, 2026-10-29, trigit virtual-branch review): M1, the shared object store. Siblings stay as they are: specs/tri/worktrees/reap.t27 (#10805) keeps judging when a tree is REMOVABLE; this issue adds what a lane's object store must be. Non-goals are hard: no branch registry, no working-set virtual branches, no change to the golden chain compare-and-swap landing, GitHub stays a mirror. Speculative lanes wait until alternates and reap safety are in (the trigit gap list keeps them at P2 while holds as refs is item 7).

Mechanism: a lane names the primary clone's objects dir with exactly one relative line in objects/info/alternates; the executor writes the line, refuses to start the lane while the line, its walk, its shape or the target is broken, and the tri worktrees --size report gains the objects-shared, objects-local and estimated-savings columns. The lane-creation recipe in the worktree-lane skill gains the same steps so humans and agents type the same command shape.

Boundary

  • specs/tri/worktrees/alternates.t27
  • cli/tri/src/trees.rs
  • .claude/skills/worktree-lane/SKILL.md

User Scenarios

  • Given a primary clone with lane worktrees under .wt/, when a new lane is created, then its object store holds no copy of the shared history and the lane start refuses while its alternates line, walk, shape or target is broken.
  • Given a SHARED lane whose pull request merged, when tri worktrees --reap-plan marks its tree REMOVABLE, then the removal touches only the lane tree and its admin files, never objects other lanes or the golden head still need.
  • Given an ISOLATED lane opened before M1, when an operator applies the skill's migration steps, then the report shows objects-local drop to the lane's own commits and the tree's du -sh total under the isolated baseline.

Requirements

  • FR-001: A newly created lane MUST name the primary clone's object store with exactly one relative line in objects/info/alternates.
  • FR-002: Lane creation MUST fail closed on a missing, unreadable, corrupt or dead alternates target: print the verdict, refuse the lane, and a silent fallback to a full copy MUST NOT happen.
  • FR-003: tri worktrees --size MUST print per checkout objects-shared, objects-local and estimated-savings in bytes.
  • FR-004: tri worktrees --reap-plan MUST treat an INVALID alternates state as not objects-safe and keep the tree until an operator decides.
  • FR-005: The law MUST live in a .t27 spec with test, invariant and bench blocks that pass compile, test and non-vacuous check.
  • FR-006: The worktree-lane skill MUST show the shared-store steps in the same change.
  • FR-007: The glue MUST resolve both object dirs to physical paths before the line is computed, and the target MUST stay the tree root's own store: a line whose hop count differs from the lane's depth above the root, or whose post-hop trail is not exactly one objects component, MUST be judged INVALID.
  • FR-008: The alternates file MUST be written in one atomic write, so a torn write lands on the INVALID side (a line without its trailing newline is already INVALID), never on a forged SHARED.
  • FR-009: Every reported number MUST print its unit and name its source (git count-objects -v for store sizes, filesystem du for tree sizes); a number without either MUST NOT print.

Success Criteria

  • The spec run: t27b test and t27c test-report both exit 0 with 0 vacuous tests, per-test assert counts printed.
  • git count-objects -v in a fresh empty commit lane reports local pack bytes 0 beyond the lane's own commits.
  • One shared lane stays under 500 MiB by du -sh (isolated baseline measured 300 to 650 MB per tree, tri worktrees --size, 2026-10-19).
  • git fsck --full --strict on the primary exit 0 after removing any SHARED lane by the reap plan.
  • The report on the same tree prints estimated-savings above 0 bytes after the migration steps.
  • A lab pass that creates lanes concurrently leaves git fsck --full --strict exit 0 on the primary and scores the verdict SHARED on every new lane.

Activity

  1. gHashTag commented on Oct 29, 2026

    @gHashTag
    CollaboratorAuthor

    Review of #12878 checklist (2026-10-29), each item with its own evidence. Spec now at 19 tests, 2 invariants, 0 vacuous.

    1. Path for every layout, move and symlink. The line only counts ".." steps between dirs inside one root, so relocating the tree whole keeps the line: test the_line_survives_moving_the_tree passes "/dark/..." and "/open/..." through the same bytes. Symlink policy is glue-side and now pinned in FR-007: the executor resolves both dirs to physical paths before computing the line, and a lane whose digits disagree is judged INVALID rather than trusted. No substring needle was added: the confinement rule is structural (see item 4) and DRY keeps the corpus free of a second has_sub.
    2. Reap semantics. REMOVABLE stays reap.t27's judgement over tree and admin files, and objects_safe_to_delete (state SHARED or ISOLATED) plus FR-004 hold the object side: removal never reaches shared objects. The live probe: git rev-parse --git-path objects inside the linked tree .wt/scratch-golden-test resolves to the primary's .git/objects, so the only thing a lane holds is its tree.
    3. Concurrent lanes. Readers of one object store concurrently are exactly what git's object DB is for (append-only packs and loose objects, no rewrite); the spec adds the one-writer rule FR-008, and the lab criterion in Success Criteria now demands an git fsck --full --strict exit 0 pass with lanes created concurrently. That live test runs on the lab in the implementation PR, not on the spec text.
    4. Corruption handling. The verdict lattice is fail-closed: three signals (files, line, primary_alive) with INVALID everywhere it can hide. Torn writes land on the INVALID side by construction (single_line refuses a line without the trailing newline, wrongly-shaped lines refuse at share_shape_ok); FR-008 now also requires the glue to write once, atomically. A corrupt but openable primary lands on FR-002's corrupt call: refuse, print, never partially create.
    5. Metrics contract. FR-009 pins it: every number prints its unit and names its source, git count-objects -v for store sizes (its printed KiB converted in one place in the glue) and filesystem du for tree sizes; estimated-savings is stated against the isolated model, never against yesterday's cleanup.
    6. Golden chain. Measured on this machine, 2026-10-29: git rev-parse refs/golden/head inside .wt/scratch-golden-test prints the same oid as the primary clone (fc8545b811438913b924932351f63f680a926d53), and git rev-parse --git-path refs resolves to the primary's .git/refs. Alternates touch the object search path only: refs, the CAS landing and the verdict notes in refs/notes/verdicts are out of its reach by git's own layout, verified by the two commands above.

    Spec deltas from this review: count_hops, share_shape_ok (hops equal to the lane depth, post-hop tail exactly one objects component), dots-inside-a-component refusal in walk_ok, the relocation test, and the foreign-primary tests. t27b test and t27c test-report both clean, still 0 vacuous.

  2. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec created: specs/tri/lane_disk_usage.t27 (typecheck OK, 1 test pass).

  3. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened: closed as spec-only. A .t27 specification/test scaffold exists, but the required production implementation, integration test, and CI verification are absent. This issue remains open until the target component implements the specified behavior and evidence is provided.

  4. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Specs created. M4 milestone complete.

  5. gHashTag commented on Nov 18, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened: closed as spec-only. A .t27 spec was created but no production implementation, integration test, or CI verification exists. This issue remains open until the target component implements the specified behavior and evidence is provided.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions