Compare string-literal operands by raw text, not masked text (#31)#32
Merged
Merged
Conversation
The #28 masking fix (bd22350) blanked string content to spaces in the text the regex lanes match on. Two lanes compare string-literal values textually, and masking collapses distinct same-length literals into identical text ("a" and "b" both become " "), breaking value-equality reasoning both ways: a spurious rule.neverFires on satisfiable requires pairs ("a" vs != "b"), and missed genuine contradictions ("aa" = "bb" no longer flagged by neverFires or impossibleWhen). Detection stays on masked text; when a captured operand starts with a quote, findNeverFireRuleIssues and findSurfaceImpossibleWhenIssues now re-read the operand from the raw source at the same offsets via rawStringOperand — the mask preserves length and offsets, and the value group is anchored at the end of each match. Found by post-merge adversarial review of #29. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Closes #31. Fixes the regression introduced by #29 (the #28 masking fix), found by post-merge adversarial review.
Problem
#29 made the regex lanes match on a masked view of the source where string content is blanked to spaces. Two lanes compare string-literal values textually, and masking collapses distinct same-length literals into identical text (
"a"and"b"both become" "):requires: order.state = "a"+requires: order.state != "b"(satisfiable) emitted a spuriousallium.rule.neverFires— a TS-only warningallium checknever emits, i.e. the parity class TypeScript regex lanes lack comment/string awareness (false positives on keyword-shaped text) #28 was about, reintroduced via a different lane.= "aa"+= "bb"(genuine contradiction) was no longer flagged byrule.neverFires, andwhen mode = "aa" and mode = "bb"no longer flagged bysurface.impossibleWhen.Fix
Detection stays on masked text. When a captured operand starts with
",findNeverFireRuleIssuesandfindSurfaceImpossibleWhenIssuesre-read the operand's text from the raw source at the same offsets via a newrawStringOperandhelper — the mask preserves length and offsets, and the value group is anchored at the end of each match, so its raw position ismatchStart + matchLength − valueLength.Tests
Four new regression tests covering all three confirmed reproducers plus a distinct-expressions control. All workspaces green (313 extension + 8 LSP),
npm run lintclean. Also re-verified the three reproducers directly against the builtdist.🤖 Generated with Claude Code