forge: Add merge and checks APIs#1213
Merged
Merged
Conversation
Teach forge repositories how to merge changes directly and report aggregate checks state. This gives command handlers a provider-neutral contract for merge operations while keeping provider-specific REST and GraphQL shapes behind the forge boundary. GitHub and GitLab pass expected head SHAs through their merge APIs so callers can reject stale plans. Bitbucket exposes merge support without head assertions because its API does not provide that guard. Checks state now has a shared `forge.ChecksState` contract. GitHub, GitLab, Bitbucket, and ShamHub map provider statuses into pending, passed, or failed so merge orchestration can wait on CI without knowing provider-specific status names. ShamHub gains a REST merge endpoint and `shamhub config mergeMethod` for tests that need server-side merge or squash behavior when the client does not specify a method. Extracted from #1152 Co-Authored-By: Abhinav Gupta <mail@abhinavg.net>
Checks-state support needs replayable coverage that exercises each forge boundary without relying on manually configured CI jobs. Add a shared integration scenario that submits fresh changes and asks each provider test harness to install pending, passed, and failed checks state. ShamHub now models that state directly and exposes `shamhub set-status` for script tests, while GitHub, GitLab, and Bitbucket use provider status APIs for fixture recording.
Unused here and in branch-merge.
Owner
Author
|
This change is part of the following stack: Change managed by git-spice. |
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.
Extracted from #1152
This adds forge-level APIs for merging changes
and reading aggregate CI/checks state.
GitHub, GitLab, Bitbucket, and ShamHub now expose the new forge methods
where their backing APIs support them.
Checks-state integration tests now cover pending, passing,
and failing checks for ShamHub, GitHub, and GitLab.
ShamHub also gained support for simulating checks state
through its existing test forge system,
including a
shamhub set-statuscommandfor setting a PR's synthetic checks state during tests.
Finally, this removes the unused
ErrMergeNotAllowedsentinelfrom the forge contract.
It was only declared and documented here,
and was unused in the
branch-mergebranch as well.[skip changelog]: internal forge API and test infrastructure changes