Skip to content

Add capstone step to tri-comparison-ledger-sweep skill - #1878

Merged
squid-protocol merged 1 commit into
mainfrom
capstone-language-status-step
Aug 19, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
capstone-language-status-step

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

New step 8, triggered when every currently-reproducing shape for a language is validated: write it up before starting the next language, since the full picture (citations, verdicts, mechanisms) is only cheap to synthesize while still loaded in context.

Two concrete outputs:

  1. One more incidental-finding pass across sibling per-language data structures (ctags kind maps, node-type sets, exclusion lists). Motivated by a real miss this session: the c capstone pass found the identical CTAGS_CLASS_KINDS gap unfixed in cpp (cpp's CTAGS_CLASS_KINDS missing union kind (same pattern as the c fix) #1877) -- something a fresh session opening ctags_reader.py cold would have no reason to go check.
  2. A tri-comparison section in docs/language_status/<lang>.md -- distinct from that skill's existing "§9 vs. one ground-truth parser" template (this is a 3-way comparison with no privileged ground truth), written as its own numbered section. Dispatches the language-status skill (sections 1-8) as a background task in parallel rather than serially when the doc doesn't exist yet.

Also bumped the papertrail layer count 5→6 to include the new capstone doc.

Docs/tooling only -- no engine or runtime code touched.

Test plan

  • N/A -- markdown skill file only, no code behavior changed.

🤖 Generated with Claude Code

New step 8, triggered by "every reproducing shape for this language is
validated" -- do it before starting the next language, not as a someday
follow-up, since every citation and verdict is still loaded in context
right now and costs real tokens to reconstruct cold later.

Two things the capstone step produces:
1. One more incidental-finding pass across sibling per-language data
   structures (ctags kind maps, node-type sets, exclusion lists) -- if
   this language's sweep found a bug in one of these, check whether the
   same shape exists for OTHER languages in it too. Confirmed real: the
   c sweep's own capstone pass found the identical CTAGS_CLASS_KINDS gap
   unfixed in cpp (#1877), something a fresh session opening
   ctags_reader.py cold would have no reason to go looking for.
2. A tri-comparison write-up section in docs/language_status/<lang>.md
   -- a genuinely different shape from that skill's existing "§9
   measured accuracy vs. one ground-truth parser" template (this is a
   3-way comparison with no privileged ground truth), written as its
   own numbered section rather than force-fit into that template.
   Dispatches the language-status skill (sections 1-8) as a background
   task in parallel when the doc doesn't exist yet, rather than waiting
   on it serially before writing the tri-comparison section.

Papertrail section's layer count updated 5 -> 6 to include the new
capstone doc as its own layer.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@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 19, 2026
First real run of the new capstone step (tri-comparison-ledger-sweep
skill, #1878): once a language's ledger backlog fully clears, write it
up while the full picture is still cheap to synthesize from context.

Sections 1-8 (identification surface, what's detected/not tracked,
known limitations, test depth, closed work, real-world evidence) via
the existing language-status skill, dispatched as a background task in
parallel with this section -- 50/52 rule keys wired, 128 total
dedicated test cases, 3 real C-specific engine bugs found and fixed
historically (#1754, #1282, #1646) plus 2 measurement-tool-only
findings correctly distinguished from engine defects (#1265, #1641).

Section 9 is new: a tri-comparison capstone, written from this
session's own C sweep (11/11 ledger shapes resolved, 766 occurrences).
Headline: zero confirmed GitGalaxy engine defects found across the
entire sweep -- contrast with rust's same-methodology pass, which found
2 real ones (#1872). Current measured numbers back the claim: GitGalaxy
has the highest function precision of the three tools on this corpus
(99.8% vs ctags' 99.6% vs tree-sitter's 95.9%), and classes/args are
now fully tied at 100% across all three after this session's fixes.
Documents where GitGalaxy wins outright (macro-body/CPP-directive
immunity, both fed back into why_gitgalaxy_beats_ast_here.md's Claims
3/7/8), where the other tools have real documented gaps, and the two
real bugs found in this repo's own comparison tooling along the way.

Updated docs/language_status/README.md's c row: not written -> written,
stale 37-test count -> live 42.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squid-protocol
squid-protocol merged commit 90cd7dc into main Aug 19, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the capstone-language-status-step branch August 19, 2026 23:55
squid-protocol added a commit that referenced this pull request Aug 19, 2026
…1876)

* Resolve 5 more c tri-comparison shapes, 2 more tooling fixes (8/11 total)

Third round on the c backlog, all resolved directly (no dispatch needed
-- clear patterns confirmed via direct source/ctags reads):

Fixed in tri_comparison_gatherer.py:
- c/class/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] (23): ctags
  synthesizes __anon<hex> placeholder names for anonymous struct/union/
  enum (e.g. `typedef struct { ... } Foo;`). Neither GitGalaxy nor
  tree-sitter report a name for these (correctly -- there isn't one).
  Added _is_ctags_synthetic_anon_name(), same category as GitGalaxy's
  own existing _SYNTHETIC_GG_CLASS_NAMES exclusion, applied to both
  ctags func and class readings.

Documented in ctags_reader.py (not code-fixed -- would require a
curated name list, the same ground-truth-judgment category this
module's own docstring keeps out of the raw readers):
- c/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] (7):
  ctags misreads bare macro-invocation lines (RICHCMP_WRAPPER(lt,
  Py_LT), SLOT1(slot_mp_subscript, __getitem__, PyObject *)) as
  function definitions.

New evidence added to docs/why_gitgalaxy_beats_ast_here.md:
- c/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] (4): a
  third, narrower instance of Claim 3 (parse-error cascade) -- a bare
  SLOT0/SLOT1 macro-invocation line with no expansion available locally
  confuses both ctags and tree-sitter's parse of the SINGLE real
  function immediately following it (recovers after one function, not
  a full cascade). 4/4 sampled sites confirmed same shape.

Not new findings, already covered:
- c/function/existence/agree[ctags,tree_sitter]_vs[gitgalaxy] (3):
  EXPORT_FUN and MICROPY_WRAP_MP_EXECUTE_BYTECODE are both already in
  _C_KNOWN_MACRO_HALLUCINATIONS.

Structural ambiguity, not a defect:
- c/function/args/agree[ctags,gitgalaxy]_vs[tree_sitter] (1):
  gc_mark_subtree has two genuinely valid signatures under
  #if MICROPY_GC_SPLIT_HEAP / #else -- which one a tool picks up isn't
  a real disagreement, no preprocessor evaluation happens in any of
  the three tools.

8 of 11 c shapes now validated. 3 dispatched Gemini investigations
still running on the remaining genuine mysteries (13/9/8-occurrence
shapes spanning multiple files with no obvious single cause from the
sample alone).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Resolve final 3 c tri-comparison shapes -- all 11/11 now validated

Pool of 3 Gemini dispatches, all reviewed and independently re-verified
before being applied -- two led to real fixes in this tool's own code,
not ctags/tree-sitter/GitGalaxy defects:

Fixed in ctags_reader.py (two separate bugs found across the 3
dispatches, both in THIS tool's own ctags output parsing):
- read_ctags_symbols did a blind line.split("\t") on ctags' raw tag
  output. Old-style C source using literal TAB characters for column
  alignment (confirmed real: language-crucible/data/c/doom/i_system.c's
  `byte*\tI_AllocLow(int length)`) gets that tab echoed verbatim into
  ctags' address/pattern field, which then shifts every column after
  it -- silently misreading a fragment of the SOURCE LINE as the kind
  field and dropping the symbol. Reproduced byte-for-byte by running
  ctags with this code's exact flags. Fixed: parse now locates the
  tag-file format's guaranteed `;"` address-terminator instead of
  blind-splitting the whole line. Resolved 5 of
  c/function/existence/agree[gitgalaxy,tree_sitter]_vs[ctags]'s 8
  occurrences outright.
- CTAGS_CLASS_KINDS["c"] was struct-only ({"s"}), but GitGalaxy's own C
  class_start regex is struct|union|enum -- ctags itself parses enum/
  union declarations fine (confirmed via direct runs against
  sqlite/lemon.c and others), this map was silently dropping them
  before reconciliation ever saw them. Fixed: now {"s", "g", "u"}.
  Resolved all 9 occurrences of
  c/class/existence/agree[gitgalaxy,tree_sitter]_vs[ctags].

New evidence added to docs/why_gitgalaxy_beats_ast_here.md (no code fix
-- genuine tree-sitter-c grammar limitations, not defects in this
repo's tooling):
- 3 remaining occurrences of the 8-count shape above: the sibling
  SLOT-macro-swallows-the-next-function mechanism already documented
  for the 7-occurrence ctags shape, just also missing the real function
  right after the macro invocation, not only mistagging the macro name.
- c/function/existence/agree[ctags,gitgalaxy]_vs[tree_sitter] (13): a
  C-scale instance of Claim 7 (CPP-directive recall loss, previously
  only cited for Fortran) -- 3 distinct trigger shapes confirmed
  (#if/#else splitting an if-condition mid-body, #if/#endif wrapping
  only a `static` specifier, bare un-semicoloned diagnostic-pragma
  macros), all local single-function losses rather than Fortran's
  cascading whole-section loss.

All 11 c tri-comparison ledger shapes are now validated. Every applied
verdict's file:line citations and code claims were independently
re-verified against real source or live ctags runs before being
trusted -- multiple dispatches were caught needing correction or
additional scrutiny during review, none accepted on a dispatched
agent's word alone.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Add docs/language_status/c.md -- full doc plus tri-comparison capstone

First real run of the new capstone step (tri-comparison-ledger-sweep
skill, #1878): once a language's ledger backlog fully clears, write it
up while the full picture is still cheap to synthesize from context.

Sections 1-8 (identification surface, what's detected/not tracked,
known limitations, test depth, closed work, real-world evidence) via
the existing language-status skill, dispatched as a background task in
parallel with this section -- 50/52 rule keys wired, 128 total
dedicated test cases, 3 real C-specific engine bugs found and fixed
historically (#1754, #1282, #1646) plus 2 measurement-tool-only
findings correctly distinguished from engine defects (#1265, #1641).

Section 9 is new: a tri-comparison capstone, written from this
session's own C sweep (11/11 ledger shapes resolved, 766 occurrences).
Headline: zero confirmed GitGalaxy engine defects found across the
entire sweep -- contrast with rust's same-methodology pass, which found
2 real ones (#1872). Current measured numbers back the claim: GitGalaxy
has the highest function precision of the three tools on this corpus
(99.8% vs ctags' 99.6% vs tree-sitter's 95.9%), and classes/args are
now fully tied at 100% across all three after this session's fixes.
Documents where GitGalaxy wins outright (macro-body/CPP-directive
immunity, both fed back into why_gitgalaxy_beats_ast_here.md's Claims
3/7/8), where the other tools have real documented gaps, and the two
real bugs found in this repo's own comparison tooling along the way.

Updated docs/language_status/README.md's c row: not written -> written,
stale 37-test count -> live 42.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
squid-protocol added a commit that referenced this pull request Aug 20, 2026
…triage queue (#1881)

* Resolve 5 more c tri-comparison shapes, 2 more tooling fixes (8/11 total)

Third round on the c backlog, all resolved directly (no dispatch needed
-- clear patterns confirmed via direct source/ctags reads):

Fixed in tri_comparison_gatherer.py:
- c/class/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] (23): ctags
  synthesizes __anon<hex> placeholder names for anonymous struct/union/
  enum (e.g. `typedef struct { ... } Foo;`). Neither GitGalaxy nor
  tree-sitter report a name for these (correctly -- there isn't one).
  Added _is_ctags_synthetic_anon_name(), same category as GitGalaxy's
  own existing _SYNTHETIC_GG_CLASS_NAMES exclusion, applied to both
  ctags func and class readings.

Documented in ctags_reader.py (not code-fixed -- would require a
curated name list, the same ground-truth-judgment category this
module's own docstring keeps out of the raw readers):
- c/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] (7):
  ctags misreads bare macro-invocation lines (RICHCMP_WRAPPER(lt,
  Py_LT), SLOT1(slot_mp_subscript, __getitem__, PyObject *)) as
  function definitions.

New evidence added to docs/why_gitgalaxy_beats_ast_here.md:
- c/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] (4): a
  third, narrower instance of Claim 3 (parse-error cascade) -- a bare
  SLOT0/SLOT1 macro-invocation line with no expansion available locally
  confuses both ctags and tree-sitter's parse of the SINGLE real
  function immediately following it (recovers after one function, not
  a full cascade). 4/4 sampled sites confirmed same shape.

Not new findings, already covered:
- c/function/existence/agree[ctags,tree_sitter]_vs[gitgalaxy] (3):
  EXPORT_FUN and MICROPY_WRAP_MP_EXECUTE_BYTECODE are both already in
  _C_KNOWN_MACRO_HALLUCINATIONS.

Structural ambiguity, not a defect:
- c/function/args/agree[ctags,gitgalaxy]_vs[tree_sitter] (1):
  gc_mark_subtree has two genuinely valid signatures under
  #if MICROPY_GC_SPLIT_HEAP / #else -- which one a tool picks up isn't
  a real disagreement, no preprocessor evaluation happens in any of
  the three tools.

8 of 11 c shapes now validated. 3 dispatched Gemini investigations
still running on the remaining genuine mysteries (13/9/8-occurrence
shapes spanning multiple files with no obvious single cause from the
sample alone).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Resolve final 3 c tri-comparison shapes -- all 11/11 now validated

Pool of 3 Gemini dispatches, all reviewed and independently re-verified
before being applied -- two led to real fixes in this tool's own code,
not ctags/tree-sitter/GitGalaxy defects:

Fixed in ctags_reader.py (two separate bugs found across the 3
dispatches, both in THIS tool's own ctags output parsing):
- read_ctags_symbols did a blind line.split("\t") on ctags' raw tag
  output. Old-style C source using literal TAB characters for column
  alignment (confirmed real: language-crucible/data/c/doom/i_system.c's
  `byte*\tI_AllocLow(int length)`) gets that tab echoed verbatim into
  ctags' address/pattern field, which then shifts every column after
  it -- silently misreading a fragment of the SOURCE LINE as the kind
  field and dropping the symbol. Reproduced byte-for-byte by running
  ctags with this code's exact flags. Fixed: parse now locates the
  tag-file format's guaranteed `;"` address-terminator instead of
  blind-splitting the whole line. Resolved 5 of
  c/function/existence/agree[gitgalaxy,tree_sitter]_vs[ctags]'s 8
  occurrences outright.
- CTAGS_CLASS_KINDS["c"] was struct-only ({"s"}), but GitGalaxy's own C
  class_start regex is struct|union|enum -- ctags itself parses enum/
  union declarations fine (confirmed via direct runs against
  sqlite/lemon.c and others), this map was silently dropping them
  before reconciliation ever saw them. Fixed: now {"s", "g", "u"}.
  Resolved all 9 occurrences of
  c/class/existence/agree[gitgalaxy,tree_sitter]_vs[ctags].

New evidence added to docs/why_gitgalaxy_beats_ast_here.md (no code fix
-- genuine tree-sitter-c grammar limitations, not defects in this
repo's tooling):
- 3 remaining occurrences of the 8-count shape above: the sibling
  SLOT-macro-swallows-the-next-function mechanism already documented
  for the 7-occurrence ctags shape, just also missing the real function
  right after the macro invocation, not only mistagging the macro name.
- c/function/existence/agree[ctags,gitgalaxy]_vs[tree_sitter] (13): a
  C-scale instance of Claim 7 (CPP-directive recall loss, previously
  only cited for Fortran) -- 3 distinct trigger shapes confirmed
  (#if/#else splitting an if-condition mid-body, #if/#endif wrapping
  only a `static` specifier, bare un-semicoloned diagnostic-pragma
  macros), all local single-function losses rather than Fortran's
  cascading whole-section loss.

All 11 c tri-comparison ledger shapes are now validated. Every applied
verdict's file:line citations and code claims were independently
re-verified against real source or live ctags runs before being
trusted -- multiple dispatches were caught needing correction or
additional scrutiny during review, none accepted on a dispatched
agent's word alone.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Add docs/language_status/c.md -- full doc plus tri-comparison capstone

First real run of the new capstone step (tri-comparison-ledger-sweep
skill, #1878): once a language's ledger backlog fully clears, write it
up while the full picture is still cheap to synthesize from context.

Sections 1-8 (identification surface, what's detected/not tracked,
known limitations, test depth, closed work, real-world evidence) via
the existing language-status skill, dispatched as a background task in
parallel with this section -- 50/52 rule keys wired, 128 total
dedicated test cases, 3 real C-specific engine bugs found and fixed
historically (#1754, #1282, #1646) plus 2 measurement-tool-only
findings correctly distinguished from engine defects (#1265, #1641).

Section 9 is new: a tri-comparison capstone, written from this
session's own C sweep (11/11 ledger shapes resolved, 766 occurrences).
Headline: zero confirmed GitGalaxy engine defects found across the
entire sweep -- contrast with rust's same-methodology pass, which found
2 real ones (#1872). Current measured numbers back the claim: GitGalaxy
has the highest function precision of the three tools on this corpus
(99.8% vs ctags' 99.6% vs tree-sitter's 95.9%), and classes/args are
now fully tied at 100% across all three after this session's fixes.
Documents where GitGalaxy wins outright (macro-body/CPP-directive
immunity, both fed back into why_gitgalaxy_beats_ast_here.md's Claims
3/7/8), where the other tools have real documented gaps, and the two
real bugs found in this repo's own comparison tooling along the way.

Updated docs/language_status/README.md's c row: not written -> written,
stale 37-test count -> live 42.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Correct a real overclaim: cross-reference pre-existing C/C++ args issues

Caught during issue triage of the open queue: #1837 (filed 2026-08-18,
before this sweep started) already reports gc_mark_subtree
(micropython/gc.c) -- the exact function the tri-comparison ledger's
own c/function/args/agree[ctags,gitgalaxy]_vs[tree_sitter] (1
occurrence) entry investigated -- as a real, fixable gap. That entry's
original verdict ("inherent CPP-conditional-compilation ambiguity, not
a defect, not chased further") was too quick to dismiss it as
unfixable when a reasoned fix proposal already existed. Corrected the
verdict to point at #1837 instead of waving the question off.

That correction exposed a broader overclaim in docs/language_status/
c.md's §9: "zero confirmed GitGalaxy engine defects" is only true for
defects THIS SWEEP'S 3-way discrepancy methodology could surface --
it can't catch a bug all three tools independently fail to disagree
about, or one outside the pinned corpus sample. Four real,
independently-filed C/C++ _count_top_level_args/_slice_by_braces
issues exist and predate this sweep, none of them surfaced by it
(#1836, #1837, #1853, #1854) -- added an explicit scope caveat so the
headline number can't be cited as "no known C args-counting bugs"
without also surfacing these.

Also, while triaging the open issue queue: labeled #1853/#1854/#1837/
#1836 (bug/core-engine/testing/priority:medium, previously unlabeled)
and closed #1852 as a duplicate of #1872 (filed independently for the
identical rust/scala lifetime bug, a day after #1852 -- should have
searched before filing; #1872 has the fuller diagnosis so it's the
one that stays open, cross-referenced in both directions).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Let a validated verdict actually move the score, not just annotate it

Real gap surfaced by direct user feedback: GitGalaxy's C func precision
sat at 99.77% (1726/1730) even after the ledger fully confirmed the
remaining 4 (slot_tp_hash, slot_mp_ass_subscript, slot_tp_repr,
slot_nb_inplace_power -- the SLOT-macro-adjacency Claim 3 instance) are
real functions, not false positives. Validating an entry only ever
gated the chart's asterisk/badge presentation -- the raw agreement-
based percentage itself had no path to reflect a human-confirmed truth.

New tri_comparison_ledger.py mechanism: `credit_tools` (empty list by
default, migrated onto all 140 existing entries), set deliberately
alongside `verdict` -- never inferred from prose -- only when a
validated verdict cleanly confirms ONE specific tool correct on an
otherwise-uncorroborated claim, not just "validated" in general (most
validated shapes don't resolve that cleanly: a structural ambiguity, a
mixed multi-cause shape, or an already-known-wrong tool's agreement
with another wrong tool -- which should NOT be rewarded, see the
module's own note on the deliberately-unimplemented symmetric "debit"
case). `apply_verified_credit()` adds the shape's current occurrence
count into the credited tool's matched_consensus for precision only --
never total_slots, never recall/found-count (never ranked to begin
with).

Set for exactly one shape this pass, per the user's own request to
scope this to C: c/function/existence/agree[gitgalaxy]_vs[ctags,
tree_sitter], credit_tools=["gitgalaxy"]. Result: GitGalaxy's C func
precision now genuinely reads 100% (1730/1730) -- confirmed via direct
before/after pipeline run, and the regenerated 45-language chart diffs
to exactly one changed cell (this one), confirming no other language
was touched. docs/language_status/c.md's numbers and a new explanatory
footnote updated to match, including a pointer to the still-open debit
case for ctags/tree-sitter's own inflated precision on the sibling
macro-hallucination shape.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Add the symmetric debit case, generalize apply_verified_credit

Follow-up to the credit mechanism from the previous commit -- the
symmetric case flagged there as deliberately deferred: two tools
agreeing with each other on a claim a validated verdict confirms is a
SHARED MISTAKE currently gets rewarded as if it were real corroboration.

Renamed apply_verified_credit -> apply_verified_adjustments (same
function now handles both directions in one pass over the groups, no
double-iteration): credit_tools adds a shape's occurrence count into a
tool's matched_consensus, debit_tools subtracts it. Migrated
debit_tools: [] onto all 140 existing ledger entries alongside the
credit_tools migration.

Set for exactly one shape (still scoped to C per the earlier request):
c/function/existence/agree[ctags,tree_sitter]_vs[gitgalaxy],
debit_tools=["ctags", "tree_sitter"] -- EXPORT_FUN and
MICROPY_WRAP_MP_EXECUTE_BYTECODE are both already-known macro
hallucinations (tree_sitter_accuracy_audit.py's
_C_KNOWN_MACRO_HALLUCINATIONS) that ctags and tree-sitter each
independently mis-tag the same way, confirmed in that entry's own
verdict; their mutual agreement was never real corroboration.

Verified: tree-sitter's C func precision 95.87% -> 95.70% (1716->1713),
ctags' 99.6% -> 99.42% (1726->1723), both down by exactly 3 (the
shape's occurrence count), GitGalaxy unaffected. Regenerated the full
45-language chart and diffed it -- exactly 2 cells changed anywhere in
the entire chart (tree-sitter and ctags' C func-precision labels),
confirming the mechanism stayed precisely scoped.

docs/language_status/c.md's numbers and explanatory footnote updated
to describe both directions together.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
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.

1 participant