fix: accept destination dev-branch ancestors in integration history check (PTFE-3343)#271
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #271 +/- ##
==========================================
+ Coverage 89.60% 89.62% +0.02%
==========================================
Files 81 81
Lines 10589 10614 +25
==========================================
+ Hits 9488 9513 +25
Misses 1101 1101
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tcarmet
approved these changes
Jun 23, 2026
tcarmet
left a comment
Contributor
There was a problem hiding this comment.
Nice work! Please add the extra testcase :)
benzekrimaha
approved these changes
Jun 29, 2026
matthiasL-scality
approved these changes
Jun 29, 2026
…heck (PTFE-3343) When a development branch has not diverged from its parent (it points at the same commit) and an integration branch carries a real merge commit, that merge's first parent is the shared development-branch tip. The `git log A..B` diffs used to build acceptable_parents exclude the boundary commit, so the history check rejected a parent that legitimately belongs to the target development branch. This affected both a manually-resolved integration branch (a forced `merge -s ours`) and the automated cascade when the PR's feature branch was behind the dev tip (the merge could not fast-forward). Accept a merge parent that is an ancestor of the destination development branch (Branch.includes_commit), matching the check's own documented intent. Genuine rebase / force-push detection is preserved. Regression tests cover both the manual-resolution and auto-created-merge paths.
a16808b to
e9fda4b
Compare
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.
Problem
Bert-E raised a false
History mismatch(BranchHistoryMismatch, code 113) — telling the user toreseteven though nothing was rebased — when an integration branch sat on a development branch that had not diverged from its parent (development/X.Yfreshly branched offdevelopment/X.(Y-1), still pointing at the same commitD) and that integration branch carried a real merge commit.When it happens
The trigger is a real (non-fast-forward) merge commit on
w/X.Ywhose first parent is the shared dev tipD. Two ways to get there:D(the PR is behind the dev tip), the auto-createdw/X.Ymerge cannot fast-forward (feature andDare siblings), so Bert-E produces a real merge commit whose first parent isD. PRs are frequently behind the dev tip, so this is the common case. (Thanks @tcarmet for spotting this path.)w/X.Ywith a forced merge commit (e.g.git merge -s ours) so the higher development branch ignores the cascaded change (the ARSN-600 scenario).It does not trigger when the PR is already up-to-date with the dev tip: the merge then fast-forwards and no merge commit is created.
Root cause
update_integration_branches()buildsacceptable_parentsfrom threegit log A..Bdiffs (prev_set,dst_set,wbranch_set).A..Bexcludes the boundary commit, so whendevelopment/X.Y == development/X.(Y-1),dst_setis empty and the shared dev tipD— the first parent of the integration merge — appears in none of the sets. The check then rejects a parent that legitimately belongs to the target development branch, contradicting the check's own documented intent (its comment explicitly allows parents from "the target development branch").Fix
Accept a merge parent that is an ancestor of the destination development branch (
Branch.includes_commit, i.e.git merge-base --is-ancestor), matching the documented intent.Genuine rebase / force-push detection is preserved: a rebased source leaves a merge whose offending parent is a feature-branch commit that is not an ancestor of any development branch, so it still raises. The existing
BranchHistoryMismatchtests still pass. Two failing-first regression tests cover the non-diverged case:test_history_mismatch_nondiverged_dev_branch— manual-resolution pathtest_history_mismatch_nondiverged_dev_auto_integration— auto-created merge of a late PRFull
tox -e tests-noqueueandtox -e testssuites pass (202 tests each).Jira: PTFE-3343