Skip to content

CSS at-rules (@layer / @media / @supports) counted as functions; css tree-sitter-accuracy baseline stale (real_functions 24→25) #2507

Description

@squid-protocol

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

  1. Tighten the css func_start rule in gitgalaxy/standards/language_standards.py so @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.
  2. Investigate the real_functions 24 → 25 ground-truth bump (which corpus file / which node tree-sitter now counts) before regenerating — the audit message explicitly asks for this.
  3. Once (1) and (2) are settled, regenerate tests/tree_sitter_accuracy_baseline_css.json (+ the summary table in language_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginedata-qualitythreat: false-positiveAccuracy tuning: Engine incorrectly flagged safe code

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions