Skip to content

Close the last python Cython func_start recall gap (get_slice_from_memview) - #2007

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

Close the last python Cython func_start recall gap (get_slice_from_memview)#2007
squid-protocol merged 1 commit into
mainfrom
chore/tri-comparison-sweep-python

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Follow-up to #2001 (merged). That PR closed 68/69 missing Cython cdef/cpdef function
occurrences but left one documented residual gap: get_slice_from_memview in
cython/MemoryView.pyx, whose return type is a Cython Tempita codegen placeholder
(cdef {{memviewslice_name}} *get_slice_from_memview(...)).

Closing it took two fixes, not one:

  • Widened func_start's return-type token to also accept a bounded {{identifier}} placeholder
    form.
  • That alone wasn't enough -- it surfaced a second, independent bug in the shared
    _extract_name name-normalizer (detector.py, used by every language, not just python): its
    generic split("{") truncation (meant to cut a C-style body-opening brace off the raw match)
    mistook the placeholder's own {{/}} for that brace, truncating the match down to the bogus
    name "cdef" instead of the real name. This was invisible from the isolated regex alone -- it
    only surfaced once checked against the real scan pipeline's actual DB output (the DB was
    recording a phantom function literally named cdef at that line).

GitGalaxy now finds all 84 real functions in cython/MemoryView.pyx -- 100% recall vs. ctags,
no residual gap.
The python/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] ledger
shape no longer reproduces at all.

Verification

  • New test cases: tests/extraction/languages/test_python.py (func_start regex, valid case +
    dedicated ReDoS sweep) and tests/core_engine/test_detector.py (_extract_name, since that fix
    is shared infrastructure across every language).
  • python tests/tools/crucible_check.py against the full ~80-repo corpus: diffs scoped only to
    python/cython/MemoryView.pyx's Function Analysis, both golden masters re-blessed.
  • ruff_audit.py --ci / mypy_audit.py --ci: no new findings beyond baseline.
  • Full ledger/chart/points-of-interest regeneration diffed to confirm only python's real data
    moved -- no other language affected by the shared _extract_name change.
  • Updated docs/language_status/python.md §10 and filed a follow-up comment on python func_start regex misses Cython cdef/cpdef module-level function definitions #1999.

Test plan

  • pytest tests/extraction/languages/test_python.py tests/core_engine/test_detector.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

🤖 Generated with Claude Code

…mview)

Follow-up to the tri-comparison-ledger-sweep fix in #1999: one function was
still missing after that fix -- get_slice_from_memview's return type is a
Cython Tempita codegen placeholder (cdef {{memviewslice_name}} *get_slice_
from_memview(...)), which the plain-identifier return-type token couldn't
match.

Closing it took two fixes, not one:
- Widened func_start's return-type token to also accept a bounded
  {{identifier}} placeholder form.
- That alone wasn't enough: it surfaced a second, independent bug in the
  shared _extract_name name-normalizer (detector.py, used by every language).
  Its generic split("{") truncation mistook the placeholder's own {{/}} for
  a C-style body-opening brace, truncating the match down to the bogus name
  "cdef" instead of the real name -- invisible from the isolated regex alone,
  only visible once checked against the real scan pipeline's actual DB output.

GitGalaxy now finds all 84 real functions in cython/MemoryView.pyx (100%
recall vs. ctags, up from 83/84) -- the
python/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] ledger shape
no longer reproduces at all.

Verified: new test cases in test_python.py (func_start regex + ReDoS sweep)
and test_detector.py (_extract_name, since that fix is shared infrastructure);
crucible_check.py against the full ~80-repo corpus (diffs scoped only to
python/cython, both golden masters re-blessed again); ruff/mypy clean; ledger/
chart/report regenerated and diffed to confirm only python's real data moved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@squid-protocol
squid-protocol merged commit 5f82b6f 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 12:05
@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

Development

Successfully merging this pull request may close these issues.

1 participant