Repository navigation
mutation: keep applicability skips without the working-tree guard - #594
Merged
Merged
Conversation
An INDEX or COMMIT review never captures the working-tree source guard, so a tests-only or no-adapter skip failed as an invalid bound measurement even though nothing had been measured and nothing could have moved. Distinguish "the guard was never captured" from "the guard was captured and the source moved". Only the second is a reason to reject a skip. A WORKING review always supplies a verdict: when its guard cannot be captured, or the source drifts, the skip still fails closed, and measured kinds keep requiring a captured guard in every review kind. Signed-off-by: Minxi Hou <[email protected]>
HouMinXi
force-pushed
the
fix/mutation-skip-index-review
branch
from
November 27, 2026 02:14
43d13bc to
d2f9f26
Compare
The permissive branch was keyed on "not WORKING", which also caught an empty or snapshot baseline: those reviews have no target kind at all, and a tests-only skip there silently lost the bound failure that a missing subject must keep. Reserve the guardless path for an explicit INDEX or COMMIT baseline. A WORKING review still reports its guard, and every other subject reports False, so the skip stays rejected. The regression drives an empty-baseline review through L2 and expects the bound failure. Signed-off-by: Minxi Hou <[email protected]>
The branch comment claimed the guard was captured and the source moved, but the same refusal also covers a guard that could not be captured and a review with no git target. Say what the code actually rejects. Signed-off-by: Minxi Hou <[email protected]>
With the guard exemption in place, an INDEX or COMMIT review of a docs-listed name reached the document check, which read the working file. A reviewed blob that was an executable script passed whenever its working copy looked like a plain document, and the review skipped mutation with no measurement. Resolve the post-image from the index or the reviewed commit for those two targets; a path that cannot be resolved exactly once is not a document post-image, so the skip still fails closed. Signed-off-by: Minxi Hou <[email protected]>
The exemption added for INDEX and COMMIT reviews also reached the document check, which judges the working copy; an executable reviewed subject could be excused whenever its working file looked like a plain document, and an unresolved or drifted subject could be excused by an unrelated index entry. A review that cannot carry the guard may only excuse a diff whose paths prove it holds no product code. "No adapter covers this" is a claim about product code and still needs the captured guard, and document applicability is never evaluated without one. That restores fail-closed behaviour for those cases while keeping the tests-only skip that motivated the change. Signed-off-by: Minxi Hou <[email protected]>
The tests-only exemption asked the submitted path list whether the change held product code. Git pathspec expansion, a rename destination and a literal backslash filename each let a real product change look like a test change, and the missing-mutmut factory reached the same decision without going through the classifier at all. Decide it from the captured diff instead: every path on either side of the diff, both rename sides included, must be a test path, and a backslash stays a filename rather than becoming a directory. The factory path uses the same predicate, so the invariant no longer depends on which runner is installed. Signed-off-by: Minxi Hou <[email protected]>
The guardless arm repeated the whole not-applicable bookkeeping and computed inputs it never read, the scope helper normalized and re-checked emptiness that the delegated predicate already handles, and a new assertion never reached the inventory check it claimed to cover because the path proof was missing. Derive only the verdict and reason in the guardless arm and share the tail, delegate path validation to the existing predicate after the backslash check, and pass the path proof in the evidence assertions. Drop the wrapper-only test for a production helper that no caller uses. Signed-off-by: Minxi Hou <[email protected]>
The tests exercised the classifier directly, so nothing recorded what the missing-mutmut factory does with the same review. Pin the observable outcome: it reports availability, stays clean for a tests-only diff, and never turns a guardless review into a document exemption. Signed-off-by: Minxi Hou <[email protected]>
Deciding applicability from the working copy or the live index describes a different object than the one under review: the file can change between capture and the check. Established practice for both problems is the same — pin the decision to an immutable, content-addressed object. Capture the reviewed subject as a git tree when the baseline resolves (an index tree, or the commit tree), and read document mode and content from it by literal path. A review without a tree — an unmerged index, a missing head — is not an exemption. This restores the documentation skip for INDEX and COMMIT reviews without trusting bytes no one reviewed. Signed-off-by: Minxi Hou <[email protected]>
The index was frozen after the diff had already been read, so a concurrent staging operation could leave the review holding one subject in its diff and another in its tree. Freeze first, then produce the diff from that exact tree. The diff also honoured local replacement refs while the tree lookup ignored them, which let the two views describe different commits. Use one policy: no replacement objects for the review diff either. git write-tree refreshes the index cache-tree extension, so it now runs against a private copy of the index; a review must not rewrite the file the caller is working with. Signed-off-by: Minxi Hou <[email protected]>
A split index stores its base in the object directory, and write-tree may replace and expire that base; running against a copied index still let Git maintain it, so the user index could be left pointing at a deleted file. Convert the private copy to a plain index and keep split support off while the subject is captured. Revision expressions resolved through replacement refs, so HEAD^ could name a different parent than the diff and tree reads, which ignore replacements. Use one policy for revision resolution too, and give the remaining diff callers the same flag so a review never mixes the two views. Signed-off-by: Minxi Hou <[email protected]>
HouMinXi
force-pushed
the
fix/mutation-skip-index-review
branch
from
November 27, 2026 08:32
e43a5e5 to
59390b8
Compare
The review diff was switched to ignore replacement refs while the repository resolves baseline refs through them on purpose. Making the diff ignore them broke that contract and left the two views disagreeing in the other direction: a replaced head produced a benign diff and an executable tree. Keep the repository policy and read every view the same way. The diff, the frozen tree and the document check now all describe the replaced object, so a replaced executable document is rejected instead of excused. Signed-off-by: Minxi Hou <[email protected]>
HouMinXi
force-pushed
the
fix/mutation-skip-index-review
branch
from
November 27, 2026 09:04
c32b0d3 to
fcb7d53
Compare
When the index could not be frozen the review fell back to the live cached diff, and the tests-only exemption accepted it anyway: the exemption then rested on a subject nobody had pinned, which is what this change exists to prevent. Require the frozen tree for both guardless exemptions, and apply the same policy when the mutation engine is missing instead of letting a skip pass unexamined. Signed-off-by: Minxi Hou <[email protected]>
The package-marker check treated any non-zero ls-tree exit as "no __init__.py here", so a fatal Git error opened the document exemption that a found marker or a timeout would refuse. Only a successful query with an empty answer means the path is absent; report an errored query as present so the exemption is refused. Signed-off-by: Minxi Hou <[email protected]>
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.
An INDEX or COMMIT review never captures the working-tree source guard. A
tests-only skip was therefore classified as an invalid bound measurement, and the
review failed even though nothing had been measured and nothing could have moved.
Pinning the reviewed subject
Applicability has to describe the object under review, not a file that can change
after capture. The resolver now records the reviewed subject as a git tree — the
index tree for an INDEX review, the commit tree for a COMMIT review — and every
applicability read uses that tree by literal path. A review without a tree (an
unmerged index, a missing head) is not an exemption.
This is the immutable-object rule from the CI time-of-check/time-of-use
literature combined with git's own tree semantics. The diff-scoped part follows
mutation testing practice: the scope claim comes from the captured diff, not from
a caller-supplied path list.
What the classifier does now
source_unchangedis three-valued:True: the guard was captured and still matches. Skips are trusted as before.False: the guard was captured and moved, could not be captured, or the reviewhas no git target. Skips are rejected, as before.
None: an explicit INDEX or COMMIT baseline, which cannot carry the guard.Under
None, a skip is excused only when the captured diff proves the scope:every path on either side (rename sources included) is a test path, or every path
is on the document allowlist and the pinned tree shows a plain, non-executable,
non-shebang document whose package ancestors carry no
__init__.py. A backslashstays a literal filename instead of becoming a directory. Measured skip kinds
need a captured guard in every review kind, and the missing-mutmut factory route
uses the same predicate so the outcome no longer depends on which runner is
installed.
Manifest
The new public test nodes are registered in
scripts/ci_public_test_identities.json,which the Linux CI plan requires to be exact.
Tests
tests/test_mutation_ledger_ci_controls.py: 529 pass.Counterexamples exercised on this candidate:
COMMIT;