Skip to content

fix(store): review follow-ups to #751 project-record repair - #755

Merged
yifanxuaaa merged 1 commit into
layerfs_v2_0_0from
fix/751-review-followups
Nov 22, 2026
Merged

yifanxuaaa merged 1 commit into
layerfs_v2_0_0from
fix/751-review-followups

Conversation

@yifanxuaaa

Copy link
Copy Markdown
Contributor

Tier: P1 (control/crates/layerfs-store) ; risks: risk:store ; gate: yes: risk:store ; de-escalated: none

Follow-up to #751 (merged as fae5488566); refs #749.

Reason

Review of #751 found these problems in its project-record repair:

  • project doctor failed project.record for SQLite projects whose Store is still on its worker. Those projects work: the worker's Sandboxes read the entry the worker keeps (route::in_worker merges the host record into it and keeps its manifest).
  • A failed project.record skipped project.listed and the --full data walk, so an incomplete record hid every other problem with the project.
  • In sandbox.create, any repair error (Unsupported from the kernel guard, Unavailable from the diagnostic open, home-lock expiry) replaced the original NoSuchProject refusal.
  • sandbox.create repaired only when the refusal had one exact message, so a record with no installed, or with manifest bytes that do not decode, was never repaired. After a repair it also read the project a second time.
  • store.move dropped every repair result (let _ =): a record it could not rebuild left no trace before the worker's copy was retired.
  • init_on_worker silently kept the stub when the worker's manifests did not decode, and accepted a non-Disposable pair.
  • The restore listing loop was copied into projects_in_diagnostic.

What changed

  • Doctor (doctor/project_target.rs): a complete record is required only when the Store's calls run in this process (place::on_machine_read gives Local). project.listed and project.data run whatever project.record finds.
  • Sandbox create (layerfs-sandbox/src/lifecycle.rs): repair is attempted when the record has no installed, or the refusal is NoSuchProject or Failed. repair_project re-checks the record with restored::complete. The repair is best effort: if it fails or does not complete the record, the call's own refusal is returned. The record it writes is decoded in hand by the new discovery::project_of, with no second read.
  • Store move (sqlite/transfer/phases.rs): complete_existing now returns each record it left incomplete, with why. Each one is a line of log/repair.jsonl, and the move still finishes.
  • Worker init (project/family.rs): the worker's pair is kept only when restored::complete accepts it. Otherwise it is left out and logged in log/repair.jsonl, and an older worker that sends none is still accepted.
  • Shared scan (backup/restored.rs, backup/restore.rs): restored::found_in(&dyn HistoryCatalog) is the one project/main listing for both restore and repair.
  • Architecture docs: doctor, home (the new repair log), sandboxes, projects, sqlite-and-postgresql.

Tests

  • doctor_targets: project.listed still runs after a project.record failure.
  • project_family: store.move logs a record of a stack the Store does not hold in log/repair.jsonl, and does not log a repaired one.
  • installed_repair: no longer requires sandbox create to fail; a Sandbox it does start is removed.
  • restored_records: follows repair_project's new return (the written record).
  • No tests deleted.

Verification (macOS, Apple Silicon, b07327ba1f)

Built with --no-run first, then each binary run under TMPDIR=/tmp with a 120 s limit. All passed:

Suite Passed
restored_records 7
installed_repair 1
doctor_targets 7
project_family 7
backup_family 5
project_doctor_full 3
project_init_worker 7
store_family 5 (1 ignored)
store_transfer_crash 6
layerfs-control doctor 12
project_delete_worker 14
store_transfer_recovery 4
restore_install 3
  • cargo +1.85.1 clippy --locked --all-targets -p layerfs-store -p layerfs-sandbox -p layerfs-control -p layerfs-api -- -D warnings: pass.
  • cargo +1.85.1 fmt --all -- --check: clean for this change. api/crates/layerfs-cli/tests/rendering.rs already fails it on the base and is left alone.
  • python3 -B tools/check_product_boundary.py: PASS.
  • Not run:
    • A doctor of a project whose Store is on a ready worker machine. The doctor checks such a project only while its machine probes ready, which needs a running VM.
    • A restore from a bucket through found_in.
    • Linux.
  • Durable: NOT_RUN — disabled by owner until explicit reauthorization.

Production LOC

Production LOC: 206,108 -> 206,163 (delta +55)

Scope Before After Delta
core 40,988 40,988 0
engine 95,845 95,845 0
control 58,950 59,005 +55 (layerfs-store +48, layerfs-control +8, layerfs-sandbox -1)
api 10,325 10,325 0

Reference absent (retired R9c; last counted 65,417 at tree 498dd1917812). Method: tools/production_loc.py --detail on parent fae5488566 and the staged tree.

🤖 Generated with Claude Code

Review of #751 (merged as fae5488) found these; each is fixed here.

- project doctor: a SQLite project's record must be complete only where
  this process runs the Store's calls. A worker's Sandboxes read the
  entry that worker keeps, so a host stub there is not a project.record
  fault. A failed project.record no longer skips project.listed or the
  --full project.data walk.
- sandbox.create: the repair is decided by the record (no manifest, no
  installed, or bytes that do not decode), not by one refusal message,
  and is best effort: a repair that fails or cannot complete the record
  leaves the call's own refusal as it was. The repaired record is decoded
  in hand (discovery::project_of) instead of reading the entry again.
- store.move: a record the record phase leaves incomplete is a line of
  log/repair.jsonl (call, store, project, why) instead of a silent drop.
- project.init on a worker: a manifest/installed pair that is not a
  complete Disposable pair (restored::complete) is left out and logged in
  log/repair.jsonl, for a move or Sandbox create to complete.
- restore and record repair share one Store scan, restored::found_in.

Tests: doctor_targets checks project.listed still runs after a
project.record failure; project_family checks store.move logs a record it
cannot rebuild; installed_repair removes a Sandbox it did start instead of
requiring create to fail; restored_records follows repair_project's new
return (the written record). No tests deleted.
Ran (TMPDIR=/tmp, 120 s limit each): restored_records 7, installed_repair
1, doctor_targets 7, project_family 7, backup_family 5, project_doctor_full
3, project_init_worker 7, store_family 5 (1 ignored), store_transfer_crash
6, layerfs-control doctor 12, project_delete_worker 14,
store_transfer_recovery 4, restore_install 3: all pass. fmt, Clippy
(-D warnings) on layerfs-store/-sandbox/-control/-api and the product
boundary guard pass. Not run: a doctor of a project whose Store is on a
ready worker machine (needs a running VM), a restore from a bucket.
Docs: doctor, home, sandboxes, projects, sqlite-and-postgresql.
Durable: NOT_RUN — disabled by owner until explicit reauthorization.

Production LOC: 206,108 -> 206,163 (delta +55)
  core     40,988 -> 40,988 (0)
  engine   95,845 -> 95,845 (0)
  control  58,950 -> 59,005 (+55)  layerfs-store +48, layerfs-control +8, layerfs-sandbox -1
  api      10,325 -> 10,325 (0)
  reference absent (retired R9c; last counted 65,417 at tree 498dd19)
  Method: tools/production_loc.py --detail on parent fae5488 and the staged tree

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yifanxuaaa
yifanxuaaa merged commit 2f6718e into layerfs_v2_0_0 Nov 22, 2026
2 checks passed
@yifanxuaaa
yifanxuaaa deleted the fix/751-review-followups branch November 22, 2026 18:17
yifanxuaaa added a commit that referenced this pull request Nov 22, 2026
…rol-plane fixes)

Brings in the six origin commits (#751, #754, #755 and the store.move manifest repairs) beside the local LF14 commit 712f4d0.

Production LOC: 205907 -> 206226 (delta +319); first-parent comparison (parent 712f4d0 vs the merged tree), counted with tools/production_loc.py --root on git archive extracts of both snapshots; control scope 58808 -> 59068 (delta +260). 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