Skip to content

fix(source-control): keep map upkeep from adopting a fork PR on the upkeep branch name - #10433

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-9937-40452312789-1
Oct 27, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-9937-40452312789-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #9937

Summary

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

/source-control:pull-request list now returns isCrossRepository and headRepositoryOwner for each pull request, so a caller can tell a fork's pull request from the repository's own when they share a head branch name. /app-control:map refresh step 4 now takes a listed pull request as the upkeep pull request only when it comes from the repository itself (isCrossRepository is false). Any other listed pull request makes the outcome blocked, with its URL and owner in the report, and the pass pushes nothing and opens nothing. This follows the owner's recorded decision on #9937.

Not verified

  • read-pr.test.sh was not run directly: this lane's Bash runs only the named wrappers. check-affected reported 11 passed, but its output does not list which tests it ran. The assertions were traced by reading and by the review subagent, and the PR's CI runs the suite.
  • The gh pr list pointer in read.md links the manual page without a section anchor. WebFetch could not show the page's heading ids, so an #options anchor could not be confirmed. The repo cites the same page without an anchor elsewhere (plugins/performance/skills/go-faster/reference/areas.md:135).
  • CI-only checks named by check-affected (line-citations, portability-lint, cant-fail-scan against base, evals-quality and the other whole-repo scanners) are left to the PR's CI.
  • Found by review, out of scope and not filed: other callers of the list action can also take a same-named fork PR as their own. These are plugins/review/skills/quality-gate/context/close-out.md (list --head --state all), plugins/improvement/skills/improve/SKILL.md (list --head-match), and refresh.md'

Fix

  • plugins/source-control/skills/pull-request/scripts/read-pr.sh: LIST_FIELDS adds isCrossRepository and headRepositoryOwner.
  • plugins/source-control/skills/pull-request/scripts/read-pr.test.sh: the gh stub now returns only the fields --json asked for, as gh does, and its list fixture carries a fork row. A new case asserts each listed PR carries both new fields and that the gh call asks for them.
  • plugins/source-control/skills/pull-request/reference/read.md: the list field set names the two new fields, says a caller after the repository's own PR counts only rows with isCrossRepository false, and adds an upstream-drift pointer record for gh pr list --head.
  • plugins/app-control/skills/map/reference/refresh.md: step 4 (Pull request) blocks on any listed PR whose isCrossRepository is not false. The blocker names that PR's URL and headRepositoryOwner login, and the pass pushes nothing, opens nothing, and never reports the fork PR as the upkeep PR. Otherwis
  • .changes/source-control/fix-9937-map-upkeep-fork-pr-5c2e8a14.md: patch fragment for the list fields.
  • .changes/app-control/fix-9937-map-upkeep-fork-pr-9b41d6e3.md: patch fragment for the refresh fork-PR block.

Verification

The runner ran each check from the base copy against 4ebec6f:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //cli.github.com/manual/gh_pr_list: the --head flag is described as 'Filter by head branch ("<owner>:<branch>" syntax not supported)', and the JSON Fields list includes isCrossRepository and headRepositoryOwner.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: all 8 changelog fragments under .changes/ are valid (run before and after the review fixes).
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 11 passed, 6 skipped over 6 changed files (run before and after the review fixes).
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/verify/bin/cant-fail-scan --file plugins/source-control/skills/pull-request/scripts/read-pr.test.sh --check: PASS, no gating findings, 1 test file fully read.
  • Fresh-context subagent review of the whole diff: no correctness bugs in read-pr.sh. It found 6 issues. Fixed 5: refresh.md now blocks on any isCrossRepository that is not false, so a row missing the field cannot fall through to opening a duplicate PR; restated gh --head behavior removed from read.md
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40452312789

Left out: the items under Not verified.

Related

#9937

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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4ebec6fbeded646469358fa3853af9672600221b: 0 finding(s), 0 as inline comments.

No security issues found in PR #10433 at 4ebec6f.

critical-findings: 0

I read the whole diff (6 files) and the PR context.

  • Trusted paths: no changed file matches a TRUSTED PATHS: glob. None of the trust controls (trusted-trigger check, lane token scope, kill switch, merge holds, broker inputs) is touched.
  • Manifests: no plugin.json or marketplace.json changes, so there are no manifest <field> lines.
  • Instruction surface: the refresh.md step 4 change tightens a standing instruction and removes none.
    • It blocks on any listed pull request whose isCrossRepository is not false. That includes a row missing the field, so a missing field fails closed.
    • In that case the pass pushes nothing and opens nothing.
    • Before the change, a same-named fork PR could be taken as the upkeep PR. Now it stops the pass and is named in the report.
    • The register file was not consulted, because the removed text is not a guardrail.
  • read-pr.sh: the only change adds two read-only fields to the --json list passed to gh pr list. LIST_FIELDS is a constant and takes no user input. The field names have no injection surface.
  • read-pr.test.sh: the gh stub parses --json and passes it to jq as --arg, not interpolated into the filter. It is test-only and fed fixed data.
  • Prose and changelog fragments: read.md and the two .changes fragments grant no authority.
  • PR text: the PR context holds no embedded directives aimed at the lane.
  • Spend: the change adds no spend.

The PR description notes that other list callers (quality-gate/context/close-out.md, improve/SKILL.md, and one more cut off in the description) can still take a same-named fork PR. That is outside this diff and was not reviewed here.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 4ebec6fbeded646469358fa3853af9672600221b: 0 finding(s), 0 as inline comments.

No findings. I read the full diff and the PR context. I did not run any tests or checks, so everything below comes from reading the code.

What changed.

  • read-pr.sh adds isCrossRepository and headRepositoryOwner to LIST_FIELDS.
  • read-pr.test.sh makes the gh stub return only the fields --json asked for, as gh does. It adds a fork row and a case that asserts both fields come back and that the gh call requests them.
  • read.md documents the two fields and the rule that a caller after the repository's own PR counts only isCrossRepository == false rows.
  • refresh.md step 4 now blocks on any listed PR whose isCrossRepository is not false. The blocker names the PR's URL and headRepositoryOwner login. The pass pushes nothing and opens nothing.
  • Two patch changelog fragments cover the two plugins.

Closing issue #9937 criteria (the comment's checkboxes are unchecked in the issue text; I judged each against the diff):

  • list returns both fields: met by read-pr.sh:40, and the new test asserts them.
  • refresh counts a match only when isCrossRepository is false, and a fork PR makes the outcome blocked and is named in the report: met by refresh.md step 4. Testing "not false" instead of "is true" also blocks a row that lacks the field, so it can't fall through to opening a duplicate PR.
  • A test of read-pr.sh list asserts both fields are in the output: met.

Judgment calls, not findings.

  • Step 4 blocks whenever any listed PR is cross-repository, even if the repository's own upkeep PR is also listed. That matches the issue's decision ("a same-named fork PR makes the outcome blocked"), and the blocker says it is cleared by closing the fork PR.
  • The refresh logic is prose in a skill reference. The new test covers only the list fields. Nothing tests the blocked behavior, which is expected for this kind of file.
  • The author lists other list callers that can still take a same-named fork PR: quality-gate/context/close-out.md, improve/SKILL.md, and part of refresh.md. They are outside this change and the author did not file them. They are worth a follow-up issue.
  • The fragment bumps are patch for both plugins. That fits a fix, though the new list fields are a small output addition.

The PR body's "Verification" section is author-claimed. I did not confirm it.

No change here adds a hold class. Nothing in this PR can start a real charge, and there is no critical security finding.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 4ebec6fbeded646469358fa3853af9672600221b.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit db87dd3 Oct 27, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-9937-40452312789-1 branch October 27, 2026 06:53
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.

fix(source-control): map upkeep can adopt a fork PR that shares the upkeep branch name

0 participants