Skip to content

fix(parsers): context-attribution batch from the #1538 audit — 7 findings across 7 languages - #1657

Merged
Shashankss1205 merged 1 commit into
mainfrom
fix/1538-context-attribution
Aug 19, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
fix/1538-context-attribution

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Third batch from the #1538 audit (C++ in #1628, wrong-values/missing-declarations in #1654). Unit suite 1398 passed / 7 skipped; all 21 goldens green after regeneration.

Call-site class_context was structurally dead outside Python/C++:

  • Java / C#: _get_parent_context returns the enclosing method first, so the class test never passed — every call carried a dead context. Both now walk again for class-like ancestors only (cpp.py's pattern) and emit the canonical (name, line) tuple, activating the super()/same-name-method resolution paths.
  • Swift: class_context was hardcoded (None, None) and args hardcoded [] — both extracted now, and the bare-except: continue that swallowed every extraction failure logs first.
  • PHP: one list, two shapes — a bare string for plain calls, a dead tuple for new X(). Unified.
  • Rust: impl methods carried no class_context, so Point::new was an orphan never linked to Point. The impl_item's type field now lands as owner (+line) for inherent and trait impls; scoped calls also record their receiver type as resolution groundwork.

Nested-function containment outside Python:

  • JS computed context and dropped it — now stored (bare-name contract matching python.py; the tuple-shaped first attempt broke Kùzu batch typing and is pinned against in tests).
  • The writer's nested-CONTAINS gate matched only Python's literal node type; it now accepts every grammar's function-ish types — recovering nested containment for JS (+7), TS (+11), Lua (+2), PHP (+2) CONTAINS edges on the goldens (Lua closures, TS inner functions).

Rust CALLS −9 on the golden — all verified false positives: Arc::new/Box::new/Mutex::new were mis-bound to an unrelated local new. Scoped-call (X::y()) resolution itself turns out to be a pre-existing gap (zero edges even pre-change on a minimal repro) — filing separately.

Addresses the context-attribution section of #1538; the duplicate/spurious-records section remains.

…ings across 7 languages

Call-site class_context was structurally dead outside Python/C++:
- java/csharp: _get_parent_context returns the enclosing METHOD first, so the
  'is it a class?' test never passed — every call carried (None, None)/None.
  Both walk again with class-like types only (cpp.py's pattern) and emit the
  canonical (name, line) tuple, activating super()/same-name-method resolution.
- swift: class_context was hardcoded (None, None) and args hardcoded [];
  both are now extracted, and the bare-except that swallowed every extraction
  failure logs before continuing.
- php: one call list carried two shapes — a bare string for plain calls and a
  dead (None, None) tuple for . Unified via _get_enclosing_class.
- rust: impl methods carried only module_context, so Point::new was an orphan
  never linked to Point; the impl_item's type field now lands as
  class_context (+line), covering inherent and trait impls. Scoped calls also
  record the receiver type in inferred_obj_type as resolution groundwork.

Nested-function containment outside Python:
- javascript computed context/context_type and then dropped them — stored now
  (bare-name contract, matching python.py).
- the writer's nested-CONTAINS gate matched only the literal Python node type
  'function_definition'; it now accepts the function-ish node types of every
  grammar, recovering nested containment for JS/TS/Lua/PHP (+22 CONTAINS
  edges across those goldens).

Rust CALLS drops 9 edges — all verified false positives (Arc::new, Box::new,
Mutex::new mis-bound to an unrelated local `new`); scoped-call resolution
itself is a pre-existing gap tracked separately.

Unit suite 1398 passed / 7 skipped; all 21 goldens green after regeneration.
@github-project-automation github-project-automation Bot moved this to Backlog tasks in CGC Progress Board Aug 19, 2026
@Shashankss1205
Shashankss1205 merged commit bd486a9 into main Aug 19, 2026
17 of 19 checks passed
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph-context-pack Ready Ready Preview Aug 19, 2026 8:48pm

@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Code Graph Analysis

fix(parsers): context-attribution batch from the #1538 audit — 7 findings across 7 languages (#1657)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

The graph JSON has been uploaded as a build artifact: pr-code-graph-1657


Generated by CodeGraphContext using FalkorDB Lite

Shashankss1205 added a commit that referenced this pull request Aug 26, 2026
… (#1668)

The chain assembled across #1657 (impl-method class_context + scoped-call
receiver types) and #1510 (label-aware called-context clause) makes scoped
constructor calls resolve correctly: same-named news bind to their own impl
and external Arc::new does not mis-bind locally. Pinned on a real embedded
database so a regression in any of the three pieces fails this test.

This branch was successfully deployed

1 active deployment
Preview — bb1dafe9 Deployed Aug 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant