Reject unclosed delimiters, quoted-string abutment, and nested comment imbalance#64
Open
mmucklo wants to merge 1 commit into
Open
Reject unclosed delimiters, quoted-string abutment, and nested comment imbalance#64mmucklo wants to merge 1 commit into
mmucklo wants to merge 1 commit into
Conversation
…t imbalance
Structural over-acceptance fixes surfaced by gold-standard differential testing
(dominicsayers/isemail corpus). Reduces the corpus false-accept set from 29 to 26.
- Unclosed domain literal (test@[1.2.3.4) is rejected — the end-of-input
unterminated-delimiter check is keyed on parser state rather than quote_temp,
so unclosed brackets, comments, and obs-routes are all caught.
- Unbalanced nested comment (((comment)test@) is rejected — a leading comment
now opens at nest level 1, matching the in-address entry.
- atext or a second quote abutting a quoted-string ("test"test@, "test""test"@)
is rejected via a new AtextAfterQuotedString error code; "word".atom stays valid.
Control-char-in-domain was already rejected (a corpus encoding artifact). The
remaining CR/LF-whitespace and trailing-root-dot divergences are deliberate
design choices, tracked in ROADMAP for a decision. 94 -> 95 tests.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #64 +/- ##
============================================
+ Coverage 92.87% 93.64% +0.77%
- Complexity 381 385 +4
============================================
Files 6 6
Lines 983 992 +9
============================================
+ Hits 913 929 +16
+ Misses 70 63 -7
🚀 New features to boost your workflow:
|
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.
Structural over-acceptance fixes surfaced by gold-standard differential testing (dominicsayers/isemail 164-case corpus). Reduces the corpus false-accept set 29 → 26.
Fixed
test@[1.2.3.4(no]) now rejected (UnterminatedSquareBracket). The end-of-input unterminated-delimiter check is keyed on parser state rather thanquote_temp, so unclosed brackets, comments, and obs-routes are all caught.((comment)test@…is no longer treated as closed after a single)."test"test@…and"test""test"@…now rejected via a newAtextAfterQuotedStringcode; a quoted-string is a whole word (RFC 5322 §3.2.4)."word".atom(obsword "." word) stays valid.Control-char-in-domain was already rejected — that corpus "miss" was an artifact of the Unicode Control-Pictures encoding the corpus uses for control chars.
Verification
94 → 95 tests; PHPStan level 8 / Psalm / cs clean. New
testStructuralOverAcceptanceRejectionscovers every fixed case plus the well-formed neighbours that must stay valid.Remaining (tracked in ROADMAP, not in this PR)
(comment\)test@) and atext directly after a mid-local-part comment (test(comment)test@).