Repository navigation
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds a reviewed, implementation-free specification for issue #2195 describing a repository-neutral Python rewrite of the maintainer merge wrapper.
Changes:
- Added an issue specification document detailing goals, architectural decisions, behavior mapping, and acceptance criteria for the port.
- Extended the project dictionary to include new technical terms used by the spec.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/issues/open/2195-merge-wrapper-python-port/ISSUE.md | New spec document defining the planned Python port, behavior parity, and verification plan for #2195. |
| project-words.txt | Adds spellcheck allowlist entries referenced by the new spec. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| The vendored engine `contrib/dev-tools/git/github-merge.py` bakes in no repository identity. It reads `githubmerge.repository` (line 543), `githubmerge.host` (line 544), `githubmerge.branch` (line 545), `githubmerge.merge-author-email` (line 546), `githubmerge.testcmd` (line 547), `user.ghtoken` (line 548) and `user.signingkey` (line 549) from Git configuration, and its own help text (lines 513-522) documents them as the configuration surface. Its one Torrust-named constant, `SYMLINK_DECLARATION_NAMESPACE` (line 240), names the declaration format rather than a repository, which the comment above it and the format documentation both state; every repository adopting the workflow carries the same value. The engine is configuration-driven all the way down. | ||
|
|
||
| The wrapper is not. `merge-pull-request.sh` holds `EXPECTED_REPOSITORY="torrust/torrust-tracker"` (line 11), `TARGET_BRANCH="develop"` (line 12) and `SYMLINK_DECLARATION=".symlinks.json"` (line 13), and `require_repository_configuration` (lines 38-50) exits unless `githubmerge.repository` is exactly equal to the first of them. The same string is asserted in the wrapper's own test suite (`contrib/dev-tools/git/tests/test-merge-pull-request.sh` lines 44, 65, 109, 134, 271), in the sibling engine suite's fixture (`contrib/dev-tools/git/tests/test-github-merge-symlinks.py` line 30), in `contrib/dev-tools/git/README-github-merge.md` (lines 4-6) and in `.github/skills/dev/git-workflow/merge-pull-request/SKILL.md` (lines 21-22, 63, 70). |
| | ID | Status | Task | Notes / Expected Output | | ||
| | --- | ------ | ---- | ----------------------- | | ||
| | T1 | TODO | Establish the program skeleton and its first slice | `merge-pull-request.py` with the command line, the interpreter-version floor, the `git` helper and one configuration read, plus the test module that exercises them. Reviewed before the remaining behaviors are ported. | | ||
| | T2 | TODO | Port argument handling | `--dry-run`, `-h`/`--help`, and a pull-request argument accepted only in the shape the shell wrapper accepts, with the current message text and exit code `2`. | |
|
I've commented on #2195 (comment). If you are using the script in Torrust Index, you should consider build it there and we can copy it later to the Torrust Tracker repo. But I totally discourage using bash or python if not temporarily or justified. |
Related to #2195
Summary
This pull request adds the reviewed specification for issue #2195 and contains no implementation, so it does not resolve the issue.
The specification replaces
contrib/dev-tools/git/merge-pull-request.shwithcontrib/dev-tools/git/merge-pull-request.py, a repository-neutral program beside the vendored engine that performs the same preflight and the same delegation. The engine already reads every repository fact from Git configuration; the wrapper does not, holdingEXPECTED_REPOSITORY="torrust/torrust-tracker",TARGET_BRANCH="develop"andSYMLINK_DECLARATION=".symlinks.json"as constants and refusing to run anywhere else. The concrete cost istorrust/torrust-index, which carries the symbolic link that made the declaration mechanism necessary but ships no copy ofcontrib/dev-tools/git, so a maintainer there invokes the engine directly and loses the argument check, the clean-tree check, the current-branch check, the repository-local signing message, the terminal guard,--dry-run, and the--symlinksargument without which no declaration is processed at all.What the specification decides
The repository is validated by shape, never by value:
githubmerge.repositoryis required and must match<owner>/<repo>, and AD2 states why the equality check that is given up was never a safety property, since the engine builds its fetch remote from the same locally configured value and displays the merge details before anything is signed.The target branch comes from
githubmerge.branchwith a documented default ofdevelop, and the declaration path fromgithubmerge.symlinkswith a documented default of.symlinks.json, validated with the rule the engine applies to--symlinksand passed unconditionally, because an off switch would let a repository lift a refusal by editing configuration instead of by committing a reviewed declaration.Delegation uses
os.execvonsys.executable, so the engine's exit code remains the command's exit code and the engine runs under the interpreter that just executed the preflight. The interpreter-on-PATHcheck becomes a documented and program-checked minimum version, and the bash suite'sscript(1)probe disappears with its dependency once the pseudo-terminal comes frompty.openpty().The bash suite is replaced by
contrib/dev-tools/git/tests/test-merge-pull-request.pyin the conventions of the existing engine suite, and a behavior mapping table accounts for every behavior of the shell wrapper and every one of its thirteen cases, marking exactly two as dropped with the reason each stops existing and exactly one as deliberately changed.The specification also plans an ignore rule for
__pycache__/, which.gitignorecarries for no Python file today: a cache written beside the program leaves an untracked directory incontrib/dev-tools/git/, and the wrapper's own clean-tree check refuses a tree that carries one.Files touched
Only
docs/issues/andproject-words.txt. Againstdevelopthe branch adds one document,docs/issues/open/2195-merge-wrapper-python-port/ISSUE.md, and three dictionary entries,execv,openptyandpycache; no source, test, workflow or manifest is changed here. The port itself follows in a separate implementation pull request from the reserved2195-merge-wrapper-python-portbranch.Validation performed
Six documentation gates were run at the branch tip
00a4bfe8, all green:linter markdown(5.8 s),linter cspell(8.7 s),linter yaml(0.4 s),linter toml(0.1 s),linter shellcheck(1.4 s), andlychee --offlineover the new document (0.05 s). The branch changes no Rust, soclippyandrustfmthave nothing to report on it and were not run.The document moved from
docs/issues/drafts/merge-wrapper-python-port/todocs/issues/open/2195-merge-wrapper-python-port/, which is the same directory depth, so its two relative links, tocontrib/dev-tools/git/README-github-merge.mdand to themerge-pull-requestskill, are unchanged and still resolve; lychee confirms this independently.git diff --checkover the branch range againstdevelopreports no whitespace defects.