Skip to content

Resolve 8 of 11 c tri-comparison ledger shapes, 2 more tooling fixes - #1876

Merged
squid-protocol merged 3 commits into
mainfrom
c-ledger-sweep-round2
Aug 19, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
c-ledger-sweep-round2

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Continuing the tri-comparison-ledger-sweep on c (following #1873). 8 of 11 shapes resolved this round, all 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. Added _is_ctags_synthetic_anon_name(), same category as GitGalaxy's own _SYNTHETIC_GG_CLASS_NAMES exclusion.

Documented in ctags_reader.py (not code-fixed -- would require a curated name list, the same ground-truth-judgment category this module's 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 macro-invocation line locally confuses both other tools' parse of the single real function immediately following it, recovering after just one function rather than cascading.

Not new findings, already covered:

  • c/function/existence/agree[ctags,tree_sitter]_vs[gitgalaxy] (3): both names already in _C_KNOWN_MACRO_HALLUCINATIONS.

Structural ambiguity, not a defect:

  • c/function/args/agree[ctags,gitgalaxy]_vs[tree_sitter] (1): two genuinely valid signatures under #if MICROPY_GC_SPLIT_HEAP/#else -- no tool runs a real preprocessor.

3 shapes remain (13/9/8 occurrences, multi-file, no obvious single cause from the sample) -- dispatched to Gemini, in progress separately.

Verification

  • ruff_audit.py --ci / mypy_audit.py --ci: no new findings beyond baseline.
  • Every applied verdict's citations independently confirmed via direct source or live ctags reads before being trusted.

Test plan

  • ruff_audit.py --ci / mypy_audit.py --ci clean.
  • _is_ctags_synthetic_anon_name verified: matches real __anon<hex> names, doesn't match ordinary identifiers.

🤖 Generated with Claude Code

…tal)

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]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

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]>
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 6d872e0 into main Aug 19, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the c-ledger-sweep-round2 branch August 19, 2026 23:56
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