Minimal failing cases for the traversal dedup (for #511) - #516
Merged
jtmaxwell3 merged 1 commit intoSep 21, 2026
Merged
Conversation
Two hand-built cases distilled from a 20,000-case differential fuzz (TraversalDedupDifferentialFuzzTests) comparing this branch against master. Both fail here and pass on master: - NondeterministicTraversal_DedupOnVariableBindingLosesMatch: an anchored high=$v0+ match disappears entirely because two instances reach the same (State, AnnotationIndex) with different VariableBindings, and the surviving one can never complete. - DeterministicTraversal_DedupOnRegistersShortensMatch: an alternation match is shortened because two lineages converge on the same (State, AnnotationIndex) with different open-group registers, and the surviving lineage completes earlier than the correct one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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 two minimal cases you asked for, as unit tests on top of
add-allMatches-to-Traverse. Both fail on this branch and pass on master — that is intentional; they are here so the failure is inspectable, not to be made green by weakening them.Each asserts master's behaviour rather than snapshotting the branch's, and each carries a comment explaining what the traversal does differently, since you wanted to see why they fail.
NondeterministicTraversal_DedupOnVariableBindingLosesMatch— patternhigh=$v0+, anchored both ends, 5 annotations. The variable makesMatcher.Compileskip determinization, so this runsNondeterministicFsaTraversalMethod. Covering[0,5)needs the run ofhigh-annotations under a single consistentv0. A parallel instance consumes thehigh+annotation[0,1), bindsv0=+, and dead-ends because nothing starts at offset 1. Both reach the same(State, AnnotationIndex)with differentVariableBindings, so the skip can retain the one that can never complete.DeterministicTraversal_DedupOnRegistersShortensMatch— pattern(g0(back=back+)|g1(high=high+ back=back+)), anchored to start, no variables, so this one is determinized (IsDeterministic=True, two groups). Annotation[0,2)satisfies both alternatives' first constraint, so two lineages consume it: one has closedg0, the other still hasg1open. They converge on the same(State, AnnotationIndex)with different open-group registers.This second one is the case I'd flag hardest: it is variable-free and on the deterministic path, and it shortens the match range, not just the captures. So a guard of "deterministic method only" would not be sufficient.
Both cases came out of a 20,000-case differential fuzz (fuzz cases 4447 and 15319); I rebuilt them by hand from the recorded annotations rather than depending on the generator.
AllMatches().First()was identical between master and this branch in all 20,000 cases, which is what isolates the divergence to theallMatches=falsepath.Full
SIL.Machine.Testson this branch: 826 passed, 2 failed (these), 3 skipped — no other regressions.On a better fix: gating the skip on the deterministic method and the absence of capture groups (
!allMatches && Fst.GroupNames.Count() <= 1), withNondeterministicFsaTraversalMethodleft as master has it, takes the fuzz to 0 divergences while keeping your instance-count bound cell-for-cell identical on group-free patterns. Whether that is good enough depends on whether the matcher that was hot for you has capture groups — I am measuring that on a build withchange-add-to-priority-unionandfilter-final-templates-in-analysisincluded, now that I know that is what you measured against.🤖 Generated with Claude Code
This change is