fix(python): scope-resolution coverage gaps — F57, F58, F61 (#1932)#1964
fix(python): scope-resolution coverage gaps — F57, F58, F61 (#1932)#1964prajapatisparsh wants to merge 9 commits into
Conversation
…patwari#1932) F57: heritage patterns for qualified/subscripted bases F58: decorator patterns for nested-attribute decorators F61: lambda captured as @scope.function F59 already closed by abhigyanpatwari#1920, F60 legacy-only
|
@prajapatisparsh is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 10772 tests passed 10 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
|
Could you please resolve the conflict? |
magyargergo
left a comment
There was a problem hiding this comment.
Methods
5 Claude lanes (gitnexus-risk-architect, gitnexus-test-ci-verifier, ce-correctness-reviewer, ce-adversarial-reviewer) + Codex (codex-rescue). Codex was live. Two engines are Claude under different personas; strong signal = Codex + Claude agreement on decorator wiring and golden drift.
Final verdict
not production-ready
Capture/query work for F58/F61 and new tests are directionally right, but F58 does not reach ReferenceSites, the python-captures golden is still stale (reproduced locally), and the PR lowers global coverage thresholds while CI remains red. F57 query patterns are largely redundant on this branch because merged main already ships synthesizePythonInheritanceReferences in captures.ts (#1951)—qualified bases do emit inherits sites today; the PR’s @heritage.* tags remain topic: unknown in scope-extractor.ts.
Merge state classification
checks failing
Branch hygiene classification
merge-from-main commit present but harmless and merge-safe
Review bar for this PR
Issue #1932: close Python scope-resolution gaps F57 (heritage shapes), F58 (decorators), F61 (lambda scopes). Expect capture + registry-primary graph effects, golden/bench parity, and green CI.
Current PR state
- 5 files in GitHub diff:
query.ts, integration tests,heritage.py, bench fingerprint,vitest.config.ts. - 10/10 new integration tests pass locally (
emitPythonScopeCapturesonly). - Cross-repo head from
prajapatisparsh/fix/python-parsing-coverage.
Merge status and mergeability
mergeable: MERGEABLE, mergeStateStatus: BLOCKED (required checks). Two merge-from-main commits on the branch; no conflict markers in the reviewed diff.
Repository history considered
- #1951 / #1956 migrated inheritance to scope-resolution (
captures.tssynthesis)—landed via merge frommain, not in this PR’s 5-file diff. - Prior CI on older SHA showed golden failure; latest run still has benchmarks FAIL (coverage/scope-parity pending at review time).
PR-specific assessment
Parser / scope query (query.ts)
- F61 lambda
(lambda) @scope.function: createsFunctionscopes — solid[code-read]. - F58 decorators
@reference.decorator.call: emitted by tree-sitter, dropped inpass5CollectReferencesbecausereferenceKindFromAnchorhas nodecoratorhead (scope-extractor.ts:1027-1048, guard at :990-991).[code-read]extractParsedFile(@login_required)→referenceSites: []. - F57
@heritage.*in query: matches aretopicOf→unknown(scope-extractor.ts:259-270) and skipped. However,captures.ts:208-225synthesizes@reference.inheritsfrom AST on merged head —class A(mod.Base)→{name:'Base', kind:'inherits'}[code-read]. PR query heritage is not what fixes EXTENDS on current head. - Duplicate captures:
@api.v1.endpoint→ 2 identical@reference.decorator.callrows (patterns at :260-270 overlap)[reproduced].
Tests / CI
- P0 Golden
expected-captures.jsonnot updated;python-captures-golden.test.tsfails (189 vs 190 keys;synthetic:dao-20+20 groups from new decorator captures)[reproduced]. - P2
vitest.config.tslowers all four coverage floors by 1 point—risks masking regressions while golden is still red. - Tests never call
extractParsedFile/ assert graph edges for F58.
Back-and-forth avoided by verifying
- Ran
python-parsing-coverage.test.ts(pass) andpython-captures-golden.test.ts(fail). emitPythonScopeCapturesduplicate count for nested decorators.extractParsedFilefor decorator andclass A(mod.Base)on PR head.bench/python-scope/measure.mjs --checkPASS locally; CI benchmarks job FAIL on latest SHA (log pending).
Open questions
- Is lowering
vitestcoverage thresholds intentional for capture inflation, or should golden regeneration make that unnecessary? - Should F58 use
@reference.call.member/.freeinstead of a newdecoratortag?
Inline findings (summary)
- P0 —
@reference.decorator.callnever becomes aReferenceSite. - P1 — Overlapping nested-decorator patterns double-match.
- P2 — Tests only assert capture layer; F58 untested end-to-end.
- P2 — Coverage thresholds lowered in
vitest.config.ts.
Lower priority (body only)
- Regenerate
test/fixtures/python-captures-golden/expected-captures.json(UPDATE_GOLDEN=1 …) — blocks merge. heritage.pyunused by tests;PYTHON_QUERIESdecorator block still single-hopidentifierreceiver (legacy routes)—out of this diff.@app.routestill produces module-scoped@reference.call.memberfor innerroutecall (pre-existing path).
Refuted / validated
- Refuted as sole F57 fix: query-only
@heritage.*without pipeline wiring (superseded on branch bycaptures.tssynthesis from main). - Validated: F61 lambda scope counts; heritage capture text for bare/qualified/subscripted snippets.
Automated multi-tool digest (1 Codex + 5 Claude lanes)—verify before acting.
| return_type: (type) @type-binding.type) @type-binding.return | ||
|
|
||
| ;; Decorators — simple @decorator | ||
| (decorator |
There was a problem hiding this comment.
P0 — F58 never reaches the graph [code-read]
Trigger: Any @login_required / @app.route processed through registry-primary Python.
Evidence: Tag @reference.decorator.call → referenceKindFromAnchor parses head decorator (not in switch) → undefined → pass5CollectReferences skips (scope-extractor.ts:990-991, 1027-1048). extractParsedFile on @login_required → referenceSites: [].
Fix: Rename to existing @reference.call.free / .member, or add case 'decorator': return 'call' + pipeline test asserting referenceSites.
Blocks merge: yes (claimed F58 behavior not end-to-end)
| attribute: (identifier) @reference.name)) @reference.decorator.call | ||
|
|
||
| ;; Decorators — @a.b.decorator (nested attributes) | ||
| (decorator |
There was a problem hiding this comment.
P1 — duplicate decorator captures [reproduced]
Trigger: @api.v1.endpoint on a function.
Evidence: Pattern at :260-264 (object: (_)) and :266-270 (object: (attribute)) both match nested attributes → 2 identical @reference.decorator.call rows (same range). Tests use toBeGreaterThanOrEqual(1) so this is invisible.
Fix: Make patterns disjoint (e.g. restrict :260 to object: (identifier) only) or dedupe in captures.ts; assert toBe(1) in F58 nested test.
Blocks merge: maybe (becomes edge inflation if F58 wiring is fixed)
…lden regeneration, thresholds reverted, baseline update
✨ PR AutofixFound fixable formatting / unused-import issues across 14 changed lines. Comment |
Closes #1932.
F57: heritage patterns for qualified/subscripted bases
F58: decorator patterns for nested-attribute decorators
F61: lambda as @scope.function
F59 already closed by #1920, F60 legacy-only