Skip to content

fix(powershell): shield here-strings; close final 3 tri-comparison ledger shapes - #2451

Merged
squid-protocol merged 2 commits into
mainfrom
lua-followups-sweep-remaining
Aug 29, 2026
Merged

fix(powershell): shield here-strings; close final 3 tri-comparison ledger shapes#2451
squid-protocol merged 2 commits into
mainfrom
lua-followups-sweep-remaining

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Final pass of the tri-comparison-ledger-sweep. Every reproducing discrepancy shape in
docs/self_scan/tri_comparison_ledger.json is now status: validated
(was 3 unvalidated,
count 1 each). GitGalaxy ties or beats tree-sitter and Universal Ctags on function/class
detection for every language in the corpus.

Engine fix — #2450 (PowerShell here-strings)

PowerToys/generate-interface.ps1 generates a C#/IDL interface from a
Write-Output @"namespace ... enum ProviderType { ... }"@ here-string. PowerShell's
embedded_syntax lexical family strips only # / <# #> comments, and prism.py had no
here-string handling in the code_stream path
, so the here-string body leaked through and
class_start matched enum ProviderType as a real class.

Fixed with _strip_powershell_herestrings in _strip_segment_comments's pre-processing step
(blanks @"..."@ / @'...'@ bodies, newline-count preserving, captures to the doc stream —
same idiom as _strip_python_docstrings / _strip_php_string_mass).

PowerShell class precision 90.0% → 100.0% (extra_classes 1 → 0).

Tooling fix — #2451 (HTML embedded-grammar injection in the gatherer)

tri_comparison_gatherer.py's tree-sitter walk now injects the css/javascript grammar for HTML
<style> / <script> elements, reusing the accuracy audit's own _html_embedded_ts_funcs
(the exact mechanism #2421 added to tree_sitter_accuracy_audit.py). layout.html:40's
@media only screen { ... } — which GitGalaxy's polyglot detector correctly reports as a
function media — was invisible to tree-sitter-html (opaque raw_text), so a correct find
looked like over-detection. media is now in GitGalaxy+tree-sitter consensus.

Ledger verdicts

No credit/debit on any shape.

Independent Gemini audit

An agy (Gemini 3.1 Pro) read-only audit of the 4 languages where GitGalaxy's raw function
count trails tree-sitter (perl −122, cpp −122, c −60, dart) confirmed all are tree-sitter
over-detection
— bodyless sub NAME($$$); prototypes (perl, per #1608), OPCODE(...)
bytecode-dispatch macros and bare bool/void members (cpp), macro array-initializers and
#if 0 dead code (c) — except dart, whose real recall gap is already tracked in #2072.
Gemini's one dissent (cpp conversion operators are "real code GitGalaxy misses") did not hold
up on verification: GitGalaxy finds all 60 Variant::operator X() definitions in
godot/variant.cpp; the difference is tree-sitter's () const naming suffix, not a miss.

Differential Scan

  • Both golden masters re-blessed — diff is .ps1 files reclassifying here-string mass from code
    LOC to doc LOC, plus Global Ecosystem / directory-magnitude / topological ripple. No
    function/class count changes anywhere. crucible_check.py --mode both PASS.
  • tree_sitter_accuracy_audit.py --all --ci 31/31 OK. tri_comparison_chart.py --all --ci OK.
  • Full tests/core_engine + tests/extraction pass. audit_check.py clean. Ledger / chart /
    points-of-interest regenerated (--all).

Closes #2450, closes #2451.

🤖 Generated with Claude Code

https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S

squid-protocol and others added 2 commits August 29, 2026 17:05
…apes

tri-comparison-ledger-sweep remaining-shapes pass. Every reproducing
discrepancy shape in docs/self_scan/tri_comparison_ledger.json is now
`status: validated` (was 3 unvalidated, count 1 each).

#2450 -- PowerShell here-string false positive (engine defect, fixed).
`Write-Output @"namespace ... enum ProviderType { ... }"@` in
PowerToys/generate-interface.ps1: PowerShell's `embedded_syntax` lexical
family strips only `#` / `<# #>`, and prism.py had no here-string handling
in the code_stream path, so `class_start` matched `enum ProviderType`
inside the string. Added `_strip_powershell_herestrings` to
`_strip_segment_comments` pre-processing (blanks `@"..."@` / `@'...'@`
bodies, newline-count preserving, captures to the doc stream -- same idiom
as `_strip_python_docstrings` / `_strip_php_string_mass`). powershell
class precision 90.0% -> 100.0% (extra_classes 1 -> 0); baseline + both
golden masters regenerated (the diff is .ps1 files reclassifying
here-string mass from code LOC to doc LOC, plus ripple).

#2451 -- tri_comparison_gatherer.py's tree-sitter walk now injects the
css/javascript grammar for HTML `<style>`/`<script>` elements, reusing the
accuracy audit's own `_html_embedded_ts_funcs` (#2421). layout.html:40's
`@media only screen { ... }` -- which GitGalaxy's polyglot detector
correctly reports as a function `media` -- was previously invisible to
tree-sitter-html (opaque `raw_text`), making a correct find look like
over-detection. `media` is now in GitGalaxy+tree-sitter consensus;
ctags-html still can't see it (no CSS parser, documented).

haskell/function/existence/agree[ctags,gitgalaxy]_vs[tree_sitter] (n=1):
reconciler rank-pairing artifact from ctags-haskell tagging one function
once per line (name line + `::` sig line + equations). pandoc/Shared.hs's
`addPandocAttributes` -> 3 ctags tags vs 1 each from GitGalaxy/tree-sitter.
Not a defect in any engine. Documented in ctags_reader.py.

No credit/debit on any of the four shapes.

An independent Gemini (agy) audit of the four languages where GitGalaxy's
raw function count trails tree-sitter (perl -122, cpp -122, c -60, dart)
confirmed all are tree-sitter over-detection (bodyless `sub` prototypes,
`OPCODE(...)` dispatch macros, `#if 0` dead code) except dart, whose real
recall gap is already tracked in #2072. Gemini's one dissent (cpp
conversion operators) did not hold up on verification -- GitGalaxy finds
all 60 `Variant::operator X()` definitions in godot/variant.cpp; the
difference is a `() const` naming-suffix, not a miss.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S
The HTML embedded-grammar-injection issue was filed as #2452, not #2451
(#2451 is this PR). Corrects the code comments and the ledger verdict.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 1f628e2 into main Aug 29, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the lua-followups-sweep-remaining branch August 29, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell: class_start/func_start match declarations inside @"..."@ here-strings

1 participant