Skip to content

css tri-comparison: func precision + recall to 100% (audit-reader fixes, no engine change) - #2500

Merged
squid-protocol merged 2 commits into
mainfrom
feature/tri-comparison-css-precision-recall
Aug 30, 2026
Merged

css tri-comparison: func precision + recall to 100% (audit-reader fixes, no engine change)#2500
squid-protocol merged 2 commits into
mainfrom
feature/tri-comparison-css-precision-recall

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What

CSS func precision and recall to 100%, by fixing two css-only defects in the
tri-comparison audit reader (tests/tools/tree_sitter_accuracy_audit.py::_get_node_name).
Zero GitGalaxy engine changedetector.py / language_standards.py / prism.py untouched,
golden masters untouched. Both defects made the audit disagree with GitGalaxy where GitGalaxy's
own css func_start is correct. Same bug class as the closed #1313.

Surfaced by a tri-comparison-ledger-sweep pass on css (fixes #2499).

Bug 1 — keyframes_statement name branch was dead code (precision)

The branch looped for a child of node type at_keyword, but the pinned tree-sitter-css grammar
names that child literally @keyframes / @-webkit-keyframes (only @media/@supports use the
at_keyword shape). It always fell through to return None, so tree-sitter reported 0
@keyframes corpus-wide despite the nodes being in its parse tree. GitGalaxy correctly matches
@keyframes. Ledger shape css/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter], 5 occ
(tailwindcss_atrules/theme.css:443/449/457/463 nested in a Tailwind-v4 @theme block;
gutenberg_css_modules/button.module.css:237).

Fix: accept the @keyframes / @-webkit-keyframes child types, fall back to "keyframes".

Bug 2 — bodyless @layer a, b; counted as a function (recall)

The at_rule branch returned "layer" for both the block form @layer name { … } (which
GitGalaxy matches) and the bodyless cascade-layer ordering statement @layer a, b, c; (which
GitGalaxy deliberately does not — its func_start counts only block-bearing at-rules, the same
body-bearing-definition-only convention that drops C/C++ forward declarations). Ledger shape
css/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy], 4 occ.

Fix: at_rule branch returns None when the node has no block child. @container is never
bodyless, so only @layer a, b; is affected.

Scope

at_rule / keyframes_statement appear in no other language's NODE_MAPS entry. Verified:
the full --all chart regen moves only css cells plus the summary tallies that roll up from them
(diff below). --all --ci (javascript/typescript/zig baselines) passes unchanged.

Verification

  • recall_audit.py css: 4 counted misses → 0
  • Chart: css Func Found 25*/24*/0*25/25/0; css Func Precision 20/25* & 20/24*
    25/25 & 25/25, asterisk-free
  • python tests/tools/tri_comparison_chart.py --all --ci → all OK
  • test_css.py + test_css_strict.py → 92 passed; test_html_embedded_ts_funcs.py,
    test_tri_comparison_{ledger,reconcile}.py → pass
  • ruff_audit.py --ci / mypy_audit.py --ci → no new findings
  • No golden-master re-bless — tests/tools/tree_sitter_accuracy_audit.py is never imported by
    anything under gitgalaxy/; GitGalaxy scan output is byte-identical.

Also in this PR

  • Both css ledger shapes → status: validated with full verdicts (no credit/debit — real
    corroboration once the reader is fixed, and a single-tool over-count respectively)
  • Regenerated tri_comparison_chart.svg / tri_comparison_ledger.json /
    tri_comparison_points_of_interest.md
  • New docs/language_status/css.md (§1–8 via the language-status skill, §9 tri-comparison
    capstone by hand) + README index row

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 30, 2026 15:01
…s; css func precision+recall to 100%

tree_sitter_accuracy_audit.py _get_node_name had two css-only defects (same class
as #1313), both making the tri-comparison audit disagree with GitGalaxy where
GitGalaxy's own css func_start is correct:

- keyframes_statement name branch was dead code: it looked for a child of node
  type `at_keyword`, but this grammar version names it `@keyframes` /
  `@-webkit-keyframes`. It always fell through to `return None`, so tree-sitter
  reported 0 @Keyframes corpus-wide. Fixed: accept the `@keyframes` /
  `@-webkit-keyframes` child types, fall back to "keyframes".
- the `at_rule` branch returned "layer" for the bodyless `@layer a, b, c;`
  ordering statement, which GitGalaxy deliberately does not match (its func_start
  counts only block-bearing at-rules, the same body-bearing-definition-only
  convention that drops C/C++ forward declarations). Fixed: return None when the
  at_rule node has no `block` child. @container is never bodyless, so only
  `@layer a, b;` is affected.

at_rule / keyframes_statement appear in no other language's NODE_MAPS, so the
change is css-only -- verified: the full --all chart regen moves only css cells
plus the summary tallies that roll up from them.

Ledger shapes validated (verdicts in tri_comparison_ledger.json):
- css/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] (5 occ, keyframes)
  -> audit-reader defect; tree-sitter now corroborates all 5. No credit/debit.
- css/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy] (4 occ, @layer)
  -> GitGalaxy correct; audit no longer counts the bodyless form. No credit/debit.

recall_audit.py css: 4 counted misses -> 0. Chart: css Func Found 25*/24*/0* ->
25/25/0; css Func Precision 20/25* & 20/24* -> 25/25 & 25/25, no asterisks.
Zero GitGalaxy engine change -- golden masters untouched.

Refs #2499. Same bug class as #1313.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lsfg2qxhocsSsiejiP1XqC
Sections 1-8 via the language-status skill (30/48 rule keys wired, 92 dedicated
test cases, epic history #577/#737/#841/#955 + cross-language #645). Section 9
is the tri-comparison capstone from this sweep: 3/3 css discrepancy shapes
resolved, zero GitGalaxy engine defects, recall 4-miss -> 0, both precision and
recall at 100%. Documents the two audit-reader bugs fixed in #2499 and the
bodyless-@layer recall-audit bucketing.

Refs #2499.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lsfg2qxhocsSsiejiP1XqC
@squid-protocol
squid-protocol merged commit 4cc5001 into main Aug 30, 2026
26 of 27 checks passed
@squid-protocol
squid-protocol deleted the feature/tri-comparison-css-precision-recall branch August 30, 2026 19:07
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol added a commit that referenced this pull request Aug 30, 2026
…dit-reader fix (#2507) (#2509)

`tree-sitter-accuracy-audit` was red on main for css with a ground-truth drift
(`real_functions: baseline=24 current=25`). Not corpus drift: files_scanned is
21 in both the committed baseline and now -- #2478 already regenerated it against
the v1.2.0 pin.

The 24->25 is #2500 ("css tri-comparison ... audit-reader fixes, no engine
change") landing its own `_get_node_name` changes without re-blessing this JSON:
the fixed dead-code `keyframes_statement` branch (was always `return None`, so 0
`@keyframes` corpus-wide) adds keyframes; the `at_rule` branch now returning None
for the bodyless `@layer a, b;` form removes those. Net +1. #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 GitGalaxy engine change, zero corpus change.

Regenerated via `--regenerate` (also refreshes the summary table in
language_standards.py: css 83.3%/80.0% -> 100%/100%, matching the tri-comparison).
All movement is an improvement or the explained audit-reader correction:
found_functions 20->25, extra_functions 5->0, args_exact_match 14->19.

Also documents the permanent css at-rule `args_comparable` discrepancy in the
SCOPE docstring (GitGalaxy reads a param count off the at-rule prelude;
`_get_param_count` has no parameters field for at-rule nodes -> real=0). Not an
engine defect -- a CSS at-rule has no formal parameter list, and counting
at-rules as functions is a ledger-validated design choice
(`css/function/existence/agree[gitgalaxy,tree_sitter]_vs[ctags]`, status
validated). The gated `args_exact_match` is unaffected.

No golden-master re-bless: no engine/regex change.


Claude-Session: https://claude.ai/code/session_01Tpu4YmAESTUeSoPQ5LqLWy

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant