Repository navigation
CSS at-rules (@layer / @media / @supports) counted as functions; css tree-sitter-accuracy baseline stale (real_functions 24→25) #2507
Description
Summary
tree-sitter-accuracy-audit fails on css against the pinned v1.2.0 corpus:
=== css ===
tree_sitter_accuracy_audit: ground-truth metric(s) drifted from the pinned corpus's expected values:
real_functions: baseline=24 current=25
This means the corpus changed. Investigate before regenerating.
This is pre-existing on main (HEAD 4cc5001f): PR #2500 ("css tri-comparison … audit-reader fixes, no engine change") changed the audit walk but did not re-bless tests/tree_sitter_accuracy_baseline_css.json, which was last regenerated by #2478's bulk v1.2.0 pin bump. Surfaced by the CI run on PR #2506 (an unrelated COBOL prism fix); filing separately per scope discipline. Also noted as a follow-up in the v1.2.0 release notes.
Two distinct things going on
1. Stale baseline — GitGalaxy actually improved
python tests/tools/tree_sitter_accuracy_audit.py --lang css --regenerate on current main:
committed current
found_functions 20 25
extra_functions 5 0 <-- GitGalaxy went from 5 FP extras to 0
found_classes 227 227
real_functions 24 25
args_comparable 20 25
args_exact_match 14 19
The extra_functions: 5 → 0 is a real gain already sitting on main (from #2500's audit-reader fixes) that the committed baseline doesn't reflect.
2. Real false-positive — CSS at-rules parsed as functions-with-args
The audit's args comparison flags GitGalaxy counting CSS at-rules as function definitions:
| File | Construct | GitGalaxy |
|---|---|---|
gutenberg_css_modules/button.module.css:3 |
@layer wp-ui-components { … } |
layer — 1 arg |
tailwindcss_atrules/preflight.css:291 |
@supports (not (-webkit-appearance: …)) or (contain-intrinsic-size: 1px) { … } |
supports — 3 args |
threejs_app_ui/editor_main.css:660 |
@media all and ( max-width: 600px ) { … } |
media — 3 args |
threejs_app_ui/editor_main.css:720 |
@media … |
media — 4 args |
real=0 in every case — tree-sitter does not treat these as functions. This matches the known "css precision 100%→83.3% (@layer/@media at-rules counted as functions)" regression flagged at the v1.2.0 cut.
Proposed work
- Tighten the css
func_startrule ingitgalaxy/standards/language_standards.pyso@layer/@media/@supports/@container/@scope(and other prelude-taking at-rules) are not anchored as function definitions. A real CSS function is@function name(...)(very new) or a custom-property/calc()-style call — not a conditional-group at-rule. - Investigate the
real_functions 24 → 25ground-truth bump (which corpus file / which node tree-sitter now counts) before regenerating — the audit message explicitly asks for this. - Once (1) and (2) are settled, regenerate
tests/tree_sitter_accuracy_baseline_css.json(+ the summary table inlanguage_standards.py) and re-bless the golden masters if css output shifts.
Repro
python tests/tools/tree_sitter_accuracy_audit.py --lang css --ci # fails
python tests/tools/tree_sitter_accuracy_audit.py --lang css # shows the arg mismatches
🤖 Generated with Claude Code
Activity
squid-protocol commentedon Aug 30, 2026
PR #2509 addresses this.
Item 2 (investigate the
real_functions 24→25bump): it is not corpus drift.files_scannedis 21 in both the committed baseline and now — #2478 already regenerated this baseline against the v1.2.0 pin. The bump is #2500's own_get_node_nameaudit-reader changes (keyframes branch un-deadcoded → +funcs; bodyless@layer a,b;nowNone→ −funcs; net +1) landing without re-blessingtests/tree_sitter_accuracy_baseline_css.json. #2500 updated the tri-comparison chart/ledger anddocs/language_status/css.mdbut missed this file; its commit message records the target state ("css Func Found 25*/24*/0* -> 25/25/0"). Zero engine change, zero corpus change.Item 3 (regenerate baseline + summary table): done. css → 100% func recall / 100% func precision, matching the tri-comparison. No golden-master re-bless — no engine/regex change.
Item 1 (tighten css
func_startso at-rules aren't anchored as functions): declining, and I think the issue's framing here is superseded by #2500. The three css function entries intri_comparison_ledger.jsonare allstatus: validated, withcss/function/existence/agree[gitgalaxy,tree_sitter]_vs[ctags](25 occ) explicitly ruling GitGalaxy correct: at-rule keywords are "the closest function-shaped construct CSS has."tree_sitter_accuracy_audit.py's NODE_MAPS also deliberately countsmedia_statement/supports_statement/keyframes_statement/at_ruleas ground-truth functions (#1313). Removing them fromfunc_startwould revert a validated design decision and crater measured recall. The "precision 100%→83.3%" regression flagged at the v1.2.0 cut was already resolved by #2500 as an audit-reader bug, not an engine defect.The one true residue — GitGalaxy reading a nonzero
argscount off an at-rule prelude (@media all and (max-width: 600px)→ 3) while tree-sitter reportsreal=0— is an informationalargs_comparablegap (the gatedargs_exact_matchis unaffected and improved 14→19). PR #2509 documents it in the audit's SCOPE docstring rather than chasing it, same "no formal signature at the declaration site" shape as the shell/perl note (#1518/#1519).Proposing to close this once #2509 merges.
test(tree-sitter-audit): re-bless stale css baseline after #2500's au…