fix(api): Send correct title param when merging a pull request - #4
fix(api): Send correct title param when merging a pull request#4euxaristia wants to merge 2 commits into
Conversation
The Gitee v5 merge endpoint (PUT /repos/{owner}/{repo}/pulls/{number}/merge)
accepts a "title" field for the merge commit, not "merge_commit_message".
Because the payload used an unrecognized key, the users pr merge --message
value was silently dropped and every merge fell back to the default title.
Send the value under "title" so the flag takes effect.
📝 WalkthroughWalkthrough
ChangesMerge request payload
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/api/client.go (1)
354-354: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert the merge payload field in
TestMergePR.The current test only checks for a successful response, so it would also pass with the old
merge_commit_messagefield. Decode the request body ininternal/api/client_test.go:81-83and assert thattitleequals"merge msg"to lock in this API contract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/api/client.go` at line 354, Update TestMergePR to decode the request body captured by the existing test handler and assert that its title field equals "merge msg". Use the decoded payload to verify the merge request sends the title key, ensuring the test fails if the legacy merge_commit_message field is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/api/client.go`:
- Line 354: Update TestMergePR to decode the request body captured by the
existing test handler and assert that its title field equals "merge msg". Use
the decoded payload to verify the merge request sends the title key, ensuring
the test fails if the legacy merge_commit_message field is used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e3d0a796-7ead-4d18-97cd-e057a35c01af
📒 Files selected for processing (1)
internal/api/client.go
The CodeRabbit review (PR #4) flagged that TestMergePR only checked for a successful response, so it would pass even with the old, incorrect merge_commit_message field. Decode the request body in the test server merge handler and assert the title field is present, locking in the API contract fixed by the MergePR title change.
|
Pushed a fixup commit addressing the CodeRabbit nitpick: the test server merge handler now decodes the request body and asserts the |
Summary
gt pr merge --messagehad no effect. The Gitee v5 merge endpoint (PUT /repos/{owner}/{repo}/pulls/{number}/merge) expects the merge commit title under thetitlefield, but the client sent it asmerge_commit_message, which the API does not recognize. As a result the flag value was silently discarded and every merge used the default title.Changes
internal/api/client.goMergePRnow sends the merge title under thetitlefield sopr merge --messageis honored.Test plan
go build ./...cleango test ./internal/api/pass (incl. payload title assertion added in the fixup commit)Prior reviewer feedback addressed
merge_commit_messagefield regresses.