Skip to content

Python parser: fix 10 finder bugs#112

Open
gadievron wants to merge 4 commits into
masterfrom
pr/python-parser
Open

Python parser: fix 10 finder bugs#112
gadievron wants to merge 4 commits into
masterfrom
pr/python-parser

Conversation

@gadievron

Copy link
Copy Markdown
Collaborator

Python parser: fix 10 finder bugs

Local-only branch pr/python-parser off master 368b559. One of a coordinated 7-PR set fixing parser/reachability bugs found by the OpenAnt finder. File-disjoint from the other 6 PRs (no merge collision; any order).

Addresses 11 finder bug-ids (10 distinct fixes; 1 ride a same-PR canonical).

Bugs fixed

  • [9] py-nested-extraction (python/extraction_gap) — genuinely-new (no prior logged entry)
  • [10] py-builtin-time (python/masking_floor) — genuinely-new (no prior logged entry)
  • [12] py-dataflow-alias (python/dataflow_loss) — genuinely-new (no prior logged entry)
  • [21] python-extraction_gap-498 (python/extraction_gap) — genuinely-new (no prior logged entry)
  • [23] python-metadata-293-startline (python/metadata_correctness) — genuinely-new (no prior logged entry)
  • [27] python-wrong_edge-333 (python/wrong_edge) — genuinely-new (no prior logged entry)
  • [34] python-metadata-225-property (python/metadata_correctness) — genuinely-new (no prior logged entry)
  • [45] python-extraction_gap-325-nestedclass (python/extraction_gap) — genuinely-new (no prior logged entry)
  • [46] python-namespace_dispatch-264 (python/namespace_dispatch) — genuinely-new (no prior logged entry)
  • [47] python-masking_floor-201 (python/masking_floor) — duplicate of [10] in this PR; closed by the same fix (no separate change)
  • [48] python-metadata-232-testsubstr (python/metadata_correctness) — Fixes BUG-059 (previously logged; was fixed only on an unmerged branch, still live on master 368b559)

Dedup status (independent + judge, from raw)

9 genuinely-new · 1 duplicate-of-curated (cross-ref above) · 0 covered-by-curated · 1 intra-PR-duplicate. All re-confirmed STILL PRESENT on pristine master 368b559 (git show 368b559:).

Tests

Verified GREEN in isolation off pristine 368b559: 25 passed (tests/parsers/python/). New per-bug regression tests. (No test_<lang>_schema_completeness.py / test_callgraph_symmetry.py parser-infra in this PR — a follow-up; master has none either.)

Notes

  • TDD per bug (RED→GREEN); independent + judge verified each fix from raw against master.
  • No behavior change outside the listed parser(s).

🤖 Generated with Claude Code

gadievron and others added 4 commits June 9, 2026 23:29
…,21,23,34,45,48)

Pilot unit of the local-only finder-fixes-54 batch (base GitHub master 368b559).
TDD; 8 RED->GREEN tests in tests/parsers/python/test_function_extractor_u9.py
(full python parser suite: 12 passed). Verified per-bug pytest summary inline.

- [9]  recurse into function bodies (_process_function_tree) — nested def extracted
- [21] emit module-level name-bound lambdas (handler = lambda ...)
- [23] start_line = first decorator line (was the def line; off-by-N for stacked)
- [34] classify @x.setter/@x.deleter as 'property'; getter keeps canonical
       func_id C.x, setter -> qualified_name C.x.setter (role suffix), preserving
       func_id == path:qualified_name (the call_graph_builder reconstruction
       invariant) — order-independent + adds property_role metadata
- [45] recurse into nested classes (_process_class_tree) — Outer.Inner.deep
- [48] classify test by path COMPONENTS / basename conventions, not the bare
       substring 'test' (latest.py no longer mis-flagged)

Reconciliation: a BLIND /bug-fix derivation initially used an order-based #N
func_id suffix for [34]; an independent re-derivation + judge (vs the prepared
fix-design recommendation) found it breaks the path:qualified_name invariant and
is order-dependent. Replaced with the role-in-qualified_name scheme (judge: SHIP
the other 5 as-is). _store_function residual collisions now disambiguate by
source line (#L<line>), not emission order.

Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit 24510d1a071b131e8b48aa089d4dbe28c61aa50f)
…t-overresolve/inherited-self (BUG-NEW 10,12,27,46)

Local-only finder-fixes-54 (base master 368b559). TDD; 5 tests in the new
tests/parsers/python/test_call_graph_builder_u*.py. Judge (vs prepared
recommendation, independent re-derivation from raw): AGREE / SHIP-AS-IS.
CM-B builtin pre-check scoped SAME-FILE (judge-confirmed: no global cross-file
fallback; genuine-builtin non-link pinned by a negative test). Combined parser
suite: 70 passed, 10 skipped.

Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit e083dbf1ea0cafcb3cf38e9b87c472dceba13574)
…tion (cached_property)

Re-verification (independent + judge, from raw) of the shipped [34] property fix.
Mechanism confirmed sound (C.x.setter qualified_name is NOT mis-resolved — resolvers
match the name field). Found + fixed a real gap: classify_function matched the literal
'@Property', so @cached_property/@functools.cached_property getters were classified
unit_type='method' while property_role='getter' (inconsistent). Routed classification
through a NARROWED _property_role that matches the decorator's final dotted TOKEN
(property|cached_property|setter|deleter) — fixes cached_property AND a pre-existing
over-match (a judge caught that a naive 'property' substring mislabels
@app.property_route / @some_property_validator). +6 tests incl. a negative guard.
python parser suite: 25 passed.
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit cd03699483e5046e7af0ee7721c9b6f07ecaa3fe)
…inding (BUG-NEW 12)

Python hunk of the alias-guard (ruby hunk ships in the ruby PR). Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gadievron

Copy link
Copy Markdown
Collaborator Author

Merge-order note (not a defect — flagging for landing order)

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