Repository navigation
fix(gc): close the lean place-authority gaps left after #783 - #784
Merged
Merged
Conversation
…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>
yifanxuaaa
marked this pull request as ready for review
November 24, 2026 10:09
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>
This was referenced Nov 24, 2026
yifanxuaaa
added a commit
that referenced
this pull request
Nov 24, 2026
fix(gc): #784 review fixes: tombstones only on confirmed stop, PostgreSQL release once, keyset audit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the remaining gaps in the lean GC place authority after #783. The rule throughout: nothing is worse than the base; missing evidence is never death.
Stacked on #783 (base
claude/p4-lean-int). Once #783 merges intolayerfs_v2_0_0, this PR is rebased onto it and retargeted.Items
sandbox.createsends the home-minted machine name and generation (Call::Create.place). The worker writes them into its own record (files::save_place; the caller's values always win over a leftover record), so worker mounts record the generation token. A worker root has no machine record, so no incarnation is recorded or guessed.sandbox.removewrites it best-effort before the home record goes, on the stopped, forgotten, already-gone and unstarted paths and inforget; this covers worker Sandboxes too. So dolifecycle::reclaimand the close's forget paths. A failed write is reported inleft. A worker root is no home and gets no tombstone.machine.removestill deletesmachine/<m>/and its tombstones: it is refused while the machine is in use, and this is documented.drop_retired). An operator release keeps at most the newest 100donerows per Branch, throughgc_intent_done_cap.sql. There is no schema change: the existingUNIQUE (scope_kind, scope_id, owner_boot)index finds the rows.HistoryCatalog::gc_liveness: the owner check, then the scoped place view, as admission judges.list/previewrows carryliveness(live/uncertain/dead) andsafe(notlive).settlerefuses aliveholder withInUseunless--force(or--legacy). A worker's repair is sent the home's place view.release_doneanswers the retain's own result, so a second release isNotFound. PG compaction reads and deletes filterstate <> 'done'.repair_postgresqlnow sets up throughproject.init.store.repair_mount_holders(project, branch, action, { op, legacy, force, operator, limit, cursor })takes a<store>/<project>argument and pages bylimit/cursor→{ action, items, next_cursor }. Ops answer state words ({ action, op, state }), and the prosereasonis gone. The logic moved tolayerfs-store/src/repair.rswith oneRepairrequest shared by the local and worker routes.project.mount_holdersis not mentioned in any doc or source, so nothing to build or drop.gc_record_done/record_done/gc_intent_done_insert.sql,gc_prune_done/prune_done/gc_intent_done_delete.sql,Param::OptionalI64,audit_value, and the lease wording plus the unusednow_msinPlaceAuthority::liveness.Deleted tests (they drove removed APIs):
gc_intent_done::preview_retains_a_done_row_without_an_operation,gc_intent_done::a_prune_deletes_only_the_named_done_rows.Verification
cargo +1.85.1 clippy --workspace --all-targets -- -D warnings: clean on macOS. Linux clippy did not run: the pinned Linux build image has no clippy component. Linux code was compile-checked by the Linux test build.place_evidence,host_frame,record_codec,half_created; historyauthority; persistencegc_intent_done,gc_place_view,gc_place_writers,admission,sqlite_compact_done,visibility_guard,semantic_admission,writer_admission,gc_backfill; store-serviceadmission,place_incarnation; cligc. All pass.postgresql_gc_fence,_gc_mark,_gc_mark_edges,_status,_acquisition_compaction,_compact,_diagnostic, and storerepair_postgresql. All pass.tools/worktree.pyin Docker: apigc_calls, controlstore_repair_worker,store_repair_live,mount_place_authority, sandboxplace_evidence,half_created. All pass (gc_callscaught the audit-cursor bug fixed in 1b17dbb).main, so it did not run here.Production LOC: 214,060 -> 214,181 (delta +121) across six commits; each commit records its own line.
🤖 Generated with Claude Code