Skip to content

Epic: Strict & exact regex test coverage for all structural signatures, per language #518

Closed

Description

@squid-protocol

Why

gitgalaxy/standards/language_standards.py defines 2,182 compiled regex rules across 58 languages — the Structural Signature Analysis Engine that is the core of how GitGalaxy parses code without an AST. This epic originally started from the premise that 6 languages (C, C++, C#, COBOL, Rust, TypeScript) already had dedicated correctness/ReDoS testing (tests/core_engine/test_language_standards_strict.py) and so were out of scope. Every other language's rules were exercised only by a blanket "does it compile" fuzzer (test_global_regex_syntax_integrity) — which proves the regex is syntactically valid Python, not that it matches (or correctly excludes) what its own documented semantics say it should.

Update (2026-07-29): that premise was checked and doesn't hold up. Auditing what those 6 languages actually have in the test file: each one has only a handful of isolated regression tests (test_c_knr_ambiguity_trap, test_csharp_iron_wall_redos, test_cpp_macro_multiline_spiral, test_c_pointer_ambiguity_overlap, test_cobol_ghost_satellite_prevention, test_thermodynamic_operator_collisions), each one hard-coded to a single specific bug someone already found — not the full per-signature template (positive/negative case + ambiguity sweep + ReDoS scaling sweep for every non-None signature) every other language in this epic has now received. Coverage was roughly 2-12% of each language's actual non-None signature count (e.g. COBOL: 1 of 46 signatures touched; TypeScript: 1 of 58). Filed as 6 new sub-issues (#773-778).

Update (2026-07-30): epic complete — all 6 newly-filed languages closed

Every one of the 6 languages found to have thin coverage now has the full per-signature template, in the same style as the other 48:

Across all 6: ~40 real, previously-undetected bugs fixed (boundary defects, ReDoS, comment-style completeness, schema completeness, and outright false-positives), every one verified against the real language-crucible corpus via the Differential Scan before merging, not just unit-tested in isolation.

Two real architectural/pipeline gaps were found along the way and deliberately not fixed inline, matching this epic's established pattern of keeping per-language issues scoped to the rules-dict regexes and filing pipeline-level findings separately: #789 (csharp's func_start never counts expression-bodied methods, and can hallucinate bare calls as functions with no enclosing brace).

gitgalaxy/standards/how_to_add_a_language.md was also updated with the accumulated lessons from this whole epic: 4 brand-new numbered engine rules (13: re.M completeness, 14: adjacent overlapping quantifiers, 15: a documented exclusion must actually exclude, 16: identifier classes must match the language's real grammar) plus expanded guidance on 2 existing rules and 3 new items on the Strict Testing Prompt checklist — so future language work, in or outside this epic, inherits the full recurring-bug-class checklist without needing to rediscover it.

Epic #518 is now fully complete: all 48 originally-scoped languages plus all 6 languages added by the premise-check are closed.

What

This epic tracked bringing every language's structural signatures up to the same bar, organized per language — one issue per language, covering every structural signature that language actually defines.

4 languages were skipped entirely (csv, pbtxt, plaintext, xml) — they have zero non-None structural signatures defined; there was nothing to test.

Reference doc

gitgalaxy/standards/how_to_add_a_language.md is the canonical spec for what every signature captures/excludes, the 5 lexical parsing families, the full recurring-bug-class checklist (16 numbered engine rules as of this epic's completion), and how to add a new language.

Test Template (used in every sub-issue)

For each of a language's non-None structural signatures: (1) a positive-match test against its documented includes; (2) a negative-match test against its documented excludes; (3) a cross-rule ambiguity test wherever this language shares a token between two rules; (4) a ReDoS-immunity test sized to that rule's actual quantifiers, using the assert_redos_immune harness in tests/core_engine/test_language_standards_strict.py. A rule being None for a language is not a gap — that's the doc's Strict Feature Parity rule (#4) working as intended.

Sub-issues — ALL CLOSED


Activity

  1. added
    epic
    testing
    core-engine
    on Jul 26, 2026
  2. changed the title [-]Epic: Strict & exact regex test coverage for all structural signatures across all languages[/-] [+]Epic: Strict & exact regex test coverage for all structural signatures, per language[/+] on Jul 26, 2026
  3. 2 remaining items

  4. added 10 commits that reference this issue on Jul 28, 2026
  5. squid-protocol commented on Jul 30, 2026

    @squid-protocol
    OwnerAuthor

    Closing — all 6 remaining sub-issues (#773-778) are merged, and every one of the original 48 plus these 6 is now closed. Final tally for the 6 languages this epic's premise-check added:

    Language Signatures Real bugs found PR
    typescript 58 8 #779
    cpp 51 14 #787
    rust 51 12 #781
    csharp 50 7 #790
    c 49 4 #785
    cobol 46 4 + missing schema key #783

    tests/core_engine/test_language_standards_strict.py now has full per-signature coverage (positive/negative/ambiguity/ReDoS) for every one of the 54 languages that define at least one structural signature, and gitgalaxy/standards/how_to_add_a_language.md carries forward the 16-rule recurring-bug-class checklist this epic accumulated. Two pipeline-level findings were spun out as their own issues rather than fixed inline: #789 (csharp func_start vs expression-bodied methods).

    Test-suite documentation and the root README's testing/verification story are being updated separately to reflect this.

  6. added this to the v2.4.6 milestone on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineepictesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions