Skip to content

feat(bin): add opt-in PR squash commit summaries - #8366

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-merge-squash-text
Nov 12, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-merge-squash-text

Conversation

@Dematom1

@Dematom1 Dematom1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Add an opt-in config/pr-squash-summary setting that uses a GitHub PR title and its ## What Changed section as commit text for squash merges when the caller supplies no subject or body.
  • Document the setting and cover section extraction, fallbacks, caller-provided commit text, and unchanged GitLab and Forgejo behavior with tests.

Risk Assessment

⚠️ Medium: The implementation is scoped and fallback-preserving, but a newly added core regression case has an assertion that cannot pass against its captured argv format.

Testing

The targeted merge test timed out before the squash-summary scenarios, and I did not mutate a real GitHub PR. No live scenario evidence or visual artifacts were gathered; result is inconclusive.

  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
GitHub squash merge uses PR title and What Changed body ⏸️ untested no The real forge path would mutate a PR. The previously declined live-GitHub-validation decision rules out that workaround; the available test harness uses mocks and is not live validation. Its full tar…
Summary fallback and caller-provided commit text preserve existing merge behavior ⏸️ untested no The real forge path would mutate a PR. The previously declined live-GitHub-validation decision rules out that workaround; the available test harness uses mocks and is not live validation. Its full tar…
Non-squash and non-GitHub merges remain unchanged with summary opt-in ⏸️ untested no The real GitHub merge would mutate a PR, and the remaining providers require authenticated forge instances; the repository provides no disposable forge server. The available mocks are not live validat…
Evidence: Merge test timeout
Targeted test output reached existing GitHub/GitLab/Forgejo cases, then the command exceeded 300 seconds before reaching the squash-summary cases; no scenario-specific evidence was produced.
  • Outcome: ⚠️ 2 warnings across 1 run (5m51s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ tests/fm-pr-merge.test.sh:5595 - The new assertion treats the NUL-delimited argv file as one whole record (grep -z -x), but the record contains the entire gh pr merge argv, not a standalone --squash record. Thus this required-summary test fails even when the method is correctly present; check the captured argv with github_merge_flag_value or parse its NUL-separated arguments. Same assertion site: tests/fm-pr-merge.test.sh:5595.
⚠️ **Test** - 2 warnings
  • ⚠️ bin/fm-pr-merge.sh:1 - Live validation against an actual GitHub squash merge was not attempted because it would mutate a real PR; this is the previously declined live-validation concern. Mock-backed test harness execution is not live product validation, and the targeted test file timed out before reaching the new scenarios.
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: GitHub squash merge uses PR title and What Changed body, Summary fallback and caller-provided commit text preserve existing merge behavior, Non-squash and non-GitHub merges remain unchanged with summary opt-in
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
GitHub squash merge uses PR title and What Changed body ⏸️ untested no The real forge path would mutate a PR. The previously declined live-GitHub-validation decision rules out that workaround; the available test harness uses mocks and is not live validation. Its full tar…
Summary fallback and caller-provided commit text preserve existing merge behavior ⏸️ untested no The real forge path would mutate a PR. The previously declined live-GitHub-validation decision rules out that workaround; the available test harness uses mocks and is not live validation. Its full tar…
Non-squash and non-GitHub merges remain unchanged with summary opt-in ⏸️ untested no The real GitHub merge would mutate a PR, and the remaining providers require authenticated forge instances; the repository provides no disposable forge server. The available mocks are not live validat…
  • git diff bb3b2d6951d021fcd085478b3c04f6ea16b22ba8 afbc48bbcc65fb5ff567863ed35d717836c81d30 (identified runtime files and change)
  • bash tests/fm-pr-merge.test.sh (exceeded 300-second limit before new squash-summary cases)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Issues

Closes #8364

With the config/pr-squash-summary presence flag, a GitHub squash merge
whose caller passed no subject or body uses the PR title plus (#N) as
the subject and the PR body's ## What Changed section as the body, so
the commit on the base branch describes the change instead of listing
every branch commit. A missing or empty section, an unreadable PR, a
merge or rebase method, caller-supplied commit text (including -t, -b,
and -F after --), and GitLab and Forgejo merges keep the repository's
own squash text.

Opt-in: the behaviour is off by default. Without the flag the merge
reads no PR text and sends exactly today's command; with it, the PR's
summary overrides the repository's squash commit message setting. The
head-match, attestation, and waiver guards are unchanged.
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous inline-code issue fixed and no new actionable issues found.

Reviews (3) · Last reviewed commit: "fix(pr-merge): treat a backtick run hold..." · Reviewed by Greptile

Comment thread bin/fm-pr-merge.sh Resolved
what_changed_section now tracks fenced code blocks (``` and ~~~,
closed only by a run of the same character at least as long), so a
"## " line inside a fence neither ends the What Changed section nor is
selected as a fenced "## What Changed". Regression tests cover both.
Comment thread bin/fm-pr-merge.sh Resolved
A backtick-opened fence is valid only when its info string contains no
backtick (CommonMark), so a line such as three backticks, text, three
backticks is inline code. fence_run no longer opens a fence on it, so it
neither swallows later headings and the appendix inside What Changed nor
hides the real section before it. Tilde fences keep no such restriction.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1. I read the full diff against latest main 47df77f3. It follows what we agreed on #8364. The config/pr-squash-summary check runs before any PR read, so with the flag absent the merge command is the same as today, and your no-flag test asserts that. Caller --subject/--body/-t/-b/-F always win. Merge and rebase methods, GitLab and Forgejo are unchanged. Both Greptile P2s (fenced headings, inline-code backtick runs) are fixed with regression cases and resolved. The no-mistakes check passes, the attestation binds afbc48bb with no skipped steps, the coverage guard and repo invariants pass, and Greptile is 5/5.

One note on the no-mistakes review warning about grep -qzx -- '--squash': I checked it, and it is a false positive. The gh mock writes printf '%s\0' "$@", so each argument is its own NUL record, and -z -x matches the bare --squash record. Nothing to do there.

One thing is waiting on you: live evidence. Live validation is 0 of 3. The pipeline didn't drive a real squash merge, and the targeted test file timed out before it reached the new cases. Because this is opt-in, it can merge on its own once the full suite is green, and it rewrites the commit text of every merge for homes that turn it on. So I'd like one real run before queueing the full suite. A disposable GitHub repo you own is enough (nothing on this repo):

  1. With config/pr-squash-summary present, merge a PR whose body has ## Intent, ## What Changed and a no-mistakes appendix through bin/fm-pr-merge.sh. Paste git log -1 --format=%B from the base branch: the subject should be <title> (#N) and the body only the What Changed section.
  2. Remove the flag and merge a second PR the same way. Its commit text should be the repository's own default.

A git push no-mistakes re-raise that records those as live scenarios works, and so does a comment with the two git log outputs and the PR links. After that, I'll queue the full suite.

contract-class: opt-in. With the flag absent, bin/fm-pr-merge.sh reads no PR text and sends the same merge command as before.

VISION: One captain aligns (git history shows the outcome, not the fix-up mechanics) · Authority aligns (off by default; caller text and every merge guard unchanged) · Scripts aligns (deterministic extraction) · Restart neutral · Delegation aligns · Vendor aligns (GitLab and Forgejo untouched) · Scope aligns.

@Dematom1

Copy link
Copy Markdown
Contributor Author

Live evidence, as asked: two real squash merges through bin/fm-pr-merge.sh at afbc48b, with no merge flags passed, in a disposable private sandbox repository that has since been deleted, so the outputs are inline below rather than linked.
The sandbox used GitHub's squash defaults (squash_merge_commit_title=COMMIT_OR_PR_TITLE, squash_merge_commit_message=COMMIT_MESSAGES).
Each PR had two commits and a body with ## Intent, ## What Changed, and a no-mistakes appendix (<!-- no-mistakes-pr-appendix:v1 ... -->, ## Risk Assessment, attestation comment).
Both runs ended with verified: ... is merged (state=MERGED, merged=true, isInMergeQueue=false).

  1. With config/pr-squash-summary present (PR chore: initialize no-mistakes gate #1), gh received:
gh pr merge 1 --repo <sandbox> --match-head-commit aebcd7d7374eea7b98b5a01df0653a6679c23661 --squash --subject 'feat: live scenario one with the summary flag (#1)' --body $'- Add `change-1.txt` with two lines.\n- Keep the README unchanged.'

git log -1 --format=%B on the base branch:

feat: live scenario one with the summary flag (#1)

- Add `change-1.txt` with two lines.
- Keep the README unchanged.
  1. With the flag removed (PR docs: polish README banner and repo housekeeping #2), gh received:
gh pr merge 2 --repo <sandbox> --match-head-commit d0aba4dc051b6010ce8691a302281396f5f0dbf9 --squash

git log -1 --format=%B on the base branch, the repository default:

feat: live scenario two without the summary flag (#2)

* feat: add change file 2

* no-mistakes(review): tidy change file 2

@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 12, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1, that settles the live-evidence ask. Both real squash merges ran through bin/fm-pr-merge.sh at afbc48bb. With config/pr-squash-summary present, gh got --subject '<title> (#1)' and only the What Changed bullets as --body, and the base-branch commit text matches. With the flag removed, the merge line is the bare --squash and the commit text is GitHub's own default. That is the opt-in boundary I wanted to see on a real forge.

Gates on afbc48bb against latest main 47df77f3: the no-mistakes check passes and the attestation binds this head with no skipped steps. The coverage guard and repo invariants pass, and Greptile is 5/5 with both threads resolved. The full suite is queued now; nothing is needed from you while it runs.

contract-class: opt-in, unchanged. With the flag absent, bin/fm-pr-merge.sh reads no PR text and sends the same merge command as before.

VISION: One captain aligns · Authority aligns (off by default; caller text and merge guards unchanged) · Scripts aligns · Restart neutral · Delegation aligns · Vendor aligns (GitLab and Forgejo untouched) · Scope aligns.

@kunchenguid
kunchenguid merged commit afc5b76 into kunchenguid:main Nov 12, 2026
35 of 36 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @Dematom1 — really appreciate you taking the time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fm-pr-merge: opt-in squash commit text from the PR title and its "What Changed" section

2 participants