fix(merge): tolerate merge_method alias + default style to merge #4

Merged
Phil merged 1 commit from fix/merge-style-tolerate-merge-method into main 2026-06-04 14:10:54 +00:00
Owner

Problem

merge_pull_request read only the style arg. Passing the GitHub-style merge_method left style empty → MergeStyle("") → Forgejo HTTP 422, surfaced as an opaque server returned HTTP 422 (expected 200) — indistinguishable from a genuine branch-protection rejection. Cost a full debugging session (phantom gate hunting) for a one-word param error.

Fix (operation/pull/pull.go)

  • Accept merge_method / merge_style as aliases for style.
  • Default empty stylemerge (the --no-ff repo norm).
  • Validate the style up front → clear error (invalid merge style %q: use one of merge|rebase|rebase-merge|squash) instead of a raw 422.
  • Annotate the genuine-422 message (warns against force_merge, points at required checks).
  • style no longer Required() in the tool schema (optional, defaults to merge).

Verification

  • Compiles clean (go build in golang:1.25).
  • New binary built + installed locally; takes effect on next MCP restart.

Closes #3

## Problem `merge_pull_request` read only the `style` arg. Passing the GitHub-style `merge_method` left `style` empty → `MergeStyle("")` → Forgejo **HTTP 422**, surfaced as an opaque `server returned HTTP 422 (expected 200)` — indistinguishable from a genuine branch-protection rejection. Cost a full debugging session (phantom gate hunting) for a one-word param error. ## Fix (`operation/pull/pull.go`) - Accept `merge_method` / `merge_style` as aliases for `style`. - Default empty `style` → `merge` (the `--no-ff` repo norm). - Validate the style up front → clear error (`invalid merge style %q: use one of merge|rebase|rebase-merge|squash`) instead of a raw 422. - Annotate the genuine-422 message (warns against force_merge, points at required checks). - `style` no longer `Required()` in the tool schema (optional, defaults to merge). ## Verification - Compiles clean (`go build` in `golang:1.25`). - New binary built + installed locally; takes effect on next MCP restart. Closes #3
merge_pull_request only read the `style` arg. Callers passing the
GitHub-style `merge_method` (or `merge_style`) left Style empty, which
Forgejo rejects with an opaque HTTP 422 — indistinguishable from a
branch-protection / required-check rejection, sending debuggers chasing
phantom gate causes instead of the real one-word param error.

Accept merge_method/merge_style as aliases, default an empty style to
`merge` (the --no-ff repo norm), validate the style up front with a clear
error, and annotate the genuine-422 message so a real gate rejection is
not confused with a param mistake. `style` is no longer Required in the
tool schema.

Closes #3
Phil merged commit db8eece04b into main 2026-06-04 14:10:54 +00:00
Phil deleted branch fix/merge-style-tolerate-merge-method 2026-06-04 14:10:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Phil/forgejo-mcp!4
No description provided.