From bc6bfb2ea245ca036c1f969021003da45063d143 Mon Sep 17 00:00:00 2001 From: anderdc Date: Tue, 28 Apr 2026 11:49:50 -0500 Subject: [PATCH] Recompute merge-base on every PR file fetch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The merge-base SHA was computed once on the first PR_FILES job and short-circuited on every subsequent run. When a PR's head advanced via synchronize while the base branch also moved forward, the stored value went stale and the saved base_content got pinned to an old ancestor — inflating tree-diff scoring with churn from unrelated PRs that landed on the base branch in the meantime. Drop the !pr.mergeBaseSha guard so we recompute on every fetch. Adds one compare API call per PR_FILES job; rate-limit cost is negligible. --- packages/das/src/webhook/github-fetcher.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/das/src/webhook/github-fetcher.service.ts b/packages/das/src/webhook/github-fetcher.service.ts index 27e2985..98c8de4 100644 --- a/packages/das/src/webhook/github-fetcher.service.ts +++ b/packages/das/src/webhook/github-fetcher.service.ts @@ -338,8 +338,11 @@ export class GitHubFetcherService implements OnModuleInit { } // Fetch and store the merge-base SHA. Needed for correct tree-diff - // scoring — differs from baseSha when base branch has advanced. - if (pr.baseSha && pr.headSha && !pr.mergeBaseSha) { + // scoring — differs from baseSha when base branch has advanced. Recompute + // on every fetch: a stored value can go stale when head advances via + // synchronize, leaving base_content pinned to an old ancestor and + // inflating the scored diff with churn from unrelated PRs. + if (pr.baseSha && pr.headSha) { const mergeBaseSha = await this.fetchMergeBaseSha( repoFullName, pr.baseSha,