Skip to content

Correct overclaim in c.md, cross-reference pre-existing args issues, triage queue - #1881

Merged
squid-protocol merged 7 commits into
mainfrom
c-ledger-sweep-round2
Aug 20, 2026
Merged

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

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Follow-up to #1876 (merged). Caught during a pass over the open issue queue that this repo's docs/language_status/c.md §9 overclaimed "zero confirmed GitGalaxy engine defects" without a needed scope caveat, and along the way triaged several unlabeled/duplicate open issues.

The correction: #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 c/function/args/agree[ctags,gitgalaxy]_vs[tree_sitter] entry investigated -- as a real, fixable gap (no preprocessor model, #if/#else-duplicated signatures behave undefined). That entry's original verdict ("inherent ambiguity, not a defect, not chased further") was too quick to write it off. Corrected the verdict, and added an explicit scope caveat to c.md's §9: "zero defects found" is only true for what this sweep's 3-way discrepancy methodology could surface -- it can't catch a bug all three tools independently fail to disagree about. Four real, pre-existing, independently-filed C/C++ args-counting issues exist and predate this sweep, none surfaced by it (#1836, #1837, #1853, #1854) -- now cross-referenced explicitly.

Issue queue triage (labels + duplicate cleanup):

Test plan

  • docs/self_scan/tri_comparison_ledger.json validated as parseable JSON after the verdict edit.
  • Docs-only change otherwise -- no code/audits affected.

🤖 Generated with Claude Code

squid-protocol and others added 5 commits August 19, 2026 19:15
…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]>
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]>
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]>
# Conflicts:
#	docs/language_status/c.md
#	docs/self_scan/tri_comparison_ledger.json
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits August 19, 2026 20:28
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]>
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]>
@squid-protocol
squid-protocol merged commit e7feb69 into main Aug 20, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the c-ledger-sweep-round2 branch August 20, 2026 01:06
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.

Bug: Rust/Scala Lifetime & Symbol Parsing Error in _count_top_level_args

1 participant