Skip to content

feat(structural): preserve relative import evidence - #57

Merged
nia-sg-bot merged 1 commit into
mainfrom
nia/issue-22-relative-imports
Sep 14, 2026
Merged

nia-sg-bot merged 1 commit into
mainfrom
nia/issue-22-relative-imports

Conversation

@nia-sg-bot

@nia-sg-bot nia-sg-bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve Python relative from imports (for example from ..pkg import value) in the deterministic structural artifact
  • retain exact relative-module provenance as an explicit unresolved/external import target
  • preserve alias bindings so calls resolve through deterministic import_grounded edges

Validation

  • python3 -m pytest (171 passed)
  • git diff --check

Part of #22

Remaining issue work includes broader Tree-sitter baseline capability and fixture coverage tracked by the parent.

Summary by CodeRabbit

  • Bug Fixes

    • Relative Python imports now preserve their leading dots and exact module paths.
    • Import relationships and call tracking for relative imports are now resolved consistently.
  • Tests

    • Added coverage confirming correct handling of relative imports, unresolved module references, and calls through aliased imports.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f622fd30-599f-4ab2-8f56-ede8edb5d546

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1e4f4 and ecfa2e6.

📒 Files selected for processing (2)
  • diffgraph/structural.py
  • tests/test_structural.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The parser now preserves leading dots in relative from imports. A new test verifies the import symbol, external-module edge, and grounded call edge for a relative import.

Changes

Relative import parsing

Layer / File(s) Summary
Preserve relative module evidence
diffgraph/structural.py, tests/test_structural.py
The parser uses the first relative_import child when module_name is absent. The test verifies ..pkg, its external-module edge, and the import_grounded call edge from caller to run_local.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to ecfa2

Relative imports retain their package provenance in the structural artifact, with coverage for the emitted import and grounded call bindings. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving evidence from relative imports in the structural artifact.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nia/issue-22-relative-imports

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nia-sg-bot nia-sg-bot added roadmap Tracked on the public WildestAI roadmap priority:P0 Critical path / blocks a usable product direction:aligned Aligned with the current WildestAI product direction labels Sep 14, 2026
@nia-sg-bot

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nia-sg-bot
nia-sg-bot merged commit 6f66953 into main Sep 14, 2026
4 checks passed
@nia-sg-bot
nia-sg-bot deleted the nia/issue-22-relative-imports branch September 14, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

direction:aligned Aligned with the current WildestAI product direction priority:P0 Critical path / blocks a usable product roadmap Tracked on the public WildestAI roadmap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant