CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

Persist merge_sha (and base sha at merge) on pull_requests at merge time#204

Openccantynz opened this issue 24d ago
ccantynzAuthorcommented 24d ago

Follow-up to PR #5445. The Files-changed tab for merged PRs now recovers the diff by searching for the merge commit by message convention ("pull request #N") — works, but fragile: squash merges, edited messages, or imported PRs break it, and the fast-forward fallback (tip~1..tip) under-reports multi-commit PRs.

Proper fix: in the shared merge chain (pr-merge-gated.ts — the one place all merges flow through; never inline a copy), record on the PR row at merge time:

  • merge_sha — the commit the merge produced (already returned by the endpoint)
  • base_sha_at_merge — base tip immediately before the merge

Then the merged-PR diff is exactly base_sha_at_merge..merge_sha, no archaeology. Migration is additive (two nullable text columns); the message-grep path stays as fallback for pre-existing rows.

c comment · e edit title · x close/reopen · ? shortcuts