Skip to content

tri_comparison_gatherer: inject css/js grammar for HTML <style>/<script> (parity with #2421) #2452

Description

@squid-protocol

Summary

tests/tools/tree_sitter_accuracy_audit.py already injects the css/javascript grammar when it
hits an HTML <style> / <script> element (_html_embedded_ts_funcs, added in #2421), so its
tree-sitter side sees the real CSS/JS constructs inside. tests/tools/tri_comparison_gatherer.py
has its OWN simpler tree-sitter walk (_walk_tree_sitter) that did NOT do this — for HTML it
matched style_element / script_element against func_node_types, _get_node_name returned
None, and the tree-sitter side yielded nothing.

Consequence: cpython_jinja/layout.html:40's @media only screen { ... } inside a <style>
block — which GitGalaxy's polyglot detector correctly reports as a function media — showed up
as html/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] (GitGalaxy alone), i.e. a
correct polyglot find looking like an over-detection.

Fix

Added the same tsaa._HTML_EMBEDDED_LANG / tsaa._html_embedded_ts_funcs branch to
_walk_tree_sitter, mirroring measure()'s own walk. media is now in GitGalaxy+tree-sitter
consensus. ctags-html still can't see it (no CSS parser — a separate documented limitation).

Found by

tri-comparison-ledger-sweep (remaining-shapes pass), 2026-08-29. Fixed in the same PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineModifications to the central physics and parsing engine

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions