Repository navigation
test+fix(#6959): close single-quote attr gap + 13 regression tests for the canonical detector - #6970
Merged
Merged
Conversation
The canonical detector (#6959) only matched double-quoted SVG coordinate attributes (points="...", cx="..."). Single-quoted attrs are equally valid SVG, and some C# builders emit them: MGS-15 (#6960) uses <circle cx='{px:F1}'> -> cx='170,9' (single-quote). A decimal-comma bug in a single-quoted coord would BYPASS the #6965 CI gate entirely. Fix: _POINTS_RE and _COORD_ATTR_RE now accept either quote via a backreference ((["'])(.*?)\1), consumers read group(2) (the value). Minimal (9+/5- on the detector). Confirmed firsthand: single-quote cx='170,9' and points='70,0,334,4' now detected; double-quote unchanged. Add scripts/tests/test_detect_svg_decimal_commas.py (13 tests) covering the canonical API (detect_svg / detect_cell / scan_notebook): the two bug signatures, the Graphviz legit-integer NON-FP case, list-blob handling, file-level scan + error path. These tests revealed the single-quote gap (failing pre-fix), now green -- they lock both the detection and the fix. Repo-wide re-scan post-fix: 0 defects (0 new false positives -- clean SVGs use decimal-dot in either quote style, Graphviz uses double-quote + integer coords). Follows ai-01's close-as-duplicate guidance on #6968 ('reopen as a targeted PR testing the plural canonical detector'). Co-Authored-By: Claude-Code <noreply@anthropic.com>
jsboige
added a commit
that referenced
this pull request
Jul 17, 2026
…g.py (#6799 canon) 34 deterministic tests covering scan_notebook, _STRIP_RE, _build_regex, _src_lines, ACCENT_PAIRS dictionary self-consistency, and main() exit codes. Mirror pattern of test_detect_svg_empty_display.py (L633-L1* canon: defense-in-depth tests for cluster detectors in #6927 chain) and test_detect_solution_leaks.py (existing sibling). Why a test file for a one-shot detector? - 5 detectors in scripts/notebook_tools/ lack direct unit tests: detect_accent_stripping.py (this PR), detect_blank_figures.py, detect_ascii_workaround.py, detect_solution_leaks.py (HAS tests), detect_svg_decimal_commas.py (PR #6970 in flight). - Detector is core to registre #2876 (accents FR); ~22 PRs accumulated since 2026-03 on manual restoration. A test suite locks the detection contract so future dictionary edits don't regress the zero-FP discipline (G.1 c.539: dictionary excludes ~22 words that would otherwise generate mass false positives: complete, ou, la, valeur, niveau, exemple, fonction, etc.). Coverage: - TestSrcLines (7): nbformat source-as-str vs source-as-list semantics - TestStripRegex (8): boundary, case-insensitive, plural-first, FP-proneness, accented-form idempotency, _build_regex repeatability - TestScanNotebook (8): clean / md-stripped / code-stripped / multi-hit / multi-line / multi-cell / nbformat-list / unreadable - TestAccentPairs (6): dictionary hygiene (lowercase keys, unique, suggestions differ from keys, accents present, FP-prone excluded) - TestMainExitCodes (5): --check exit 0/1, missing file exit 2, non-check mode exit 0, --json valid output Verification: - 34/34 PASS in 0.23s - Full test suite: 2200 PASS (was 2166, +34), zero regressions Closes gap in test coverage for partition-mienne OWNDOC (#2876 / #3801 axe-2 SOTA enforcement). See #6971 (companion detector tests, same canon) for parallel precedent. Co-Authored-By: Claude-Code <noreply@anthropic.com>
jsboige
added a commit
that referenced
this pull request
Jul 17, 2026
…g.py (#6799 canon) (#6973) 34 deterministic tests covering scan_notebook, _STRIP_RE, _build_regex, _src_lines, ACCENT_PAIRS dictionary self-consistency, and main() exit codes. Mirror pattern of test_detect_svg_empty_display.py (L633-L1* canon: defense-in-depth tests for cluster detectors in #6927 chain) and test_detect_solution_leaks.py (existing sibling). Why a test file for a one-shot detector? - 5 detectors in scripts/notebook_tools/ lack direct unit tests: detect_accent_stripping.py (this PR), detect_blank_figures.py, detect_ascii_workaround.py, detect_solution_leaks.py (HAS tests), detect_svg_decimal_commas.py (PR #6970 in flight). - Detector is core to registre #2876 (accents FR); ~22 PRs accumulated since 2026-03 on manual restoration. A test suite locks the detection contract so future dictionary edits don't regress the zero-FP discipline (G.1 c.539: dictionary excludes ~22 words that would otherwise generate mass false positives: complete, ou, la, valeur, niveau, exemple, fonction, etc.). Coverage: - TestSrcLines (7): nbformat source-as-str vs source-as-list semantics - TestStripRegex (8): boundary, case-insensitive, plural-first, FP-proneness, accented-form idempotency, _build_regex repeatability - TestScanNotebook (8): clean / md-stripped / code-stripped / multi-hit / multi-line / multi-cell / nbformat-list / unreadable - TestAccentPairs (6): dictionary hygiene (lowercase keys, unique, suggestions differ from keys, accents present, FP-prone excluded) - TestMainExitCodes (5): --check exit 0/1, missing file exit 2, non-check mode exit 0, --json valid output Verification: - 34/34 PASS in 0.23s - Full test suite: 2200 PASS (was 2166, +34), zero regressions Closes gap in test coverage for partition-mienne OWNDOC (#2876 / #3801 axe-2 SOTA enforcement). See #6971 (companion detector tests, same canon) for parallel precedent. Co-authored-by: Claude-Code <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.
Summary
Targeted follow-up to the canonical detector #6959 (per ai-01's close-as-duplicate guidance on #6968: « rouvre en PR ciblée qui teste le détecteur pluriel canonique »). Two complementary deliverables:
scripts/tests/test_detect_svg_decimal_commas.py(13 tests) — the canonical detector had zero test coverage on main. Covers the full public API (detect_svg/detect_cell/scan_notebook).The gap (the tests revealed it)
_POINTS_REand_COORD_ATTR_REmatched onlypoints="..."/cx="...". But single-quoted attrs are equally valid SVG, and some C# builders emit them:A decimal-comma bug in a single-quoted coord would have bypassed the #6965 CI gate entirely. The detector was written/tested against Infer-17 (double-quote); MGS-15 (single-quote) was outside its test set.
Firsthand before fix:
cx="170,9"→ detected ✓,cx='170,9'→ NOT detected ✗.Fix (minimal, 9+/5-)
Both regexes accept either quote via a backreference:
Consumers read
group(2)(the value;group(1)is the opening quote). After fix: single-quotecx='170,9'andpoints='70,0,334,4'→ detected; double-quote unchanged.Validation (real, evidence-cited)
>2 partspoints check +\d,\dcoord check); only the quote-delimiter acceptance broadened.Files
scripts/tests/test_detect_svg_decimal_commas.pyscripts/notebook_tools/detect_svg_decimal_commas.pySee #6959 (canonical detector), #6965 (CI gate), #6946/#6960 (the original decimal-comma incidents). Verdict SOTA-OK: a targeted test+fix that hardens an existing tool, not a parallel detector.