Skip to content

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

Closed

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

Activity

  1. added
    bugUnintended behavior or logic failure in the engine
    core-engineModifications to the central physics and parsing engine
    threat: false-positiveAccuracy tuning: Engine incorrectly flagged safe code
    on Aug 30, 2026
  2. squid-protocol commented on Aug 30, 2026

    @squid-protocol
    OwnerAuthor

    PR #2509 addresses this.

    Item 2 (investigate the real_functions 24→25 bump): it is not corpus drift. files_scanned is 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_name audit-reader changes (keyframes branch un-deadcoded → +funcs; bodyless @layer a,b; now None → −funcs; net +1) landing without re-blessing tests/tree_sitter_accuracy_baseline_css.json. #2500 updated the tri-comparison chart/ledger and docs/language_status/css.md but 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_start so 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 in tri_comparison_ledger.json are all status: validated, with css/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 counts media_statement/supports_statement/keyframes_statement/at_rule as ground-truth functions (#1313). Removing them from func_start would 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 args count off an at-rule prelude (@media all and (max-width: 600px) → 3) while tree-sitter reports real=0 — is an informational args_comparable gap (the gated args_exact_match is 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.

  3. added this to the v2.4.9 milestone on Aug 31, 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

    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