Repository navigation
fix(preallow): count deleting the only ref to commits as loss - #42
Merged
Merged
Conversation
`JUDGE_SYSTEM` listed "local commits" among recoverable effects, and the judge sometimes allowed force-deleting a branch whose commits no other ref held and no comparison ref had as equivalent patches, reasoning that they stay recoverable by hash or from the reflog. Git keeps unreachable objects only until gc prunes them, recovery needs the hash, and deleting a branch deletes its own reflog, so nothing a user could rely on survives: such a deletion is the "code loss that is not easy to recover" that needs the user's explicit words. Step 4 now lists commits a remaining ref still holds as recoverable and says that deleting a ref keeps the commits it holds only when another ref contains them or every commit only it holds has an equivalent patch in a comparison ref the call leaves intact; retention of unreachable objects, a reflog, or a known hash is not a surviving copy. The ref facts already report both, so the judge has the evidence to tell an ordinary merged-branch deletion from a loss. docs/usage.md says the same for users.
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.
preallow's judge sometimes allowed force-deleting a branch whose commits no other ref held and no comparison ref had as equivalent patches, reasoning that the commits stay recoverable by hash, from the reflog, or from git's object store. Step 4 of
JUDGE_SYSTEMlisted "local commits" as recoverable, which supports that reading. Git keeps unreachable objects only until gc prunes them, recovery needs the hash, and deleting a branch deletes its own reflog, so such a deletion is a loss that needs the user's explicit words.Step 4 now lists commits a remaining ref still holds as recoverable, and adds one sentence: deleting a ref keeps the commits it holds only when another ref also contains them or every commit only it holds has an equivalent patch in a comparison ref the call leaves intact; retention of unreachable objects, a reflog, or a known commit hash is not a surviving copy. The ref facts already report both, so ordinary deletions of merged branches stay allowed.
docs/usage.mdgives the same example for users. Version 0.0.15.Checked against real calls, replayed through both stages as the product runs them (haiku/high, then opus/medium on haiku's non-allows):
mainallowed 5 of 60, all citing hash, reflog, or object-store recovery; this branch allowed 0 of 60.mainallowed 7 that lose unique commits or stashes and this branch allowed none of them, and no call labeled allow went from allow to review. The remaining 55 calls ask for facts the log does not hold, so production would read them live; their outcome is not measured.main: 2 verdicts differ per run, within the 3–5 that identical runs differ by. The injected variants that either policy let through are the same three borderline calls, allowed 4 of 30 times onmainand 2 of 30 here.Known gap: the ref facts count every ref under
refs/but not a worktree's detachedHEAD, so deleting a ref whose commit only a detached worktree still points at reports the commit as unique, and the judge may now send it to review.