Skip to content

Non-executable <script type=...> blocks: audit walk over-counted (fixed), html func_start over-anchors (open) #2492

Description

@squid-protocol

Surfaced by a tri-comparison-ledger-sweep pass on html (ledger shapes html/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy] and .../agree[gitgalaxy]_vs[ctags,tree_sitter]).

Context

A <script> whose type attribute is anything other than a JavaScript MIME type (or module, or bare/empty) is a non-executed data block — the browser never runs it. In language-crucible/data/html this is:

  • revealjs_decks/demo.html:142,252 — type="text/template" (reveal.js slide showing sample React code as a highlighted listing)
  • revealjs_decks/math.html:41 — type="math/tex; mode=display" (MathJax)
  • threejs_shader_examples/*.html — type="x-shader/x-vertex" / x-shader/x-fragment (GLSL source, 10 blocks)

Part 1 — audit tooling over-counted (FIXED in this PR)

tests/tools/tree_sitter_accuracy_audit.py::_html_embedded_ts_funcs (also used by tri_comparison_gatherer.py) injected the JavaScript grammar into every <script> element, checking only for src= and never type=. It parsed the two function declarations in demo.html's text/template block (Example@145, SecondExample@158) as real functions — GitGalaxy and ctags both (correctly) report nothing there, so these counted as 2 phantom recall misses against GitGalaxy (html func recall showed 94.9%).

Fix (this PR): _html_embedded_ts_funcs now skips a <script> whose type is present and not in a small _EXECUTABLE_SCRIPT_TYPES allowlist (mirrors its existing src= skip and the HTML spec's classic/module-script gate). html ts-accuracy baseline re-blessed real_functions 39 → 37; func recall → 100%. Regression test added (tests/tools/test_html_embedded_ts_funcs.py).

Part 2 — GitGalaxy html func_start over-anchors (OPEN)

gitgalaxy/standards/language_standards.py's html func_start is <(script|style)(?=[ \t\n\r\f/>]) — it anchors a function-analog on every <script>/<style> block (intended; this is the rule behind the validated 37-occurrence agree[gitgalaxy,tree_sitter]_vs[ctags] shape, where the anchors get descriptive names from real embedded CSS at-rules / JS functions).

For a non-executable <script type="text/template"> with no embedded code GitGalaxy recognises, the anchor is left with the bare name script and no corroboration — a minor over-anchor (demo.html:142, ledger shape agree[gitgalaxy]_vs[ctags,tree_sitter], 1 occurrence). On this corpus it costs GitGalaxy 1 point of html func precision (37/38 = 97.4% vs tree-sitter's 37/37).

Proposed: a symmetric type= exclusion in html's func_start (skip <script> with a non-executable type). Deferred from this PR because it's a language_standards.py change needing its own differential scan + golden-master re-bless, and must be checked against the validated 37-occurrence shape.

Acceptance

  • _html_embedded_ts_funcs skips non-executable <script type> (this PR)
  • html func_start skips non-executable <script type> (follow-up)

Activity

  1. added
    bug
    on Aug 30, 2026
  2. squid-protocol commented on Aug 30, 2026

    @squid-protocol
    OwnerAuthor

    Reopening — #2493 closed this via a 'Closes part 1 of #2492' phrasing, but part 2 is still open: the symmetric non-executable-type= exclusion for HTML's own func_start regex in gitgalaxy/standards/language_standards.py. Picking that up now.

  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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions