Skip to content

fix(gc): make the merged lean GC authority (#770) never worse than the base - #783

Merged
yifanxuaaa merged 20 commits into
layerfs_v2_0_0from
claude/p4-lean-int
Nov 24, 2026
Merged

yifanxuaaa merged 20 commits into
layerfs_v2_0_0from
claude/p4-lean-int

Conversation

@yifanxuaaa

Copy link
Copy Markdown
Contributor

Why

#770 (lean phase-3 GC authority) was merged into layerfs_v2_0_0 unchanged (2f9cb97443). Review found that, as merged, it is worse than the base in several places — most urgently, every existing 2.0 SQLite Store is refused at open (the schema moved to version 3, and the fix the refusal names, tools/store_gc_convert.py, only accepts Stores from the contributor's unmerged fork), and there are paths where a live mount can be judged Dead and its objects reclaimed.

This PR keeps #770's design (ordered place evidence, retained done rows, operator repair) and makes the merged code never worse than the base. It is based on #770's head (ec99bf29c2), so against layerfs_v2_0_0 it shows only the fixes; the merge is clean.

Do not roll layerfs_v2_0_0 out to a dsh host until this lands — the current tip refuses existing SQLite Stores.

What changes

# Regression in #770 Fix
1 Machine/Sandbox names compared Store-wide: on a shared Store, another home's newer box proved this home's live mount Dead Tokens carry the minting home's id (p1:<home id>.<kind>:<ms>:<nonce>); a value of another home (or one that predates the ordering) is no evidence (PlaceOrder::Foreign), so the holder stays Live / MountsActive as on the base
2 Wall-clock step back before a Sandbox recreate proved the live mount Dead Mints use max(now, previous + 1 ms) against the previous incarnation / record / tombstone; with the record present, only an equal tombstone means Dead, a newer one is Uncertain
— Cloned home (two running copies share an id) on a shared Store On PostgreSQL a place proof is Uncertain, never Dead; the operator settles/releases
3 A settle could revive a done row; the owner's own unmount could delete it state <> 'done' guards on release, mark-uncertain and the insert's conflict update
4–6 Schema v3 refused every existing SQLite Store; PostgreSQL columns without a version bump; loosened schema check No Store format change: schema/version byte-identical to base; the two tokens live in the existing gc_intent.evidence as place:v1;inc=…;gen=… (decodes to "no proof" for NULL, done-row audit text, malformed). store_gc_convert.py removed
7 Native reboot: place evidence hid the base's boot check, rows stayed stuck Owner evidence (owners.dead) applies first, exactly as the base; place evidence only adds proofs of death
8 A failed tombstone write aborted Sandbox removal before ending its intents Best-effort tombstone; removal continues and ends the intents
9 Read-ahead Streams::follow change (unrelated; disables read-ahead on a second pass) Reverted; belongs to #779 with a FUSE measurement
10 Every Store call read every Sandbox record/tombstone of the home The place view is built only for calls whose admission uses it (branch.remove, project.remove_file, project delete, machine-start reconcile)
11 Every mount ran an unindexed settle scan in the write transaction Removed; mount registration is as on the base
12 Every preview inserted a never-pruned done row preview is read-only
13–14 postgresql_gc_fence.rs (base PG writer-fence tests) deleted; machine_no_start project.get check deleted Restored

Also: real mount rows now record their project (so audit finds real releases); the process-global MACHINE_INCARNATION fallback is removed; the Sandbox generation floor and the bind's project lookup are best-effort; four tests that already failed at #770's head are fixed (project_delete_store, sdk_mount_lookup read the wrong list key; postgresql_statement_schema after the admission split; sqlite_compact_matrix lease segment / Linux-only boot test); dead code that failed clippy -D warnings removed; .lww and four project-41 design notes removed (doc policy); GC spec and sdk/store.md describe the final behaviour.

Tests deleted

layerfs-persistence gc_conversion.rs (3), gc_schema.rs (4), gc_intent_authority.rs (2), the pre-columns case in sealed_open.rs, and tools/test_store_gc_convert.py — all covered only the removed v3 schema / converter. The "expired lease" segment of sqlite_compact_matrix::a_live_or_uncertain_authority_keeps_the_compact_barrier (no lease exists). No base test is deleted.

Verification

  • cargo +1.85.1 check --workspace --all-targets and cargo +1.85.1 clippy --workspace --all-targets -- -D warnings: clean.
  • macOS: all 44 test targets touched by p4: lean phase-3 GC authority #770 or this PR pass (each ≤120 s, one attempt); re-run of the 22 affected after the last fix: pass.
  • Linux (Docker, rust:1.85.1-bookworm, repo launcher): 11 targets / 65 tests pass, including the Linux-only boot-evidence tests (a_dead_owner_with_a_current_place_is_still_settled, an_earlier_boot_is_settled_on_a_local_store, a_dead_owner_is_adopted_before_the_compaction_runs).
  • Base-format Store opens: the restored merge-forms-root.sqlite (user_version 42) via merge_metadata_only / merge_mixed_forms.

Not verified: live PostgreSQL (the PG suites, incl. the restored fence tests and the shared-Store rule, skip without LAYERFS_TEST_POSTGRES_URL); FUSE mount tests; a dsh host rollout.

Production LOC

Whole change: layerfs_v2_0_0 214,081 -> 214,060 (delta -21) (tools/production_loc.py; base before #770 was 211,762). Per commit (first parent vs committed tree; the three fix(...) commits from parallel branches are each counted against #770's head, their parent):

  • 941f66d43d revert(workspace): move the read-ahead window change out of the GC PR: 214,081 -> 214,073 (delta -8)
  • 77af674301 chore: restore base tests and drop stray files from the GC PR: 214,073 -> 214,073 (delta 0)
  • 5c3671ffa5 fix(control): best-effort tombstone, place view only for admitting calls, read-only preview: 214081 -> 214030 (delta -51)
  • 25c261b205 fix(persistence): keep the base Store format; place tokens live in evidence: 214081 -> 214104 (delta +23)
  • 2c120f08ca test(store): read main's list row by its branch key: 214,022 -> 214,022 (delta 0)
  • 32fd231d0c fix(gc): admission never judges a live holder dead where the base would not: 214,081 -> 214,096 (delta +15)
  • a54d5a3c44 test(gc): fix the PR's failing GC tests: 214,060 -> 214,060 (delta 0)
  • edecc1d3e7 style: rustfmt the files this PR touched: 214,060 -> 214,049 (delta -11)
  • 1cfc959de8 fix(gc): another home's token is no evidence; no place-proved death on a shared Store: 214,049 -> 214,060 (delta +11)
  • f396df4cb6 docs(gc): describe the final place-authority rules: 214,060 -> 214,060 (delta 0)

reference absent (retired R9c; last counted 65,417 at tree 498dd1917812)

Follow-ups (not in this PR; gaps, not regressions)

Worker-route Sandboxes record no evidence; tombstones on reclaim/forget; tombstone pruning and a done-row cap; a real liveness verdict behind safe; PostgreSQL release_done parity and repair_postgresql setup (add_project is SQLite-only); 2.0 call-shape conventions for store.repair_mount_holders; project.mount_holders (only a constant existed); PostgreSQL compact cleanup deletes kind='compaction' rows without a done filter (same as base).

🤖 Generated with Claude Code

yifanxuaaa and others added 19 commits November 24, 2026 16:05
The `Streams::follow` change follows any same-root window with
`until > start` without checking the window's start, so a second pass over
a file inherits the first pass's end and gets no read-ahead. It is also
unrelated to GC authority and attributed to the wrong base commit
(d19d98f is a GC mark change). It goes to #779 with its own FUSE
measurement; this restores the base `client.rs`.

Production LOC: 214,081 -> 214,073 (delta -8)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Restore engine/crates/layerfs-persistence/tests/postgresql_gc_fence.rs
  (base T6 admission and T6.5 project_epoch writer-fence tests on
  PostgreSQL; it was deleted with the lease/fence trim but tests neither).
- Restore the `project.get` read in api/crates/layerfs-api/tests/
  machine_no_start.rs (a stopped machine answers it from records).
- Remove the personal merge-tool config `.lww`.
- Remove core/docs/issues/project-41/{lean-coordination,lean-gap-closure,
  lean-verification,mount-authority-lease}.md: the documentation policy
  allows only the GC spec in that directory, and they describe deferred
  lease/archive work as implemented.

Production LOC: 214,073 -> 214,073 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lls, read-only preview

Three regressions against the base, in the control layer:

- Sandbox close and forced close: a failed retired-tombstone write (or a
  failed record read before it) no longer aborts the removal after the
  runtime is confirmed stopped. The removal goes on, still ends the mount
  intents and removes the record, and reports the unwritten tombstone as a
  `left` sentence (`lifecycle::not_retired`). A missing tombstone only means
  "no proof of death".
- The home place view (every machine record, Sandbox record and tombstone)
  is no longer read on every Store call. `with_service` and `open::run` no
  longer build it; only the calls whose admission compares placed mount
  intents do: `branch.remove` and `project.remove_file`
  (`place_view::admits`, local and worker frames), project delete (local
  admit/mark via `place_view::scoped`; worker frames unchanged) and the
  machine start reconcile. Reads, listings, file writes and merges build
  and send none: their shared intents conflict only with operation intents,
  which carry no place. The repair call no longer sends a view: none of its
  actions compares a place. The mount path's own place values are unchanged.
- `store.repair_mount_holders ... preview` is read-only: it writes no
  retained `done` row and answers `audit: null`; each holder's `safe` and
  `reason` say what release would do. Docs, call help and worker op text
  updated.

Also removes PR dead code that failed `clippy -D warnings`: the unused
doctor `mount_holders` STORE/PROJECT/result/local/audit items, and unused
test helpers/imports (`future_ms`, `audit_items`, `branch_named`,
`HistoryError`) in the repair tests.

Tests: gc_calls, store_repair_live, store_repair_worker and
repair_postgresql now expect no preview rows (preview leaves gc_intent and
the audit unchanged); new half_created
`a_forced_remove_goes_on_when_its_tombstone_cannot_be_written`; new
layerfs-store `place_view_scope`. No test deleted.

Production LOC: 214081 -> 214030 (delta -51)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  control 62950 -> 62899; core, engine, api unchanged
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idence

PR #770 bumped the SQLite schema to version 3 (user_version 39-41/45-47)
to add two gc_intent columns, refused every base Store as SchemaVersion2 and
shipped an offline converter. The Store keeps the base format exactly now:

- gc.sql (SQLite and PostgreSQL), the user_version scheme (36-38/42-44),
  connection.rs, store/config.rs, both schema.rs checks (the kept_node
  migration no longer accepts the current source "for the authority
  migration") and the PostgreSQL schema diagnostic are back at fe9b4d1.
  SchemaVersion2 / SCHEMA_VERSION_2 and the POSTGRESQL_TABLES test export
  are gone.
- A live mount row keeps machine_incarnation / sandbox_generation in the
  existing evidence column as `place:v1;inc=<token>;gen=<token>` (absent
  part omitted, NULL when both absent). One helper pair in
  history/bindings.rs (place_evidence / place_tokens) serves the shared
  SQLite/PostgreSQL intent queries and the mount-holder diagnostic. NULL,
  a prefixless value (a done row's audit text) or a malformed value
  decodes as no token: missing evidence is no proof, never death.
- Done-row guards: the owner's release DELETE, the uncertain UPDATE and the
  insert's ON CONFLICT DO UPDATE skip `state = 'done'`. A registration
  whose op id is already a retained done row returns no row and is refused
  Conflict instead of reviving it.
- tools/store_gc_convert.py and its tests are deleted with every reference;
  the merge-forms-root.sqlite fixture (user_version 42) and the test hunks
  that only tracked the version bump are restored.

Deleted tests:
- layerfs-persistence tests/gc_conversion.rs (the_converted_store_opens_and_
  the_home_holds_the_old_authority, the_converted_store_serves_the_operator_
  audit, an_unconverted_machine_refuses_until_the_operator_declares_it_gone)
- layerfs-persistence tests/gc_schema.rs (whole file: version 3 columns,
  POSTGRESQL_TABLES, the version 2 refusal)
- layerfs-persistence tests/gc_intent_authority.rs (a_new_store_ships_the_
  intent_authority_columns, an_old_store_without_the_intent_authority_
  columns_is_refused)
- layerfs-persistence tests/sealed_open.rs::a_sealed_store_recorded_before_
  the_intent_authority_columns_is_malformed
- tools/test_store_gc_convert.py
Added: gc_intent_done.rs::place_tokens_round_trip_through_evidence_and_
live_statements_keep_a_done_row.

Production LOC: 214081 -> 214104 (delta +23)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`project_delete_store::main_resolves_to_the_branch_add_project_recorded`
(added in this PR) read `items[0].name`, but the main line's list row
names itself under `branch` (listing.rs `main_item`), so the test failed
at the PR head. Read the key the row has; the id assertion is unchanged.

Production LOC: 214,022 -> 214,022 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	core/docs/issues/project-41/lean-gap-closure.md
#	core/docs/issues/project-41/mount-authority-lease.md
#	docs/architecture/api/sdk/store.md
…ld not

Place tokens now name the home that minted them,
`p1:<home id>.<kind>:<ms>:<nonce>`, and `compare_place` orders two tokens
only when their labels match: on a Store two homes share, another home's
`box` incarnation, Sandbox generation or tombstone is Unordered (Uncertain at
worst), never Dead. A token with no home id is not ordered (equal only).
Machine incarnations (create, start) and Sandbox generations are minted with
the home id and a floor: at least one millisecond past the previous
incarnation, or past the name's previous record and tombstone, so a wall
clock stepped back never mints an older value. An equal Sandbox record with a
newer tombstone is Uncertain, not Dead; only the tombstone of that very
generation retires a live record.

The process-global MACHINE_INCARNATION fallback is removed: a mount intent
records only the incarnation its control caller read from the home. The
worker's own minted value (no host supplied one) carries no home id.

The owner (namespace/boot) check always applies first, as in the base; place
evidence only adds proofs of death. Mount registration no longer runs
`settle_place` (an unindexed gc_intent scan inside the write transaction);
settling stays in removal/compaction admission and the worker-start
reconcile. owner_boot is per Workspace, so UNIQUE(scope_kind, scope_id,
owner_boot) still admits every fresh mount, as in the base.

Mount rows record the project name (from a named bind, or the stack read once
for a bind by Branch id), so gc_intent_done_branch finds released rows.

Tests changed: settle-at-mount tests now prove the registration settles no
other row and the removal (given the place view) or reconcile settles it
(persistence admission.rs, gc_place_writers.rs, store-service admission.rs);
place_incarnation.rs proves no process-wide incarnation is filled in; test
tokens carry a home label (incl. control store_repair_live.rs and
mount_place_authority.rs). Added: different-home tokens/places never Dead
(history authority.rs, gc_place_view.rs, gc_place_writers.rs), minting floor
(layerfs-home ordered_token.rs, sandbox record_codec.rs), equal record with
newer tombstone is Uncertain, owner-dead with a current place is still
settled (Linux only), mount rows record the project. Removed dead
`future_ms` helpers and an orphaned doc block in touched test files.
No tests deleted.

Production LOC: 214,081 -> 214,096 (delta +15)
  core     42,466 -> 42,474 (+8)   layerfs-history +8
  engine   98,274 -> 98,249 (-25)  layerfs-persistence -24, layerfs-store-service -1
  control  62,950 -> 62,982 (+32)  layerfs-home +15, layerfs-sandbox +17, layerfs-machine +1, layerfs-control -1
  api      10,391 -> 10,391 (0)
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)
  Method: tools/production_loc.py --detail on parent ec99bf2 and the staged tree
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	control/crates/layerfs-control/tests/store_repair_live.rs
All four failed at the PR head (ec99bf2) too.

- postgresql_statement_schema: the admission split moved the session-lock
  reads into admission/session.rs but left their four statement-key
  constants in admission.rs, so the guard could not see the keys. Move the
  constants next to the code that reads them (no behaviour change).
- sdk_mount_lookup: read main's list row by the `branch` key the listing
  writes, not `name`.
- sqlite_compact_matrix:
  - a_live_or_uncertain_authority_keeps_the_compact_barrier: drop the
    "expired lease is uncertain" segment; lease expiry is deferred (#775)
    and nothing sets a lease.
  - a_dead_owner_is_adopted_before_the_compaction_runs: Linux only, like
    the other boot-evidence tests; no other platform can read a boot id.
  - remove the unused `future_ms` helper; regenerate the T12.3a report
    (admission suite count 10 -> 14).

Production LOC: 214,060 -> 214,060 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only files the PR changed against layerfs_v2_0_0; base files that drift
from rustfmt are left alone.

Production LOC: 214,060 -> 214,049 (delta -11)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n a shared Store

From an independent review of the pre-merge fixes:

- `compare_place` returns a new `PlaceOrder::Foreign` when the values
  cannot be related (minted by different homes, or one predates the
  ordering / names no home). Admission ignores a foreign comparison, so
  another home's live holder stays Live and is refused as `MountsActive`,
  as on the base, instead of `Unresolved` (which invited an operator
  release of a live holder). `Unordered` now means only two values of the
  same home in the same millisecond, which stays Uncertain.
- On a shared Store (PostgreSQL), a place proof is Uncertain, never Dead:
  two running copies of one home (a cloned home) mint tokens with the same
  home id, so the other copy's newer start does not prove this holder gone.
  The owner check and the operator settle/release are unchanged.
- The Sandbox generation floor is best effort: an unreadable earlier record
  or tombstone adds no floor instead of refusing the create.
- A bind by Branch id records no project when the stack read fails instead
  of failing the mount (the name only serves the audit).
- place_view.rs module doc names the calls that read the view.

Tests: authority, gc_place_view and gc_place_writers now expect foreign
values to leave the holder held and live (uncertain 0); same-home ordering,
restores and tombstones are unchanged.

Production LOC: 214,049 -> 214,060 (delta +11)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GC spec: rewrite the place-authority, place-writer, audit and repair
  bullets for the behaviour on this branch: owner evidence first; home-id
  tokens with a minting floor; foreign values are no evidence; a newer
  tombstone beside a live record is uncertain; no place-proved death on a
  shared Store; mount registration settles nothing; a failed tombstone write
  does not stop removal; list/preview/audit write nothing; the done-row
  guards. Remove the lease-renewal and preview-row text (lease, fence and
  the jsonl archive are deferred, #775).
- sdk/store.md: `safe` means "uncertain, release available", not a
  liveness verdict.

Production LOC: 214,060 -> 214,060 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…path

Gaps left after #783 (missing evidence stays "no proof", never death):

- Worker-route Sandboxes now record place evidence. `sandbox.create` sends
  the machine name and the generation the home record minted with the
  create (`Call::Create.place`, frame fields `place_machine`/`generation`);
  the worker writes them into its own record after the start
  (`files::save_place`, best effort, never over a record that has a
  generation), so `mount_place` there returns them and the daemon's bind
  records the generation token. A worker's root keeps no machine record, so
  its mounts still carry no incarnation (none is guessed).
- Every removal of a Sandbox's home record writes the retirement tombstone
  first, best effort, reporting a failed write in `left`:
  `sandbox.remove` on the forgotten, stopped, already-gone and unstarted
  paths and `forget` (`retire_home`, which writes the home's tombstone for
  a worker's Sandbox), `lifecycle::reclaim`, and the close's forget paths.
  A worker's root is not a home: `record::retire` writes nothing there.
- One tombstone per name: once a recreated Sandbox's started record is
  written, the name's older tombstone of the same home goes
  (`record::drop_retired`); the newer record proves the old generation's
  mounts dead by itself. A tombstone that is not older is kept.
- `machine.remove` keeps deleting `machine/<m>/` with its tombstones; it is
  refused while a Store or Sandbox uses the machine, and the decision is
  documented in `record/tombstone.rs`.

Tests: new `place_evidence` (worker place, no tombstone in a worker root,
recreate drops the older tombstone); `half_created` asserts the unstarted
removal's tombstone; `host_frame` round-trips a create with a place.

Production LOC: 214,060 -> 214,149 (delta +89)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and compaction parity

- An operator release that retains a `done` row now deletes the oldest done
  rows of the same scope (a mount's Branch) beyond the newest 100
  (`DONE_RETAINED`), in the release's transaction
  (`gc_intent_done_cap.sql`). No schema change: no index, table or column;
  the scope's rows are found through the existing
  UNIQUE (scope_kind, scope_id, owner_boot) index, and only `state = 'done'`
  rows are matched. `gc_intent_release_done` answers the row's scope.
- PostgreSQL `release_done` answers what the retain itself answered, so a
  second (or concurrent) release is `false`/`NotFound` as on SQLite, and
  only a row this release retained has its session keys released.
- PostgreSQL compaction no longer touches a retained done row: its
  `compaction_intent` read, the status read and both cleanup deletes filter
  `state <> 'done'`.

Tests: `gc_intent_done` gains a cap test (101 rows -> the newest 100 of the
Branch; another Branch's row stays).

Production LOC: 214,149 -> 214,167 (delta +18)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vers removed

Item 4, a real `safe` verdict:
- New read `HistoryCatalog::gc_liveness(intents)` (persistence:
  `admission::liveness`, store-service: `admission::liveness`): the owner
  check first, then the place view scoped on the thread, exactly as an
  admitting removal judges a conflict. One read transaction, no write.
- `list`/`preview` rows carry `liveness` (`live`, `uncertain`, `dead`) and
  `safe` = not `live`, instead of `safe = uncertain` and a prose `reason`.
- `settle` refuses a holder still `live` with `InUse` (fix: the same line
  with `--force`) unless `--force`, or `--legacy` for a row without evidence.
- A worker's `store.repair` is sent the calling home's place view and
  installs it, as Store calls do.

Item 6, the call surface (2.0 conventions):
- `store.repair_mount_holders(project, branch, action, { op, legacy, force,
  operator, limit, cursor })`: a `<store>/<project>` Project argument instead
  of a Store name plus a project name; `list`, `preview` and `audit` page by
  `limit` (1-1000, default 100) and `cursor` (carrying project, Branch and
  action) and answer `{ action, items, next_cursor }`; ops answer
  `{ action, op, state }` with state words.
- The repair moved out of `layerfs-store/src/service.rs` into
  `layerfs-store/src/repair.rs`: one `Repair` request (frame codec shared by
  the local and worker routes) replaces the ten-argument functions and their
  `too_many_arguments` allows; `control::store::repair` takes a
  `RepairRequest`.
- `project.mount_holders` appears in no doc or source (the doctor check is
  `store.mount_holders`), so nothing to drop or build.

Item 7, leftovers with no product caller:
- removed `gc_record_done`/`record_done`/`gc_intent_done_insert.sql`,
  `gc_prune_done`/`prune_done`/`gc_intent_done_delete.sql`,
  `Param::OptionalI64` and its binders, `admission::audit_value` (replaced by
  the per-row `done_value`), and the lease wording plus the unused `now_ms`
  argument of `PlaceAuthority::liveness` and `PlaceView`.

Docs: `store.md` section rewritten; GC spec place-writer, audit and repair
bullets; runbook audit line.

Tests deleted (they drove removed APIs): `gc_intent_done`
`preview_retains_a_done_row_without_an_operation` and
`a_prune_deletes_only_the_named_done_rows`. Tests changed: `gc_calls`,
`cli/gc`, `store_repair_worker`, `store_repair_live`, `repair_postgresql`
(new call shape; settle guard and cursor paging asserted), `authority`
(no `now_ms`). New: `gc_place_view` liveness test.

Production LOC: 214,167 -> 214,170 (delta +3)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`repair_postgresql` now creates its project with `project.init` (the
call-surface route) instead of `add_project`, so it writes the record shape
`store.connect` writes: the address alone plus a saved login. It asserts the
2.0 repair surface on PostgreSQL: rows at most `live` with `safe` false, a
settle of a live-looking holder refused `InUse` until forced, and a second
release `NotFound` as on SQLite. Run against a private postgres:17 server
(trust auth, amcheck).

Production LOC: 214,170 -> 214,170 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cord

`files::save_place` skipped a worker record that already named a
generation. A record an interrupted removal left behind (no daemon, so the
create proceeds and `save_sandbox` keeps its fields) could then name an
older generation than the home's new record: mounts would record that older
value, and the home's view would judge them retired (dead) while live,
worse than the base. The caller's machine and generation now replace any
other values; on `native` the record is the home's own and already names
them, so nothing is written.

Tests: `place_evidence` asserts an older leftover generation is replaced.

Production LOC: 214,170 -> 214,170 (delta 0)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The persistence page reports `has_more` whenever a page is full, so the
repair audit handed out a cursor to an empty page after a full last page.
The audit now reads one row at the next page's offset and names the next
page only when one follows. Caught by `gc_calls` on Linux.

Production LOC: 214,170 -> 214,181 (delta +11)
  scope: tools/production_loc.py (repo-pinned counter), first-parent tree vs committed tree
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(gc): close the lean place-authority gaps left after #783
@yifanxuaaa
yifanxuaaa merged commit 96f27a6 into layerfs_v2_0_0 Nov 24, 2026
@yifanxuaaa
yifanxuaaa deleted the claude/p4-lean-int branch November 24, 2026 10:11
yifanxuaaa added a commit that referenced this pull request Nov 24, 2026
…nect-attach

Conflicts, resolved keeping both sides:
- api store/mod.rs: upstream's new `repair_mount_holders` call is kept; this
  branch's removal of save_auth, remove_auth and update stands.
- layerfs-platform lib.rs and setup/mod.rs: the re-export lists keep both
  upstream's `provider_state` and this branch's `shares_loopback`.

Adapted to this branch's API: control/crates/layerfs-store/tests/repair_postgresql.rs
(added upstream) saves the password under the Store's name and records the
user in `StoreRecord::connected`, instead of a named saved login.

Production LOC: 211342 -> 213839 (delta +2497)
Scope and method: first-parent comparison (this branch's 2f81c3d vs the
merged tree) with tools/production_loc.py --root on `git archive` of the
parent and `git checkout-index -a` of the staged tree. The delta is
upstream's work merged in (#781 native boundary, #783, #784 and the other
layerfs_v2_0_0 commits since fe9b4d1), not new code on this branch.
Reference absent (retired R9c; last counted 65,417 at tree 498dd19).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant