Skip to content

fix(automerge): validate head commit before merge - #39235

Merged
bircni merged 6 commits into
go-gitea:mainfrom
loveulvu:fix/39214-auto-merge-status
Sep 5, 2026
Merged

fix(automerge): validate head commit before merge#39235
bircni merged 6 commits into
go-gitea:mainfrom
loveulvu:fix/39214-auto-merge-status

Conversation

@loveulvu

@loveulvu loveulvu commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #39214.

Auto-merge already validates that the queued head commit still matches the pull request head before checking mergeability, but the expected head commit was not passed to the final merge operation.

Pass expectedHeadCommitID to pull_service.Merge so the head commit is validated again when the merge is actually performed.

The "automerge" related tests are already very messy, and it's very difficult to test the "validation" behaviors without data-race. Since the fix is simple, this PR doesn't introduce new tests.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0612cb687

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/integration/pull_merge_test.go Outdated
@wxiaoguang

Copy link
Copy Markdown
Contributor

If it's difficult to write a correct test, then don't write the test, since the fix is simple

@wxiaoguang
wxiaoguang marked this pull request as draft September 4, 2026 05:27
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 4, 2026
@loveulvu
loveulvu marked this pull request as ready for review September 4, 2026 06:21

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7050e6f1bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread services/automerge/automerge.go
@bircni
bircni enabled auto-merge (squash) September 5, 2026 08:35
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 5, 2026
@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 5, 2026
@bircni
bircni merged commit cf0f4dc into go-gitea:main Sep 5, 2026
23 checks passed
@GiteaBot GiteaBot added this to the 28.0.0 milestone Sep 5, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto merge ignores failing checks

4 participants