Skip to content

fix(parsers): six #1538 audit findings — Rust/C#/Python/Dart imports and bases, Scala/Ruby missing declarations - #1654

Merged
Shashankss1205 merged 1 commit into
mainfrom
fix/1538-audit-batch2
Aug 19, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
fix/1538-audit-batch2

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Second batch from the #1538 parser audit (the C++ section landed in #1628). Each finding reproduced on current main before fixing; one regression test per finding; unit suite 1390 passed / 7 skipped; rust/dart/scala goldens regenerated with the recovered content and all six affected-language goldens green.

Wrong values written to the graph

  • Rust: use a::{X, Y as Z, W}; kept only W, and full_import_name was the raw source ('use std::ops::Add;') — written verbatim as the Module name where replace('.', '/') in path could never match. Imports are now walked structurally: every braced name, aliases, nested lists, wildcards, and super/crate/self prefixes, all with clean :: paths. Fixture recovers +7 Modules / +11 IMPORTS and one heuristic call upgrades.
  • C#: base lists split on every comma — : Dictionary<string, int> became INHERITS edges to Dictionary<string and int>. Now split on top-level commas only.
  • Python: from . import x → ..x, one package level too high; bare-dot relatives now join without the extra separator (.x, ..x, .pkg.y all correct).
  • Dart: import 'dart:math' as math; lost the alias — the grammar has no prefix node, so the old lookup was always empty and math.max(...) could never map to its import.

Missing declarations

  • Scala: the functions query made parameters mandatory, dropping every parameterless def (getters, abstract members). +12 Functions on the fixture alone.
  • Ruby: def self.x singleton methods (node type singleton_method) were invisible to both the parser and the cross-file pre-scan — now captured in both, with args and class context.

Addresses the 'wrong values' and 'missing declarations' sections of #1538; the context-attribution section (call-site class_context in Java/C#/Swift/PHP, nested-function CONTAINS outside Python) remains and is scoped for a follow-up.

… and Ruby (#1538)

Wrong values written to the graph:
- rust: braced use lists kept only the LAST name; full_import_name was raw
  source ('use std::ops::Add;') no path consumer could match. Imports are
  now walked structurally: every braced name, aliases, wildcards, and
  super/crate/self prefixes, with clean '::' paths.
- csharp: base lists split on every comma, shredding multi-arg generics
  (': Dictionary<string, int>' -> two nonexistent INHERITS targets). Split
  now respects bracket depth.
- python: 'from . import x' produced '..x' — one package level too high.
- dart: 'import ... as alias' lost the alias (the grammar has no 'prefix'
  node); the identifier after 'as' is now read directly.

Missing declarations:
- scala: the functions query made parameters mandatory, dropping every
  parameterless def. 12 previously-invisible functions on the fixture alone.
- ruby: 'def self.x' singleton methods were never captured, in the parser
  or the cross-file pre-scan.

One regression test per finding; rust/dart/scala goldens regenerated with
the recovered content (+11 Rust IMPORTS, +12 Scala Functions, Dart aliases).
@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 7:44pm

@github-actions

Copy link
Copy Markdown
Contributor

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

@Shashankss1205
Shashankss1205 merged commit c441caa into main Aug 19, 2026
13 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 19, 2026
@Shashankss1205
Shashankss1205 deleted the fix/1538-audit-batch2 branch August 19, 2026 19:43
@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Code Graph Analysis

fix(parsers): six #1538 audit findings — Rust/C#/Python/Dart imports and bases, Scala/Ruby missing declarations (#1654)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

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


Generated by CodeGraphContext using FalkorDB Lite

This branch was successfully deployed

1 active deployment
Preview — 8d20bccc 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