Repository navigation
Resolve all 6 rust tri-comparison ledger shapes - #1873
Merged
Merged
Conversation
_walk_tree_sitter listed every matching tree-sitter node with no consolidation, so a Haskell function written as multiple pattern-match clauses (idiomatic style -- toJSON instance methods, guard-clause helpers, etc.) counted as multiple distinct occurrences of one name. Confirmed via the ledger's own toJSON example: 5 clause-nodes at consecutive lines in one Options.hs instance block, where GitGalaxy and ctags each correctly report 1. This is the same bug tree_sitter_accuracy_audit.py's measure() already fixed once (#1614-1616) -- this module wrote its own simpler walk instead of reusing that closure and silently reintroduced it. Ported the same fix: consecutive func-type sibling nodes sharing a name (interleaved `comment` nodes don't break the run) collapse into the first occurrence only. Verified: haskell's raw tree-sitter function count drops from 275 to 146 (GitGalaxy's own count is 148), and the ledger's tree_sitter-only-vs-[ctags,gitgalaxy] shape (91 occurrences) no longer reproduces. Regenerated the full ledger and chart across all 45 languages with tree-sitter-language-pack + a locally-built universal-ctags -- no other language's entries were affected. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Resolved without needing a fresh investigation -- two from source already read earlier in this same effort, one from a doc comment already sitting in ctags_reader.py: - agree[gitgalaxy]_vs[ctags,tree_sitter] (2): mixed verdict, read individually. getExtensions is a real instance method both other tools structurally can't see; extensionEnabled is a genuine GitGalaxy false positive (misreads a guard-clause call as a definition). - args agree[none]_vs[gitgalaxy,tree_sitter] (9): one systematic cause, point-free/eta-reduced equations -- GitGalaxy counts true signature arity, tree-sitter counts only the aligned clause's explicit patterns. Same shape as Claim 1, not an engine defect. - class agree[gitgalaxy,tree_sitter]_vs[ctags] (16): not a real discrepancy at all -- ctags_reader.py already documents CTAGS_CLASS_KINDS["haskell"] = set() on purpose, no class-shaped ctags kind exists for this language. The remaining 2 unvalidated haskell shapes (ctags-alone existence, ctags-misses-real existence) are still open -- under investigation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
agree[ctags]_vs[gitgalaxy,tree_sitter] (103 occurrences): dispatched agent investigation, all 10 sampled cases are ctags-side artifacts, no GitGalaxy/tree-sitter defect. Three causes: multi-clause double-tagging (ctags tags every pattern-match equation as a separate occurrence, GG/TS correctly anchor to the first clause only), keyword-as-identifier misparsing (class/where/pattern), and a value-vs-function kind collapse ctags' Haskell parser can't express (GitGalaxy and tree-sitter's own audit tooling both independently make the same correct distinction, per #1312/#1566). Full evidence in the ledger verdict. 5 of 8 haskell shapes now validated. 1 remaining under investigation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
agree[gitgalaxy,tree_sitter]_vs[ctags] (69 occurrences): dispatched agent investigation confirms all 10 sampled misses -- and by cross-check against further non-sampled instances, plausibly all 69 -- are locally-scoped definitions (instance methods, where-clause helpers, let-bound names in do blocks), never top-level. ctags' Haskell parser has no layout-rule/scope awareness and only tags column-1 equations; it correctly handles multi-clause definitions when they're top-level (expandFilterPath/writeFnBinary/writerFn all tag fine), so this is a pure scope gap distinct from the clause-splitting bug fixed earlier. GitGalaxy and tree-sitter both correct; nothing to fix in this repo. Added a doc addendum to ctags_reader.py alongside its existing Haskell notes so this is documented at the source, not just in the ledger. All 8 haskell ledger shapes are now resolved: 5 validated (real findings, all confirming GitGalaxy/tree-sitter correctness against ctags-side limitations, plus one genuine GitGalaxy false-positive and one documented point-free-arity distinction), 3 stale/no-longer- reproducing (artifacts of the clause-splitting bug fixed earlier in this PR, kept as history per the ledger's own lifecycle). Regenerated chart.svg reflects the cleared asterisks. Co-Authored-By: Claude Sonnet 5 <[email protected]>
recall_t = matched / union-of-everyone's-claims looked principled but shares the exact weakness any single tool's own noise: this session found ctags multi-clause double-tagging (haskell) and, before that, a tree-sitter clause-splitting bug that both inflate the SHARED union denominator, silently deflating every OTHER tool's recall percentage in the process. A ranking built on a denominator any one tool can corrupt isn't a ranking worth showing. Func Recall / Class Recall panels are now Functions Found / Classes Found: each tool's raw claim count, no ratio, no winner badge, excluded from the summary tally -- "found more" isn't a correctness claim (a hallucinating tool finds more too). Precision panels are unchanged and still meaningful: their denominator is each tool's OWN claim count, never a cross-tool union, so it can't be corrupted the same way -- this is already the "of what we found, how many are real" framing. No changes to tri_comparison_reconcile.py/ledger.py -- the underlying per-slot agreement data was already computed this way; only how the chart renders two of the five panels changed. Regenerated across all 45 languages; confirmed Haskell's ctags multi-clause inflation (148 GG / 146 tree-sitter / 180 ctags) now renders as a plain, unranked fact instead of implying a winner. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Args' matched_consensus already meant "matched the cross-tool majority vote" -- exactly the same unverified-agreement-as-correctness assumption just removed from Func/Class Recall, just expressed as a 2-vs-1 majority credit instead of a union denominator. Either shape lets one tool's own noise (ctags' Haskell multi-clause double-tagging, tree-sitter's now-fixed clause-splitting bug) distort another tool's score. Args Match -> Args Found: each tool's raw comparable-args count (MetricScore.total_slots, not matched_consensus -- matched_consensus would still be the majority-vote correctness claim we're trying not to show pre-verification), no ratio, no badge, doesn't enter the summary tally. Same treatment as Functions/Classes Found, using a different underlying field since args' "found" concept isn't gate-free the way func/class existence is (args' total_slots still requires >=2 tools to have a comparable value -- an honest, noted limitation, not a silent one). Once a language/metric's ledger shapes are validated, a real denominator can come back for that language -- this is deliberately temporary, not a permanent downgrade. Summary tally is now Func/Class Precision only (2 ranked panels, down from 3). Co-Authored-By: Claude Sonnet 5 <[email protected]>
Real problem found on the regenerated chart: a strictly-highest-rate_pct
badge rule doesn't know or care about sample size or whether anyone has
actually checked the disagreement against source -- a 2-sample cell at
100% (2/2) could badge over an 80-sample cell at 98.75% (79/80) with
equal visual confidence. That's not a tool being more correct, it's an
artifact of an unverified comparison.
Replaces is_language_metric_clean() (GitGalaxy-only, aspect-specific)
with has_open_question() (tri_comparison_ledger.py): symmetric across
all three tools, one question -- does ANY currently-reproducing,
unvalidated ledger entry exist for this (language, symbol_type, metric)
triple, regardless of which tool(s) are on which side. Drives two
chart behaviors, both now symmetric instead of GitGalaxy-only:
- EVERY tool's value label in a disputed cell gets `*`, not just
GitGalaxy's -- the open question is "has anyone verified this",
not "did GitGalaxy specifically lose".
- No winner badge is drawn on a disputed cell at all, on any panel,
regardless of how lopsided the raw numbers look.
Confirmed working as intended on the regenerated chart: haskell (5 of
8 ledger shapes validated this session) now shows zero asterisks and a
real badge on Func Precision; c and rust, never investigated, are
honestly asterisked across every panel with no badges at all. Earning
a badge now requires the same verification work already used for
haskell -- reading real source and recording a verdict in the ledger
-- not just a bigger number.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…-fix # Conflicts: # docs/self_scan/tri_comparison_chart.svg # docs/self_scan/tri_comparison_ledger.json
First real run of the tri-comparison-ledger-sweep skill (pool of 3
Gemini dispatches + 3 resolved directly). Outcomes:
- 152-occurrence + 25-occurrence shapes: GitGalaxy correct, already-
documented Claim 6 (macro-body blind spot) extended from `fn` inside
quote!{} invocations to `struct` inside macro_rules! definitions.
Strengthened Claim 6 in docs/why_gitgalaxy_beats_ast_here.md with
concrete cited evidence for both shapes (previously only implied).
- Two confirmed GitGalaxy engine defects, both rooted in the same
underlying cause (a Rust lifetime tick never recognized as non-string
during bracket/quote scanning), filed as #1872 + a follow-up comment
on the same issue since they should be fixed together:
- _count_top_level_args: getattr(self, "language", ...) checks an
attribute that's never set (the real one is self.primary_lang_id)
-- the rust/scala lifetime exemption has silently never fired.
- _matching_paren_end: no lifetime guard at all, causing a
self-containment check to misfire and fall through to a
whitespace-split fallback meant for Lisp/Scheme/Shell.
One dispatch self-corrected mid-investigation (first pass proposed a
mechanism that didn't survive the dispatching agent's own manual code
trace; second pass was independently re-verified byte-for-byte
against all 8 sampled real signatures before being accepted).
- Two small ctags-side limitations (no "union" kind in ctags' Rust
parser; skips a function whose parameter is a destructuring pattern
rather than a plain binding), confirmed via direct ctags runs against
the corpus and documented in tests/tools/ctags_reader.py alongside
its existing per-language notes, not filed as issues (nothing in
this repo to fix).
Regenerated chart.svg and tri_comparison_points_of_interest.md.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…-fix # Conflicts: # docs/self_scan/tri_comparison_chart.svg # docs/self_scan/tri_comparison_ledger.json
Contributor
Second real run of the tri-comparison-ledger-sweep skill (pool of 2
Gemini dispatches + 1 resolved directly). All 3 shapes together account
for 703 of the ~792 total c occurrences in the ledger.
Confirmed GitGalaxy engine bug fixed already (prior commit, this session):
- c/function/args/agree[gitgalaxy,tree_sitter]_vs[ctags] (104): a bug
in this tool's OWN _count_ctags_signature_params, not GitGalaxy or
ctags -- C's `(void)` empty-parameter idiom was never special-cased
the way Python's analogous markers already were. Fixed.
Confirmed tooling defect in _walk_tree_sitter, now fixed:
- c/class/existence/agree[tree_sitter]_vs[ctags,gitgalaxy] (525, the
single largest shape in the entire ledger): tree-sitter-c's
struct_specifier/union_specifier/enum_specifier node type covers both
a real definition and a bare type reference (pointer decl, param,
cast), distinguished only by a `body` field _walk_tree_sitter never
checked. tree_sitter_accuracy_audit.py's own walk() already has this
exact fix for C -- ported it, same shape as the earlier haskell
clause-splitting fix in this same file.
Confirmed already-documented tree-sitter behavior (Claim 8), strengthened
with new concrete citations, no code change needed:
- c/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy] (74):
two sub-mechanisms, both already covered -- keyword/macro misparse
('if', 'DICT___REVERSED___METHODDEF', both already in
_C_KNOWN_MACRO_HALLUCINATIONS) and genuine #if 0 dead-code parsed as
live (_PyObject_ManagedDictValidityCheck, tos_char/print_stack/
print_stacks). Added 4 new exact file:line citations to Claim 8's
evidence section.
Every dispatched verdict's file:line citations and code claims were
independently re-verified against real source before being applied --
none accepted on the dispatched agent's word alone.
8 smaller c shapes remain (68 occurrences total).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First real run of the new
tri-comparison-ledger-sweepskill (#1871) -- pool of 3 Gemini dispatches plus 3 resolved directly from already-documented evidence or a live ctags run. All 6 rust ledger shapes now validated.GitGalaxy correct (Claim 6 extended):
fninsidequote!{}invocations tostructinsidemacro_rules!definitions. Strengthened Claim 6 indocs/why_gitgalaxy_beats_ast_here.mdwith concrete cited evidence for both shapes (previously only implied generically).Two confirmed GitGalaxy engine defects, one root cause:
'_,'a,'static) is never recognized as non-string during bracket/quote scanning indetector.py. Filed as rust/scala lifetime-exemption in _count_top_level_args is dead code (self.language vs self.primary_lang_id) #1872, plus a follow-up comment on the same issue for the second manifestation (they should be fixed together):_count_top_level_args: checksgetattr(self, "language", ""), an attribute that's never set (the real one isself.primary_lang_id) -- the lifetime exemption has silently never fired._matching_paren_end: no lifetime guard at all, misfiring a self-containment check that falls through to a whitespace-split fallback meant for Lisp/Scheme/Shell.Two small ctags-side limitations, documented not filed:
ctags --list-kinds-full=Rust).tests/tools/ctags_reader.pyalongside its existing per-language notes -- nothing in this repo to fix.Regenerated
chart.svgandtri_comparison_points_of_interest.md.Verification
ruff_audit.py --ci/mypy_audit.py --ci: no new findings beyond baseline.Test plan
ruff_audit.py --ci/mypy_audit.py --ciclean.🤖 Generated with Claude Code