From f99626d68b94846f19335260965df659f48e162e Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 28 Jul 2026 22:42:41 -0400 Subject: [PATCH] Fix #587: Strict parsing tests for html structural signatures Adds strict positive/negative, ambiguity-sweep, and ReDoS regression coverage in tests/core_engine/test_language_standards_strict.py for all 39 non-None html structural signatures (54 tests). Found and fixed 8 real bugs in html's rules dict, all the same root shape: a `\b` sitting adjacent to a non-word character inside a shared alternation group. Also found and filed a separate, real pipeline bug as issue #733 before writing any tests: html is tagged `line_exclusive` but should be `block_exclusive` (its own inline comment already says so), and block_exclusive's own delimiter config is empty/broken -- net effect, comments are never actually stripped from code_stream for html today. Not fixed here (matches the epic's established pattern of keeping per-language issues scoped to the rules-dict regexes and filing pipeline gaps separately, e.g. #691/#694/#697). Tests below are written against html's real (unstripped) code_stream behavior -- dead_code/macros search for the literal " comments are NEVER +# stripped from code_stream for html today; the whole raw file (comments +# included) is what every rule below actually scans in a real run. Tests here +# are written against that real behavior, not an idealized stripped-comment +# one -- e.g. dead_code/macros search for the literal "', "
live content
"), + ("doc", "Page Title", "
Page Title
"), + ("test", 'data-testid="submit-btn"', 'id="submit-btn"'), + ("concurrency", "') + assert m and m.group(1) == "app.js" + m2 = pattern.search('') + assert m2 and m2.group(1) == "styles.css" + + +def test_html_func_start_and_class_start_no_capture_group_expected(): + # func_start/class_start don't capture a name in html (unlike many + # languages) -- they anchor on the tag keyword itself. Confirm the match + # span is the tag, and that they don't collide with each other. + func_start = HTML_RULES["func_start"] + class_start = HTML_RULES["class_start"] + assert func_start.search("