Repository navigation
fix(core): typescript class_start now recognizes const enum (#1348) - #1353
Merged
Merged
Conversation
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]>
Contributor
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
typescript class_start: export/declare const enum not recognized (recall gap)interfaces/enums as classes (they're intentional
class_startmatches). After that fix, 20 of842 real classes were still genuinely missing from GitGalaxy's output -- a real regex gap this
time, not a ground-truth issue.
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'tinclude
const, so the rule never matched at all for this form.constto the modifier alternation. Since the entity keyword (class|enum|interface) isstill mandatory immediately after the modifier run, this can't introduce new false matches on
unrelated
const x = ...statements.const enum Foo {,export const enum Foo {) toCLASS_CASES["valid"]intests/extraction/languages/test_typescript.py.tree_sitter_accuracy_baseline_typescript.jsonbaseline and the summary table:class recall 97.6% -> 100% (842/842 found, still 0 extra). No other language's baseline moved.
crucible_check.py --updateper mode, both venvsre-verified against the current checkout's editable install per CONTRIBUTING.md) and regenerated
both golden masters. The 183 diffs are all more
const enummembers now correctly counted asClass/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.pypasses clean (full_precision + zero_dependency) after regenerating.Test plan
python -m pytest tests/extraction/languages/test_typescript.py -q-- 78 passedpython tests/tools/tree_sitter_accuracy_audit.py --lang typescript --ci-- OK, matchesregenerated baseline (100% class precision, 100% class recall)
python tests/tools/tree_sitter_accuracy_audit.py --all --ci-- verified no other languagebaseline moved
python tests/tools/audit_check.py-- ruff/mypy/dead-key/ast-accuracy all cleanpython tests/tools/crucible_check.py-- full_precision + zero_dependency both PASS afterregenerating golden masters
python -m pytest tests/ -q-- 6834 passed, 2 skipped, 11 xfailed, 3 xpassed, 0 failures🤖 Generated with Claude Code