Skip to content

Emit a High dispute when both branches rename the same function differently - #5

Merged
kridaydave merged 3 commits into
mainfrom
fix/rename-rename-dispute
Aug 23, 2026
Merged

Emit a High dispute when both branches rename the same function differently#5
kridaydave merged 3 commits into
mainfrom
fix/rename-rename-dispute

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

PR made by x-preview-f from opencode on behalf of Kriday.

Oot's 3-way diff swallowed rename/rename disputes. When ours renamed f to g and theirs renamed f to k, both sides deleting f hit the convergent check on empty def lists, which passes vacuously, so the merge looked clean and the result silently held both names. The engine now detects that case and reports one High dispute per affected function.

Summary:

  • diff_3way stashes every def that vanished or appeared relative to base into side-tagged pools, collected before any dispatch decision runs
  • find_divergent_renames pairs removed-to-added defs within each side on exact signature match under a different name (consumed once on both sides), then joins across sides on (base name, base index)
  • Each divergently renamed base def emits one High: "3-way conflict: both branches renamed function f differently (f -> g in target, f -> k in incoming)", located at theirs' new row with ours as fallback
  • Claimed incoming additions are suppressed from the Low addition pass, so k is not double-reported
  • Convergent renames (same new name both sides) stay silent; delete/delete plus coincidental adds behaves exactly as before
  • rename_score() kept as an exact-match seam for future similarity scoring
  • Tests: pinned detail string, convergent-clean, two divergent renames produce two Highs, rename-vs-body-edit pinned as a documented gap, helper unit tests for consumed-once pairing, multiplicity, and equal-name rejection

Calls I made:

  • The spec's test-matrix line asked for base {f,h} with ours f->g h->h2 and theirs f->k h->h2 to yield two Highs. With h renamed to h2 on both sides, that rename is convergent and silent under this same spec's rules, which gives one High. I wrote the multi-rename test with theirs renaming h to h3 so it genuinely exercises two divergences, and pinned convergent silence in its own test.
  • Landed in the required order: commit 1 is pool stashing plus the inert detector (behavior-neutral, full suite green), commit 2 turns on emission and suppression.
  • Suppression matches pending_added entries by (name, row); rows are unique within a parsed file.
  • rename_score returns Option<()> today; widening it to graded scores later will not touch the pairing code.

@kridaydave
kridaydave merged commit 5bcf55f into main Aug 23, 2026
5 checks passed
@kridaydave
kridaydave deleted the fix/rename-rename-dispute branch August 23, 2026 04:48
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.

1 participant