Collect solutions from a Conflict Solution PR merge when squashing - #42
Open
plebioda wants to merge 1 commit into
Open
Collect solutions from a Conflict Solution PR merge when squashing#42plebioda wants to merge 1 commit into
plebioda wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes squash_to_merge note construction so conflict-resolution “solutions” are not lost when conflicts were resolved via a dedicated Conflict Solution PR that lands as a 2-parent PR-merge commit (solutions on the second-parent side).
Changes:
- Expand solution/review PR-merge commits during
_collect_commits_for_squashso second-parent-side resolution/fix commits (and their notes/solutions) are collected. - Update
_collect_commits_for_squashdocumentation to describe the expanded traversal behavior and its rationale. - Add a regression test that constructs the solution-PR-merge topology and asserts solutions are collected into the combined note.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/mergai/app.py | Enhances squash commit collection to descend into second-parent-side commits for solution/review PR merges, preventing solution notes from being dropped. |
| tests/test_squash_collects_pr_solutions.py | Adds regression coverage for collecting solutions across a Conflict Solution PR merge topology. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
squash_to_merge builds the squashed merge commit's combined note from _collect_commits_for_squash, which walked the first-parent chain only. When a merge's conflicts are resolved via a solution->conflict PR, the resolution/fix commits (which carry the `solutions`) live on the *second parent* of that PR merge commit, so the first-parent walk never saw them. The squashed note ended up with `conflict_context` but no `solutions`, so `mergai rebase` later found a recorded conflict with no solution to reapply -- forcing a manual re-resolve of an already-solved conflict. This was latent for a long time (resolutions used to land as inline, single-parent commits on the first-parent chain) and only started corrupting notes once conflicts began being resolved via a 2-parent solution-PR merge. Expand a solution/review PR merge (a merge whose second parent is not the upstream merge commit) into the commits it brought in, so their notes -- and their solutions -- are collected. The mergai merge commit itself (second parent == the upstream merge commit) is still kept as a leaf and never descended into, so upstream history is not pulled in. This mirrors _collect_squashed_commit_entries, keeping the combined note's `solutions` consistent with the `squashed_commits` record. Add a regression test that builds the solution-PR-merge topology and asserts the solutions are collected and combined.
plebioda
force-pushed
the
fix-squash-drops-pr-solutions
branch
from
August 6, 2026 07:35
e2268c5 to
b4f0919
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.
squash_to_merge builds the squashed merge commit's combined note from _collect_commits_for_squash, which walked the first-parent chain only. When a merge's conflicts are resolved via a solution->conflict PR, the resolution/fix commits (which carry the
solutions) live on the second parent of that PR merge commit, so the first-parent walk never saw them. The squashed note ended up withconflict_contextbut nosolutions, somergai rebaselater found a recorded conflict with no solution to reapply -- forcing a manual re-resolve of an already-solved conflict.This was latent for a long time (resolutions used to land as inline, single-parent commits on the first-parent chain) and only started corrupting notes once conflicts began being resolved via a 2-parent solution-PR merge.
Expand a solution/review PR merge (a merge whose second parent is not the upstream merge commit) into the commits it brought in, so their notes -- and their solutions -- are collected. The mergai merge commit itself (second parent == the upstream merge commit) is still kept as a leaf and never descended into, so upstream history is not pulled in. This mirrors _collect_squashed_commit_entries, keeping the combined note's
solutionsconsistent with thesquashed_commitsrecord.Add a regression test that builds the solution-PR-merge topology and asserts the solutions are collected and combined.