Makes scripts/merge-pr.sh usable for any fleet repository (the shared merge script from the 10 Nov review-findings plan):
-R owner/repo; per-repository settings in .github/merge-pr.json, read from the default branch through the API (never the PR head): base, review bots and waits, settle window, findings check, required workflows, CI gate and merge method. A repository without the file gets AFT's current values.
New gates: refuse GitHub closing keywords in the title, description, commit messages or the merge message; refuse outside PRs that change .github/ unless acknowledged by name; once threads are resolved, rerun a red findings check's own run on the PR and wait for it.
ci_gate: "merged-tree" (no-queue repositories): test the exact trial merge on a check branch, then fast-forward the base to that tested commit.
--prepare-only / --with-commit <sha> (merged-tree only): when the merged tree needs a maintainer commit the PR head can't contain (for example a regenerated file list), push the trial, build commits on it, then land the verified chain. The trial is verified by parents, a fresh git merge-tree result, its message and the operator email, not by SHA.
AFT's own behavior is unchanged apart from the two new refusals; the old AFT_MERGE_PR_* variables still work.
Tests use a fake gh and scratch remotes only.
Summary by cubic
Makes scripts/merge-pr.sh usable for any fleet repository by reading per-repository merge policy from .github/merge-pr.json on the default branch, never the PR head. AFT's own behavior is unchanged apart from two new refusals, and the old AFT_MERGE_PR_* variables still work.
New admission gates
Refuses closing keywords in the title, description, commit messages, or merge message.
Refuses outside PRs that change .github/ unless a maintainer acknowledges the changes by name.
Once review threads are resolved, reruns a red findings check's own run and waits, re-reading all gates after each pending poll and before landing a trial.
Merged-tree CI
ci_gate: "merged-tree" lets no-queue repositories test the exact trial merge on a check branch, then fast-forward the base to that tested commit.
--prepare-only / --with-commit lands a verified chain of maintainer commits built on the tested trial; each commit is checked for parents, merged-tree result, message, and operator identity.
Trial and maintainer commits must carry the operator checkout's Git identity and refuse before pushing when it is missing.
Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.
Summary
Makes merge-pr.sh reusable across fleet repositories, with policy read from the default branch.
Merge commands now follow the policy each repository keeps on its default branch.
The merge script checks issue text and outside .github/ changes.
No-queue repositories can test and land the exact merged tree.
Diagram
%%{init: {'theme': 'neutral', 'htmlLabels': false}}%%
flowchart TD
A[Read default-branch policy] --> B[Check pinned PR and reviews]
B --> C{CI mode}
C -->|Head| D[Check CI and submit through GitHub]
C -->|Merged tree| E[Create or verify trial merge]
E --> F{Prepare only?}
F -->|Yes| G[Keep trial branch for maintainer work]
G --> H[Supply maintainer commits]
H --> E
F -->|No| I[Test exact final tip]
I --> J[Check reviews again]
J --> K[Update base using exact lease]