Skip to content

feat(source-control): give pr-worktree.sh and verify-gate.sh a --dir argument - #15809

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-15791-43358970953-1
Nov 13, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-15791-43358970953-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #15791

Summary

Opened by the work-resolve-issue lane. The run's own summary:

pr-worktree.sh and verify-gate.sh now take an optional --dir <checkout>, as target-repo.sh does, so a session whose shell sits outside the target repository can run the ready gate. pr-worktree.sh runs its gh pr view from that checkout and its git worktree list with git -C; verify-gate.sh reads the common git directory with git -C <dir> unless READY_VERIFY_DIR is set, which still wins. Both default to the current directory, so callers that pass no --dir behave as before. Design choice: the reference command lines pass --dir "<checkout>" to pr-worktree.sh (a new placeholder defined in 2.5.3 as the checkout the session works on, '.' when the shell sits in it) and --dir "$PR_TREE" to every verify-gate.sh call, since the PR worktree shares the repository's common git directory and is already resolved on those lines.

Not verified

  • The bash test suites (pr-worktree.test.sh, verify-gate.test.sh, ready-flip.test.sh) were not executed: this lane's Bash runs only the named wrappers, and check-affected runs with no --tests. Left to the PR's CI.
  • Tidy ran passes 1-4 with no code edits and one wording edit in skills/pull-request/reference/ready-for-review.md 2.5.3. In pass 5 the ai-slop detector (detect.sh) could not run in this lane, so only a manual rubric read was done (no findings), and the semantic-diff verify step was skipped.
  • Build/test and lint step: no build applies to bash and markdown; lint ran inside check-affected; tests left to CI as above.
  • Finding outside this issue: confirm-verdict.sh (used next to pr-worktree.sh in the 2.5.6 report line) still reads git rev-parse --git-common-dir from the working directory (confirm-verdict.sh:105), so a shell outside every checkout gets 'no verdict readable' there. The output is advisory and never…

Fix

  • plugins/source-control/skills/pull-request/scripts/pr-worktree.sh: optional --dir <checkout> (given once, non-empty, must be a directory, else exit 1); gh pr view runs from that directory (CDPATH cleared, cd --) and git worktree list uses git -C; Usage and exit-code header updated
  • plugins/source-control/skills/pull-request/scripts/verify-gate.sh: optional --dir <checkout> for record and check (same validation); git -C <dir> rev-parse --path-format=absolute --git-common-dir when READY_VERIFY_DIR is unset; Usage header updated
  • plugins/source-control/skills/pull-request/scripts/pr-worktree.test.sh: cases for --dir run from a directory outside every checkout (main checkout and PR worktree both resolve to the PR worktree; no --dir from outside exits 2; missing value, missing directory and a repeated --dir exit 1); the 2.5.3…
  • plugins/source-control/skills/pull-request/scripts/verify-gate.test.sh: record with --dir from outside the checkout, check from the checkout and with --dir from outside; READY_VERIFY_DIR wins over --dir; usage errors for --dir
  • plugins/source-control/skills/pull-request/scripts/ready-flip.test.sh: extracted blocks fill <checkout> from FLOW_CHECKOUT at run time (default '.'); new case runs the wait and flip blocks from outside every checkout with <checkout> naming the repository
  • plugins/source-control/skills/pull-request/reference/ready-for-review.md: the pr-worktree.sh calls (2.5.3 venue read, verify record, skip record; 2.5.6 report) pass --dir "<checkout>", the verify-gate.sh record calls pass --dir "$PR_TREE"; 2.5.3 defines <checkout>
  • plugins/source-control/reference/providers/github/pull-request/ready-for-review.md: the wait block's pr-worktree.sh call passes --dir "<checkout>", both verify-gate.sh check guards pass --dir "$PR_TREE"; prose names <checkout> with a link to 2.5.3 and says the flip block reads PR_TREE…
  • .changes/source-control/work-resolve-issue-issue-15791-43358970953-1-d806c1b1.md: minor changelog fragment (Added) for the new --dir argument

Verification

The runner ran each check from the base copy against e500aa1:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 2 fragments valid (run after the edits, after tidy and after the review fixes)
  • check-changed-skills: pull-request PASS, 0 errors, 4 warnings, all of them about the file as it was before this change (description length, SKILL.md size, no TOC in ready-for-review.md)
  • check-affected: 13 passed, 6 skipped over 8 changed files (shellcheck and markdown checks on the changed files included); run three times, last after the review fixes
  • grep for line citations of the changed files (pr-worktree.sh:N, verify-gate.sh:N, ready-for-review.md:N): only docs/upstream citations of ready-for-review.md lines 62 and 163, above every edit, so none shifted
  • fresh-context review subagent over the whole diff: no confirmed bugs; applied its notes (CDPATH-safe cd --, an assert_exit on the --dir PR-worktree case, two prose precision fixes)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43358970953

Left out: the items under Not verified.

Related

#15791

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed e65418d42b4b40dd9e29ad0f593e0b3153046b30: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15809, incremental since e500aa12

No security issues found.

Scope. Since the last review, this push changes one file: plugins/source-control/skills/pull-request/scripts/ready-flip.test.sh. I read every hunk of it in .claude-lane/incremental.diff. It matches no trusted-path glob.

What I checked. The change only touches the test harness:

  • The gh stub now needs a named repository. The stub fails unless GH_REPO=acme/tool or -R acme/tool is set. This makes it behave like real gh outside a checkout.
  • run_flow and run_report set GH_REPO themselves. run_flow exports GH_REPO inside a subshell (FLOW_GH_REPO, default acme/tool, empty leaves it unset). run_report passes GH_REPO=acme/tool.
  • One new case. With GH_REPO unset, it checks that the flow refuses to flip the PR.

The stub, its variables and the temp directories all exist only in the test sandbox. Nothing here:

  • touches a trust control, merge hold, token request, kill switch, workflow or plugin manifest;
  • deletes or softens any standing instruction;
  • changes what the shipped scripts do.

The other seven files are unchanged since the last review, which found nothing in them.

Prior findings. The only earlier post from this lane is the summary for e500aa12, which reported 0 findings, so there is nothing to restate. This was a blocking-only review (the prior-findings file says blocking only: yes), so it would have reported CRITICAL and IMPORTANT findings only.

PR context. The pull request text contains no instructions aimed at this lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on e500aa1244e79fa7e6aa927f942f34bce96fc995; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed e65418d42b4b40dd9e29ad0f593e0b3153046b30: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Incremental code review: PR #15809, e500aa12 → e65418d4

I read the full change to the one file in scope, plugins/source-control/skills/pull-request/scripts/ready-flip.test.sh. It doesn't match any trusted-path glob. This lane already reviewed an earlier head, so this pass looked only for blocking findings.

What changed

  • The gh stub now needs a target repository. It fails any call that names neither -R acme/tool nor GH_REPO=acme/tool (L72-75).
  • run_flow sets GH_REPO itself. It clears any inherited GH_REPO and exports acme/tool by default. Setting FLOW_GH_REPO='' leaves it unset; the ${FLOW_GH_REPO-…} expansion tells unset and empty apart correctly under set -u (L122-128).
  • run_report exports GH_REPO=acme/tool.
  • New negative case. The flow runs from outside every checkout without GH_REPO, and the test asserts the PR is not flipped (L250-255).

Checked against the reference. Line 18 of ready-for-review.md exports GH_REPO="$REPO". The blocks the test extracts (wait, flip, confirm) don't set GH_REPO again. Their untargeted reads at L232, L238, L259, L262 and L282 rely on that exported value, and gh pr ready passes -R "$REPO". So the stub now models how gh targets a repository, the existing outside-every-checkout case depends on that targeting, and no current case loses coverage.

Settled thread. My earlier finding on ready-for-review.md L261-263 asked for -R "$REPO" on the reads. The pr-unblock lane answered it: the file's single targeting rule is the exported GH_REPO, and they fixed the test instead. The thread is resolved and marked lines changed since resolution: no, so I am not raising it again.

Not verified by me. I couldn't run ready-flip.test.sh; I have no shell. The fix reply says CI runs it after the push. That is the author's claim and I haven't checked it.

No closing-issue criterion is affected by this change. No plugin manifest changed. This change spends no prepaid credits or extra runs.

No candidate findings came up, so I dispatched no verifier.

Verifier dropped 0 of 0 candidates.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM628aoU
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head e500aa1244e79fa7e6aa927f942f34bce96fc995, the head its arming checks judged.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Verification evidence for e65418d

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15809-e65418d42b4b40dd9e29ad0f593e0b3153046b30, expires on 2026-12-13.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=e500aa1244e79fa7e6aa927f942f34bce96fc995 rubric=8.4.15 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on e65418d.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head e65418d42b4b40dd9e29ad0f593e0b3153046b30, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=e65418d42b4b40dd9e29ad0f593e0b3153046b30 rubric=8.4.15 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 02dfba7 Nov 13, 2026
53 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15791-43358970953-1 branch November 13, 2026 04:11
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/source-control/skills/pull-request/scripts/pr-worktree.sh 3 1 0 0 0 0
plugins/source-control/skills/pull-request/scripts/verify-gate.sh 2 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/source-control/skills/pull-request/scripts/pr-worktree.sh:59 SBR productive input-gap
plugins/source-control/skills/pull-request/scripts/verify-gate.sh:56 LCR productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 02dfba7b6c7eedbd095e5cce07fea69d7ead6fde; later checks count it verified from this comment.

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.

source-control: pr-worktree.sh and verify-gate.sh take no --dir, so a session working by absolute path cannot run the ready gate

0 participants