fix: self-heal Flue incremental review diff on rebase and upstream merges#32070
Open
mvvmm wants to merge 2 commits into
Open
fix: self-heal Flue incremental review diff on rebase and upstream merges#32070mvvmm wants to merge 2 commits into
mvvmm wants to merge 2 commits into
Conversation
…rges
The code-review and style-guide specialists computed their incremental
diff as a three-dot compare of the last-reviewed head SHA against the
current head. That is only correct when the branch is a clean forward
extension of the last-reviewed SHA. After a rebase/force-push the old SHA
is orphaned, so the compare's merge-base regresses to the old fork point
and the delta sweeps in every upstream commit the branch absorbed — the
review then flags findings in files the PR never touched. A
production->PR merge ("Update branch") has the same effect while still
reporting status: ahead.
The prior self-heal only fired on a 404 (base SHA garbage-collected), so
neither the rebase nor the merge case was covered.
Add fetchFilesForDiffMode (lib/diff-fetch.ts), shared by both
specialists, which trusts the incremental delta only when the compare
succeeds, its status is ahead/identical, and every file in the delta
belongs to the PR's net diff. Any violation self-heals to the full PR
diff. comparePullRequestHeads now returns the compare status/ahead_by/
behind_by to support this.
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
|
Nimbus Preview URL: https://nimbus-8c2e2ada.preview.developers.cloudflare.com |
Contributor
Contributor
Review✅ No issues found in full PR diff. Code ReviewThis code review is in beta and may not always be helpful — use your judgment. No code review issues found. ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
Address review findings on the diff self-heal: - getPullRequestFiles now follows Link-header pagination instead of fetching a single per_page=100 page, so the PR net-diff set used by fetchFilesForDiffMode's containment check is complete for PRs with more than 100 changed files. - comparePullRequestHeads paginates the compare file list (deduping by filename, since the compare endpoint paginates over commits and can repeat files across pages) and captures status/ahead_by/behind_by from the first page. This keeps the incremental delta and the upstream-file self-heal decision from being based on a truncated first page. - The compare base/head refs are URL-encoded (preserving '/') so refs with special characters produce a well-formed request.
Contributor
Author
|
/full-review |
kodster28
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Flue docs-bot occasionally posting a review whose findings are about files the PR never touched (observed on #31957, whose comment flagged
catalog-models/*.json,chunk-citations.mdx, andclient-api.mdx— none of which are in that PR).Root cause: the code-review and style-guide specialists computed their incremental diff as a three-dot compare of the last-reviewed head SHA against the current head. That is only correct when the branch is a clean forward-extension of the last-reviewed SHA (a normal push). After a rebase/force-push the old SHA is orphaned, so GitHub's compare merge-base regresses to the old fork point and the delta sweeps in every upstream
productioncommit the branch absorbed. Aproduction→ PR merge ("Update branch") has the same effect while still reportingstatus: ahead. The prior self-heal only fired on a404(base SHA garbage-collected), so neither case was covered.Fix: a shared
fetchFilesForDiffModehelper (.flue/lib/diff-fetch.ts) that trusts the incremental delta only when all three hold, else self-heals to the full PR diff:404)statusisahead/identicaldiverged)production→ PR merge that drags in upstream filescomparePullRequestHeadsnow returns the comparestatus/ahead_by/behind_byto support this, and both specialists log adiff_self_healedevent with the reason when incremental degrades to full. The normal fast-forward push path is unchanged, so line-level incremental review is preserved.No test infra exists in
.flue; verified viatsc --noEmit -p .flue/tsconfig.json(passes) and Prettier (format:corescope).conventions-specialistanddependabot-reviewuse the full diff only and are unaffected.