Skip to content

Collect solutions from a Conflict Solution PR merge when squashing - #42

Open
plebioda wants to merge 1 commit into
masterfrom
fix-squash-drops-pr-solutions
Open

Collect solutions from a Conflict Solution PR merge when squashing#42
plebioda wants to merge 1 commit into
masterfrom
fix-squash-drops-pr-solutions

Conversation

@plebioda

@plebioda plebioda commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_squash so second-parent-side resolution/fix commits (and their notes/solutions) are collected.
  • Update _collect_commits_for_squash documentation 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.

Comment thread src/mergai/app.py
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
plebioda force-pushed the fix-squash-drops-pr-solutions branch from e2268c5 to b4f0919 Compare August 6, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants