Skip to content

Validate python tri-comparison ledger; fix Cython func_start recall gap - #2001

Merged
squid-protocol merged 2 commits into
mainfrom
chore/tri-comparison-sweep-python
Aug 21, 2026
Merged

Validate python tri-comparison ledger; fix Cython func_start recall gap#2001
squid-protocol merged 2 commits into
mainfrom
chore/tri-comparison-sweep-python

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • Runs the tri-comparison-ledger-sweep skill on python: all 4 previously-unvalidated
    ledger shapes are now status: validated, clearing python's backlog entirely.
  • Fixes python func_start regex misses Cython cdef/cpdef module-level function definitions #1999: func_start for python only matched the literal def keyword, so Cython's
    cdef/cpdef module-level function definitions (.pyx/.pxd/.pxi are deliberately routed
    under python's extension set) were a complete recall gap -- 68 real functions, ctags-corroborated,
    0 found by GitGalaxy. Added a second func_start alternative, excluding cdef class/struct/
    enum/union/extern/packed/fused (declarations, not functions).
  • Fixes tri_comparison_gatherer.py's ctags args counter miscounts a comma inside a quoted string-literal default value #2000: tri_comparison_gatherer.py's ctags args counter mis-split a comma inside a quoted
    string-literal default value. Fixed with quote-tracking -- caught and fixed a self-inflicted
    regression on a real rust shape mid-fix (Rust lifetimes are a bare apostrophe with no closing
    quote), verified by re-running the full multi-language reconciliation, not just python's, before
    landing.
  • Adds a class-level addendum to docs/why_gitgalaxy_beats_ast_here.md's existing Claim 2
    (tree-sitter-python has no concept of Cython's cdef class at the class level either, not just
    method-level scope loss).
  • Adds a "Tri-comparison findings" section (§10) to docs/language_status/python.md as the
    sweep's capstone.

Verification

  • New extraction-gauntlet cases in tests/extraction/languages/test_python.py
    (valid/invalid/pathological + a dedicated ReDoS sweep for the new branch) -- all pass.
  • python tests/tools/crucible_check.py against the full ~80-repo corpus: 31 diffs, all scoped to
    python/cython (plus expected timestamp churn), both golden masters re-blessed
    (update_golden_master.py --yes).
  • ruff_audit.py --ci / mypy_audit.py --ci: no new findings beyond baseline.
  • Full ledger/chart/points-of-interest regeneration (tri_comparison_chart.py --all --write,
    tri_comparison_report.py --write) diffed to confirm only python (and a transient rust
    shape that resolved back to non-reproducing) changed -- no other language's real data moved.

Test plan

  • pytest tests/extraction/languages/test_python.py tests/extraction/languages/test_python_strict.py tests/extraction/languages/test_embedded_python.py tests/extraction/languages/test_embedded_python_strict.py
  • crucible_check.py (full corpus, both venvs) -- PASS after reblessing
  • ruff_audit.py --ci / mypy_audit.py --ci -- clean
  • Chart/ledger/report regeneration diffed for blast-radius confirmation

Fixes #1999, Fixes #2000

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 20, 2026 22:58
…investigation

Adds the args-granularity taxonomy (per_function/program_level/none/proxy),
the direct-dispatch-when-obvious refinement to step 1, and the confirmed
fix-and-ship-in-same-pass extension to step 4.3 bucket 1, all learned during
prior sweep sessions but never committed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…on ledger

tri-comparison-ledger-sweep on python: all 4 unvalidated shapes were investigated
directly (no dispatch needed, corpus evidence was conclusive) and are now
status:validated, closing python's ledger backlog entirely.

Two real, fixed defects found:
- #1999: python's func_start regex only matched the literal `def` keyword, so
  Cython's `cdef`/`cpdef` module-level function definitions (no `def` at all)
  were a complete recall gap -- 68 real functions across cython/MemoryView.pyx
  (52) and .pxd (16) in the crucible corpus, ctags-corroborated, 0 found by
  GitGalaxy. Added a second func_start alternative for cdef/cpdef signatures,
  excluding cdef class/struct/enum/union/extern/packed/fused (declarations,
  not functions). One narrow residual gap left undone: a Tempita `{{template}}`
  return-type placeholder in one codegen-artifact function.
- #2000: tri_comparison_gatherer.py's ctags args counter mis-split a comma
  inside a quoted string-literal default value (numpy/crackfortran.py's
  markoutercomma(line, comma=','):). Fixed with quote-tracking, tightly bounded
  for single-quotes specifically because Rust's lifetime syntax (`&'a str`,
  `Context<'_>`) is also a bare apostrophe with no closing quote -- an
  initial looser bound silently regressed a previously-clean rust shape by
  treating two unrelated lifetimes as one fake string, caught by re-running
  the full multi-language reconciliation before trusting the fix.

Two shapes confirmed as non-defects: tree-sitter-python has no concept of
Cython's `cdef class` syntax at either the class or method level (documented
as Claim 2 in docs/why_gitgalaxy_beats_ast_here.md, now extended with the
class-level evidence too).

Verified: new extraction-gauntlet cases in test_python.py (valid/invalid/
pathological + ReDoS sweep), crucible_check.py against the full ~80-repo
corpus (31 diffs, all scoped to python/cython, both golden masters
re-blessed), ruff/mypy audits clean. Ledger, chart, and points-of-interest
regenerated; docs/language_status/python.md gets a new tri-comparison
findings section (backlog capstone).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@squid-protocol
squid-protocol merged commit dba7218 into main Aug 21, 2026
26 of 27 checks passed
@squid-protocol
squid-protocol deleted the chore/tri-comparison-sweep-python branch August 21, 2026 03:40
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant