Add boundary tests for MaxDeleteGuard trigger threshold - #119
Merged
Conversation
in-jun
commented
Jul 18, 2026
in-jun
left a comment
Owner
Author
There was a problem hiding this comment.
Verified against MaxDeleteGuard.evaluate (the deletions < minDeletionsToTrigger short-circuit at line 30). The two new tests pin exactly the gap issue #96 called out:
exactly the trigger count over threshold aborts— 5 of 6 (83%) withminDeletionsToTrigger = 5. Flipping<to<=makes5 <= 5short-circuit tonull, so the abort disappears and this test fails. Thedeletions/total/sideassertions match theAbortfields precisely.one below the trigger count is allowed even over threshold— 4 of 5 (80%) staysOk, pinning the allowed side of the boundary. The pre-existing 5-of-10 case only ever exercised the fraction check (50% is filtered byfraction <= thresholdregardless of the trigger comparison), which is exactly why it couldn't catch this.
Ran the class locally on JDK 21 — all 6 tests pass. Additive and test-only, no production changes. Comments are accurate. Looks good.
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.
The existing suite never pinned the exact
minDeletionsToTriggerboundary: the closest case (5 of 10 = 50%) is filtered out by the fraction check rather than the trigger comparison, so a regression flipping<to<=(or back) would go unnoticed.minDeletionsToTriggerdeletions above the fraction threshold (5 of 6 = 83%) aborts, and a companion test that one below the count (4 of 5 = 80%) is allowed — together they pin both sides of the strict<boundary.Fixes #96