Skip to content

Resolve a diff's changed functions to their out-of-diff callers - #94

Merged
exactml merged 3 commits into
masterfrom
feat/resolve-diff-callers
Sep 20, 2026
Merged

exactml merged 3 commits into
masterfrom
feat/resolve-diff-callers

Conversation

@exactml

@exactml exactml commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds marginal.graph.find_out_of_diff_callers, which takes Add a Python symbol graph indexer to marginal/graph #82's SymbolGraph plus a PR's changed files (the same shape marginal.cli.review already fetches) and returns every changed definition together with the callers of it that sit outside the diff's own files
  • "Changed" is determined by overlapping each file's diff hunks (parsed from the unified diff's @@ -a,b +c,d @@ headers) against a definition's line_start..line_end span -- no dependency on GitHub-side metadata beyond the patch text already fetched
  • A caller already inside one of the diff's own changed files is dropped -- it's already visible to whoever's reading the diff, so surfacing it again adds nothing
  • An unchanged definition is skipped entirely; a definition touched by more than one hunk is only reported once
  • A file with no patch (binary/oversized, per GitHub) contributes no hunks and so no changed definitions -- consistent with how the rest of review.py already treats a missing patch
  • Nothing consumes this yet -- it's the input Feed code-graph caller context into the review prompt behind context.code_graph #84's prompt wiring will use

Closes #83

Test plan

  • make lint -- clean
  • make test -- 161 passed (6 new in tests/test_graph_diff.py), covering: a cross-file caller surfaced, an in-diff caller excluded, an unchanged definition skipped, a missing patch handled, a hunk that only partially overlaps a definition still counts, and a definition touched by two hunks is reported once

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 marginal review

PR #94: Resolve a diff's changed functions to their out-of-diff callers · open · 5144f395166e65483d632dc93bfe8fed207eb597 → d11d5bbaa80faf0ac15bad8515710dec473eca97 · 4 files changed

Changed files (4)
  • CHANGELOG.md
  • marginal/graph/__init__.py
  • marginal/graph/diff.py
  • tests/test_graph_diff.py

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 marginal review

PR #94: Resolve a diff's changed functions to their out-of-diff callers · open · 1ac5c9882b8ed411317268add0640a65f2be8af8 → f752b3da4163081ae7fd9bbda89421ed026df182 · 5 files changed

Changed files (5)
  • .marginal/config.yaml
  • CHANGELOG.md
  • marginal/graph/__init__.py
  • marginal/graph/diff.py
  • tests/test_graph_diff.py

Comment thread marginal/graph/diff.py
for definition in candidates:
if definition.qualified_name in changed:
continue
if definition.line_end < start or definition.line_start > end:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · 60% confidence

The overlap check definition.line_end < start or definition.line_start > end uses the hunk's new-file range, but for definitions that are deleted or heavily shifted, comparing directly against a definition's line_start/line_end (presumably from the current tree state after build_symbol_graph) versus hunk new-file ranges assumes the graph was built from the post-diff state. This coupling is implicit and not documented/enforced, so if graph is built from a stale checkout the overlap logic will silently produce wrong results.

exactml and others added 3 commits September 20, 2026 15:26
Resolves ISSUE-83

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Findings have been getting filtered out (or the structured-output
response itself has been failing before reaching the filter) on
every recent PR, leaving no visibility into whether marginal has
anything useful to say. Dropping the bar from 0.85 to 0.6 surfaces
more borderline findings so we can actually see what it's finding,
at the cost of more false positives -- easy to raise back once
there's real signal to tune against.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@exactml
exactml force-pushed the feat/resolve-diff-callers branch from f752b3d to 3d58e33 Compare September 20, 2026 12:27

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 marginal review

PR #94: Resolve a diff's changed functions to their out-of-diff callers · open · 2d1ad43f6114b0119ee426be3d6433ef356fbfe9 → 3d58e33bfbfce65d8580e3ebfa2850626f4f0981 · 5 files changed

Changed files (5)
  • .marginal/config.yaml
  • CHANGELOG.md
  • marginal/graph/__init__.py
  • marginal/graph/diff.py
  • tests/test_graph_diff.py

@exactml
exactml merged commit 3a8a321 into master Sep 20, 2026
2 checks passed
@exactml
exactml deleted the feat/resolve-diff-callers branch September 20, 2026 12:34
exactml added a commit that referenced this pull request Sep 20, 2026
…105)

PR #94's branch was rebased across four release cuts (v0.2.1
through v0.2.4) before merging. Each rebase kept the entry
anchored to its neighboring text (right after ISSUE-82's entry),
which the release cuts had already moved out of UNDER DEVELOPMENT
and into the dated v0.2.1 section -- so the entry silently rode
along into a release it was never actually part of. #83 merged
today, after v0.2.4 was already published; moves the entry to
UNDER DEVELOPMENT where unreleased work belongs.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Resolve a diff's changed functions to their out-of-diff callers

1 participant