Skip to content

fix(core): typescript class_start now recognizes const enum (#1348) - #1353

Merged
squid-protocol merged 1 commit into
mainfrom
fix/class-start-typescript-const-enum-1348
Aug 12, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/class-start-typescript-const-enum-1348

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • Closes typescript class_start: export/declare const enum not recognized (recall gap) #1348: typescript class_start: export/declare const enum not recognized (recall gap)
  • Follow-up to typescript class_start: 34.7% precision (537 false-positive classes against 285 real) #1338/fix(tools): typescript class_start ground truth was missing interface/enum (#1338) #1349, which fixed the accuracy audit's typescript ground truth to count
    interfaces/enums as classes (they're intentional class_start matches). After that fix, 20 of
    842 real classes were still genuinely missing from GitGalaxy's output -- a real regex gap this
    time, not a ground-truth issue.
  • All 20 traced to the same shape: const enum Foo { ... } / export const enum Foo { ... }
    (TypeScript's compile-time-only enum variant, used throughout vscode, the typescript compiler,
    and assemblyscript). class_start's modifier group (export|default|abstract|declare) didn't
    include const, so the rule never matched at all for this form.
  • Added const to the modifier alternation. Since the entity keyword (class|enum|interface) is
    still mandatory immediately after the modifier run, this can't introduce new false matches on
    unrelated const x = ... statements.
  • Added the two suggested test cases (const enum Foo {, export const enum Foo {) to
    CLASS_CASES["valid"] in tests/extraction/languages/test_typescript.py.
  • Regenerated the tree_sitter_accuracy_baseline_typescript.json baseline and the summary table:
    class recall 97.6% -> 100% (842/842 found, still 0 extra). No other language's baseline moved.
  • Ran the Differential Scan protocol (crucible_check.py --update per mode, both venvs
    re-verified against the current checkout's editable install per CONTRIBUTING.md) and regenerated
    both golden masters. The 183 diffs are all more const enum members now correctly counted as
    Class/Entity Declarations in the same handful of typescript corpus files (vscode,
    typescript_compiler, assemblyscript), plus the downstream architectural
    fingerprint/cluster/z-score numbers that derive from those counts -- confirmed
    crucible_check.py passes clean (full_precision + zero_dependency) after regenerating.

Test plan

  • python -m pytest tests/extraction/languages/test_typescript.py -q -- 78 passed
  • python tests/tools/tree_sitter_accuracy_audit.py --lang typescript --ci -- OK, matches
    regenerated baseline (100% class precision, 100% class recall)
  • python tests/tools/tree_sitter_accuracy_audit.py --all --ci -- verified no other language
    baseline moved
  • python tests/tools/audit_check.py -- ruff/mypy/dead-key/ast-accuracy all clean
  • python tests/tools/crucible_check.py -- full_precision + zero_dependency both PASS after
    regenerating golden masters
  • python -m pytest tests/ -q -- 6834 passed, 2 skipped, 11 xfailed, 3 xpassed, 0 failures

🤖 Generated with Claude Code

The modifier group (export|default|abstract|declare) was missing const,
so TypeScript's compile-time-only `const enum Foo {` / `export const enum
Foo {` form (used throughout vscode, the typescript compiler, and
assemblyscript) never matched -- const isn't a recognized modifier and
isn't the mandatory class|enum|interface keyword either, so the whole
rule silently failed to fire. Adding const as an optional modifier can't
introduce new false matches: the entity keyword is still mandatory right
after the modifier run, so a plain `const x = ...` statement still
doesn't match.

Found via #1338's investigation: after fixing the accuracy audit's
typescript ground truth to count interfaces/enums as classes, 20 of 842
real classes were still genuinely missing, all tracing to this one shape.
class recall moves 97.6% -> 100% (baseline regenerated); no other
language's baseline changed.

Regenerated golden_master_audit.json / golden_master_zero_dep_audit.json
via update_golden_master.py per the Differential Scan protocol -- the 183
diffs are all more const-enum members now correctly counted as Class/
Entity Declarations in a handful of typescript corpus files (vscode,
typescript_compiler, assemblyscript), plus the downstream architectural
fingerprint/cluster numbers that derive from those counts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 70e5151 into main Aug 12, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the fix/class-start-typescript-const-enum-1348 branch August 12, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typescript class_start: export/declare const enum not recognized (recall gap)

1 participant