Repository navigation
feat(git): [#2022] vendor maintainer merge workflow - #2027
josecelano merged 16 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR brings the maintainer-only PR merge workflow into the repository by vendoring the audited MIT-licensed github-merge.py tool, adding a guarded repository-local wrapper to enforce deterministic preflight, and documenting the workflow as an AI-agent skill.
Changes:
- Vendored the upstream
github-merge.pymerge tool plus MIT license text, preserving provenance. - Added
merge-pull-request.shwrapper + deterministic shell-based tests to validate preconditions and delegation (including--dry-run). - Documented maintainer/agent merge procedure and added new terms to the spell-check dictionary / cspell ignores.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| project-words.txt | Adds merge-workflow terms to the project dictionary. |
| docs/issues/open/2022-vendor-and-document-maintainer-merge-workflow/ISSUE.md | Updates the issue spec with completed tasks and verification evidence. |
| cspell.json | Ignores the vendored github-merge.py for spell-checking. |
| contrib/dev-tools/git/tests/test-merge-pull-request.sh | Adds deterministic tests for the wrapper preflight and delegation behavior. |
| contrib/dev-tools/git/README-github-merge.md | Documents usage, provenance, coverage boundary, and EPIC #2003 relationship. |
| contrib/dev-tools/git/merge-pull-request.sh | Adds the guarded wrapper that enforces preconditions and supports --dry-run. |
| contrib/dev-tools/git/github-merge.py | Adds the vendored upstream merge tool implementation. |
| contrib/dev-tools/git/github-merge-COPYING | Adds the MIT license for the vendored tool. |
| .github/skills/dev/git-workflow/merge-pull-request/SKILL.md | Adds the maintainer/agent workflow skill documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2027 +/- ##
========================================
Coverage 81.50% 81.50%
========================================
Files 342 342
Lines 24337 24337
Branches 24337 24337
========================================
+ Hits 19835 19836 +1
Misses 4202 4202
+ Partials 300 299 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
docs/pr-reviews/pr-2027-copilot-suggestions.md:19
- The processing log says “five” unresolved Copilot suggestions, but the table lists 7 suggestions (rows 1–7) and the completion section also references seven threads. This inconsistency makes the audit record harder to trust/search.
- 2026-07-23: Started processing five unresolved Copilot suggestions.
contrib/dev-tools/git/tests/test-merge-pull-request.sh:135
- This assertion for an unset signing key can still be satisfied by a system-level git config (e.g. /etc/gitconfig), making the test flaky across environments. The unset-repository test already disables both global and system scopes; the signing-key test should do the same.
if (
cd "${fixture_root}"
GIT_CONFIG_GLOBAL=/dev/null \
./contrib/dev-tools/git/merge-pull-request.sh --dry-run 2022 >"${output_file}" 2>&1
); then
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
docs/pr-reviews/pr-2027-copilot-suggestions.md:45
- The completion entry says "All nine" Copilot threads were resolved, but the Suggestions table in this same document lists 17 threads (1–17). This makes the audit log internally inconsistent and unclear which threads the listed commits cover.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
project-words.txt:234
project-words.txtmust remain in deterministicLC_ALL=C sort -uorder (seecontrib/dev-tools/git/format-project-words.sh). In this hunk,ghtokenis currently listed beforegithubmerge, but bytewisegithubmergesorts beforeghtoken, so the formatter/pre-commit hook will reorder the file and abort the commit.
ghac
ghtoken
githubmerge
gpgsign
docs/pr-reviews/pr-2027-copilot-suggestions.md:46
- The Completion log says “All nine Copilot threads were replied to and resolved”, but this tracker records 18 threads (rows 1–18) and even has follow-up completion entries for threads 15–18. Clarify that this entry refers to the initial batch (rows 1–9) to avoid reading as the overall completion status.
- 2026-07-23: All nine Copilot threads were replied to and resolved. Signed commits `83ff6ddad88df276797678aedccf03ead2faa6ea`, `8eccc7594558d6feb67ffbd87a279b11ac249bd6`, and `e43cd738175444f1aa1b804d5828eb5a39f09a46` contain the action items; thread 6 was verified as no-action. A final refresh is required after committing this audit update.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
docs/pr-reviews/pr-2027-copilot-suggestions.md:47
- The Completion section is inconsistent with the Suggestions table: the table has 19 entries and still shows row 19 as IN_PROGRESS/UNRESOLVED with Reply URL = PENDING, but this line claims “All nine Copilot threads were replied to and resolved.” Please update the completion entry to reflect the current table state (and the still-open thread).
- 2026-07-23: All nine Copilot threads were replied to and resolved. Signed commits `83ff6ddad88df276797678aedccf03ead2faa6ea`, `8eccc7594558d6feb67ffbd87a279b11ac249bd6`, and `e43cd738175444f1aa1b804d5828eb5a39f09a46` contain the action items; thread 6 was verified as no-action. A final refresh is required after committing this audit update.
|
ACK a782e48 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
docs/pr-reviews/pr-2027-copilot-suggestions.md:47
- The Completion section says "All nine Copilot threads" were resolved, but the Suggestions table currently contains 19 entries and the completion bullets continue with threads 15-19. Update this first completion bullet to cover threads 1-14 (or otherwise avoid a hard-coded count) so the audit log stays internally consistent.
- 2026-07-23: All nine Copilot threads were replied to and resolved. Signed commits `83ff6ddad88df276797678aedccf03ead2faa6ea`, `8eccc7594558d6feb67ffbd87a279b11ac249bd6`, and `e43cd738175444f1aa1b804d5828eb5a39f09a46` contain the action items; thread 6 was verified as no-action. A final refresh is required after committing this audit update.
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of this pull request's change as it stands at a94c3ced8 on the default branch.
What still runs: contrib/dev-tools/git/merge-pull-request.sh checks the clean tree, githubmerge.repository, the current branch, that user.signingkey is set and, since 8279474de, that standard input is a terminal, then runs contrib/dev-tools/git/github-merge.py for develop with --symlinks .symlinks.json. Later commits added the declared-symlink check and the recorded-base check and refresh to the vendored script. The licence file is unchanged, and the README now records the arrival hash once instead of asking for a new hash per change. The skill moved to .claude/skills/merge-pull-request/SKILL.md, cited below as SKILL.md. One claim in the description did not hold at a782e48e8: the missing-tool case of test-merge-pull-request.sh deleted a tracked file, so the clean-tree check fired first and the suite could not pass. ea3cfcdcd fixed that.
[Minor] The tree-hash check does not cover what is finally signed, and closing that gap is hardening the tool's own integrity check. contrib/dev-tools/git/github-merge.py:761-764 compares the Tree-SHA512 of HEAD before and after the inspection shell. The two later git commit --amend calls (:777 and :791) then commit the index as it stands at that moment, and the installed pre-commit hook runs during both. Nothing compares the final commit with first_sha512 before develop is reset to it at :801. A file left staged during inspection therefore enters the merge without tripping the check. This can happen when the dictionary formatter's own message says to stage project-words.txt and someone does so, against SKILL.md:248-250. The merge then carries a change that is in no commit of the pull request, and its Tree-SHA512 line describes a different tree. The skill's own check after building the merge, git diff --exit-code (SKILL.md:206), cannot catch this, because it compares the working tree with the index. Smallest fix: recompute tree_sha512sum() after the amend at :791 and exit before :800 unless it equals first_sha512; refuse before :777 while the index differs from HEAD; pass --no-verify to both amends. In the skill, require an empty git status --porcelain instead.
[Minor] The skill gives the wrong place for the hook and the wrong recovery when it fails, which is a robustness hardening point rather than a safety one. SKILL.md:231-239 says the temporary git merge --commit runs the pre-commit hook and that the tool calls git merge --abort after a hook failure. In fact git merge (github-merge.py:703) runs only a pre-merge-commit hook, which install-git-hooks.sh never installs because .githooks/ holds only pre-commit and pre-push. The pre-commit hook runs at the two amends instead. When the formatter aborts at :777, the tool prints "ERROR: Cannot update message." (:779) and exits 4, and the rewritten project-words.txt stays in the working tree. If the pull request changed that file, the git checkout -q develop at :804 fails and the tool ignores the failure. The checkout then stays on pull/<n>/local-merge, and the recovery block's git switch develop (SKILL.md:243) refuses because of the local change. A hook failure at :791 is reported as "Error while signing, asking again." (:794), and every check reruns each time s is entered. Smallest fix: say in the section that the hook runs at the two amends, and discard the formatter's rewrite with git restore project-words.txt before git switch develop. Alternatively, adopt the --no-verify change above and say that the tool runs no hook.
[Nit] As hardening, the accepted symbolic links should be repeated where the decision to sign is made. README-github-merge.md:108 says each accepted link is visible "at the moment the decision is made". In fact check_symlinks prints them once (github-merge.py:455, called at :719), before the test command or the interactive shell, and the summary printed before the sign prompt (:783-785) does not repeat them. Because the declaration is read from the merged tree, a link and the entry admitting it can arrive in the same pull request. By the time of the prompt, the line reporting that may have scrolled away. Smallest fix: print the accepted links and stale-entry warnings again in the pre-sign summary, and mark entries that the merge adds or changes relative to the base's declaration.
[Nit] As hardening, the symbolic-link confinement should also exclude the repository's own metadata directory. symlink_target_is_confined (github-merge.py:278-290) refuses absolute targets and .. segments, but accepts a declared root-level link whose target lies under .git. Such a link makes a tracked path resolve into local repository configuration, which SKILL.md:122 also uses for user.ghtoken. The function's docstring treats confinement as a property of the target that no declaration can grant, and a .git segment belongs in the same class. Smallest fix: also return False when any segment of the target equals .git, compared case-insensitively.
[Nit] The line numbers in the "Known Upstream Issues" list (README-github-merge.md:124-128) have drifted, although the list says they "refer to the file as it currently stands". It cites 565/566, 144/147, 581-593, 608-616 and 418. In github-merge.py at a94c3ced8, those statements are at 768/769 (comment fetch), 215/218 (ask_prompt), 784-797 (sign loop), 811-819 (push loop) and 611 (global-scope message). Smallest fix: cite the function and the statement instead of line numbers.
[Nit] As hardening, the recorded-base check should exit through the cleanup. require_current_recorded_base runs at github-merge.py:681, after the fetch has created pull/<n>/head, pull/<n>/base and pull/<n>/merge but before the try at :690. Its exit 4 (:201, :213) leaves those branches behind, although SKILL.md:250-251 says the tool removes them in its finally block. A later run overwrites them, so the effect is only clutter. Smallest fix: move this check, and the fetch-time exits before it, inside the try.
Checked and found sound: github-merge.py arrived in 833a4160e with SHA-256 e390eb014131f3183a2cba642134974a6b09b19a65322d17dd7c81cf4ffbaad2, as the README records, and is byte-identical to the planning snapshot under issue #2022. github-merge-COPYING is that snapshot's MIT text and is unchanged at a94c3ced8, and the script keeps its copyright header. The wrapper's checks of the argument, clean tree, repository, branch, empty key and terminal work as their tests assert. Because the wrapper fixes the target to develop, githubmerge.pushmirrors stays out of the push, which still needs a typed push. The recorded-base refresh checks the target branch before it edits anything and validates the returned commit id. The declaration reader rejects non-standard JSON constants, wrong headers and duplicate paths, and escapes every value it prints. The comment-fetch TypeError at github-merge.py:768 is already recorded in the README as a known upstream issue.
Summary
Validation
Manual verification
Related to #2022