Repository navigation
fix(persistence): a late release cannot delete a retained done row - #782
Open
mengmengmengqiang wants to merge 1 commit into
Open
mengmengmengqiang wants to merge 1 commit into
mengmengmengqiang wants to merge 1 commit into
Conversation
An operator settle+release keeps a mounted intent as the durable `done` audit row. When the original owner's BoundWorkspace::close later released the same op_id, SQLite's release DELETE matched on op_id alone and removed that retained row, breaking the add-only done-row invariant (Inv7). PostgreSQL never did: release reads the intent through the done-filtering `gc_intent_get` first, so the late release finds nothing. Filter `state <> 'done'` in the release DELETE, so a late release is a no-op that reports the same nothing-to-release outcome as a missing row rather than an error, and the audit row and its evidence stay untouched. Regression: a_late_release_cannot_delete_a_retained_done_row. Production LOC: 214081 -> 214081 (delta 0)
mengmengmengqiang
added a commit
to tokenaissance/layerfs
that referenced
this pull request
Nov 24, 2026
…wner fallback, H3/H4 and docs Ordered keeps the raw token (raw-first equality; two spellings of the same label/ms/nonce are .unordered); parseToken accepts only non-empty ASCII decimal digits below 2^64; ownerVerdict threads the Store kind (oldBoot is Dead only on a local SQLite Store) and the witness snapshots it; H3 is the existence form (a tombstone/incarnation may be replaced, never silently dropped) and H4 covers every map row; README documents H0/H2d/H-done-op-id/ H-no-prune, the corrected witness matrix, the actual LOC command and the Ephemeral-AI-Lab#782 dependency for Inv7. Examples gain raw-parse and auditWitness guards. Verified locally from the Branch: lake build green (0 warnings), 23 axiom receipts OK, step_preserves on [propext, Classical.choice, Quot.sound], no sorry/admit/axiom/native_decide.
mengmengmengqiang
added a commit
to tokenaissance/layerfs
that referenced
this pull request
Nov 24, 2026
…wner fallback, H3/H4 and docs Ordered keeps the raw token (raw-first equality; two spellings of the same label/ms/nonce are .unordered); parseToken accepts only non-empty ASCII decimal digits below 2^64; ownerVerdict threads the Store kind (oldBoot is Dead only on a local SQLite Store) and the witness snapshots it; H3 is the existence form (a tombstone/incarnation may be replaced, never silently dropped) and H4 covers every map row; README documents H0/H2d/H-done-op-id/ H-no-prune, the corrected witness matrix, the actual LOC command and the Ephemeral-AI-Lab#782 dependency for Inv7. Examples gain raw-parse and auditWitness guards. Verified locally from the Branch: lake build green (0 warnings), 23 axiom receipts OK, step_preserves on [propext, Classical.choice, Quot.sound], no sorry/admit/axiom/native_decide.
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.
Bug
An operator
settle+releasekeeps a mount row as the durabledoneaudit row (Inv7: done rows are only added, never removed).SQLite's release deleted by
op_idalone:So when the original owner's
BoundWorkspace::closelater released the sameop_id, it deleted the retaineddonerow and its audit evidence.PostgreSQL never did: its release reads the intent through
gc_intent_get, which filtersstate <> 'done', so the late release finds nothing to release.Fix
engine/crates/layerfs-persistence/sql/sqlite/queries/history/gc_intent_release.sql: addAND state <> 'done'to the release DELETE (the shared statement text PostgreSQL also runs).a_late_release_cannot_delete_a_retained_done_rowinengine/crates/layerfs-persistence/tests/gc_intent_done.rs, against the real SQLite catalog: register a mount, operator settle+release it todone, then the owner's lategc_release; assert the done row still exists with unchanged evidence, state andupdated_ms.Found during the review of #770.
Verification
cargo test -p layerfs-persistence --test gc_intent_done— 7 passed, 0 failedcargo test -p layerfs-store-service --test admission— 10 passed, 0 failedcargo check --offline --workspace --all-targets— pass (exit 0)cargo test -p layerfs-persistence(no-fail-fast): the same four suites fail on the base merge commit2f9cb974without this change (diagnostic_overwrite,kept_node_closure,postgresql_statement_schema,sqlite_compact_matrix); everything else passes.tools/production_loc.py --detail: 214081 -> 214081 (delta 0)