Skip to content

fix(scm): resolve default merge method before running gh pr merge - #382

Merged
astyfx merged 1 commit into
mainfrom
fix/merge-pr
Aug 21, 2026
Merged

fix(scm): resolve default merge method before running gh pr merge#382
astyfx merged 1 commit into
mainfrom
fix/merge-pr

Conversation

@astyfx

@astyfx astyfx commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

The top bar Merge PR action always failed with --merge, --rebase, or --squash required when not running interactively, because gh pr merge demands an explicit strategy flag when it runs without a TTY and the merge strategy setting defaults to default.

Changes

Fixes

  • scm: resolve the default merge strategy into a concrete one (squash → merge → rebase) using the repository's allowed merge methods, falling back to squash when the settings cannot be read, so gh pr merge always receives a strategy flag
  • scm: apply the same resolution to the auto-merge and clean-status fallback merge paths, which had the identical missing-flag bug

Refactors / Chores

  • pr-status: move ConcretePrMergeMethod into src/lib/pr-status.ts so renderer and host share one type
  • top bar: pass the configured strategy through to the host instead of clearing it, keeping strategy resolution in a single place

Test Evidence

  • bun run typecheck — pass
  • bun test tests/scm-runtime-pr.test.ts tests/topbar-open-pr.utils.test.ts tests/source-control-pr.test.ts tests/git-graph-tag-args.test.ts — 51 pass, 0 fail
  • bun run check:switch-exhaustiveness, bun run check:max-lines-ratchet — pass
  • New regression tests cover that a strategy flag is always present and that default resolves per repository settings (merge when squash is disallowed, rebase when both are disallowed)

Notes

An existing test asserted that GitHub picks the default strategy on its own; that premise was wrong for non-interactive runs, so it was updated to the new behavior. The host service must be restarted for the fix to take effect in a running app.

`gh pr merge` requires an explicit --merge/--rebase/--squash flag when it
runs without a TTY, so the top bar Merge PR action always failed while the
merge strategy setting was "default".

Resolve "default" against the repository's allowed merge methods (squash →
merge → rebase, falling back to squash when the settings cannot be read) and
always pass a concrete strategy flag on the merge, auto-merge, and
clean-status fallback paths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@astyfx
astyfx requested a review from a team as a code owner August 19, 2026 23:48
@astyfx
astyfx requested review from paul-seo73 and png-1105 and removed request for a team August 19, 2026 23:48
@upwind-code-us

upwind-code-us Bot commented Aug 19, 2026

Copy link
Copy Markdown

Upwind Upwind Code Scan - ✅ Proceed with Deployment

0 newly introduced vulnerabilities · 0 resolved · 81 total in this PR vs main

🔴 1 Critical | 🔶 30 High | 🟡 47 Medium | 🟢 3 Low

View full analysis in Upwind Console

Scan completed in 15s

Scan history (1 scan)
Commit Scanned at New Resolved Net
6ede39c < 2026-08-19 23:49 UTC 0 0 0

Last scanned: 6ede39c · 2026-08-19 23:49 UTC

@upwind-code-us

upwind-code-us Bot commented Aug 19, 2026

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Proceed with Deployment

0 newly introduced misconfigurations · 0 resolved · 0 total in this PR vs main

View full analysis in Upwind Console →

Scan completed in 3s

Scan history (1 scan)
Commit Scanned at New Resolved Net
6ede39c < 2026-08-19 23:49 UTC 0 0 0

Last scanned: 6ede39c · 2026-08-19 23:49 UTC

@heath-s heath-s left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved

@astyfx
astyfx merged commit fe6a3db into main Aug 21, 2026
4 checks passed
@astyfx
astyfx deleted the fix/merge-pr branch August 21, 2026 01:58
@astyfx astyfx mentioned this pull request Aug 21, 2026
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