Repository navigation
fix(pr-unblock): stage every module a base-script activity loads - #18664
Conversation
…vities collect-base-activity copies a script activity's directory to $RUNNER_TEMP/base-script with lib/ and pr-merge/merge-holds.mjs beside it, but not apply-patch/cdn-paths.mjs. apply-dependency-verdict.mjs and cdn-pins-sync.mjs (which review-dependency.mjs imports) load it as ../apply-patch/cdn-paths.mjs, so apply-dependency-verdict failed with ERR_MODULE_NOT_FOUND on every Dependabot pull request since #18336. Stage cdn-paths.mjs into $RUNNER_TEMP/apply-patch/ in the same shape as merge-holds.mjs. A new test runs the staging step for every .mjs script activity a lane runs through pr-run-activity-read or -write and checks that each static relative import resolves in the staged layout. It pins the one remaining gap, declare-test-scope.mjs, which this change leaves. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UJUn7JjbzH3qP4NugM6Ns5
collect-base-activity staged a script's own directory plus a hand-kept list of siblings, so report-escalation.sh could not load pr-merge/refire-refused.mjs or source the API budget wrapper, declare-test-scope.mjs could not load, and address-feedback.mjs's dynamic imports failed. stage-closure.mjs now copies the directory of the script and of every file it loads, transitively, to its repository path under $RUNNER_TEMP/base-script, always from the base checkout. Both runners run the script as $RUNNER_TEMP/base-script/$SCRIPT, and the write runner drops its hand-copied apply-patch siblings. The collect test walks every load of every runner script activity in the real staged layout and the declare-test-scope pin is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UJUn7JjbzH3qP4NugM6Ns5
…ty-import-closure # Conflicts: # .github/actions/collect-base-activity/action.yml # .github/actions/collect-base-activity/collect-base-activity.test.mjs # .github/scripts/apply-patch/apply-patch.test.mjs
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: no security issues foundThis lane already reviewed an earlier head ( Scope. This was an incremental review of the 3 files listed in What I checked.
The change touches no critical-findings: 0 |
|
claude-review reviewed CI code review: PR #18664 (incremental, blocking only)No blocking findings. This review covers what changed since What changed, in three files:
What I checked: Scope: I read every hunk of the three files in the incremental diff. I ran nothing; all of this comes from reading the files. Closing issue: none, so there are no acceptance criteria to check. Loosened checks would be marked: fail (default; the prompt has no No plugin manifest changed. Verifier dropped 0 of 0 candidates. |
|
The pr-unblock lane stopped
When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean. To run it again on this head now, dispatch the gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=18664 -f activity=resolve-conflicts |
main's callers.test.mjs case "the script step passes apply-patch's test-scope reasons out and refuses another row's" wrote its fake apply-patch.mjs as base-script/apply-patch.mjs, the basename layout this branch replaces: the step now runs $RUNNER_TEMP/base-script/$SCRIPT, so the fake was not found (exit 127). The fake now sits at base-script/.github/scripts/apply-patch/apply-patch.mjs; every assertion is unchanged, and the other row's reason is still refused. apply-patch.test.mjs stages apply-patch's closure, which copies .github/scripts/pr-merge/ and pr-unblock/ whole; it declares both. Findings: https://github.com/melodic-software/claude-code-plugins/actions/runs/45340727053/job/138263845528 https://github.com/melodic-software/claude-code-plugins/actions/runs/45340727053/job/138263845585 Co-Authored-By: Claude Opus 5.5 <[email protected]>
stage() copied the whole directory of every file a script loads, so intake-triage/admit.mjs's read of .github/recurring-schedule.json staged all of .github/ for apply-dependency-verdict and publish-feedback. A loaded file that is not a JS or shell module (JSON and other data, docs, a new URL resource) is now copied as that one file at its repository path; a module still brings its whole directory, which keeps computed-path sibling reads and resolve-config's node_modules working. collect-base-activity.test.mjs gains a test that staging admit.mjs copies .github/recurring-schedule.json and no other top-level .github file; it fails on the previous stage(). Finding: https://github.com/melodic-software/claude-code-plugins/actions/runs/45340727053/job/138263845585 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ty-import-closure # Conflicts: # .github/scripts/work-resolve-issue/report-outcome.test.mjs
stage() copied a loaded module's directory recursively, so every fixtures/, probe/ and reentry-eval/ subtree beside a module was staged. It now copies only the files directly in a module's directory; a subdirectory is staged only when something in the closure loads a file in it. .github/actions/resolve-config/node_modules stays the one kept recursive copy, and a directory load (docs/upstream/) stays recursive for that directory alone. collect-base-activity.test.mjs gains a test that staging publish-feedback.mjs leaves pr-unblock/fixtures/ out (it fails on the previous stage()), and one that a staged resolve.mjs still imports yaml and ajv from the copied node_modules. Finding: https://github.com/melodic-software/claude-code-plugins/actions/runs/45340727053/job/138263845585 Co-Authored-By: Claude Opus 5.5 <[email protected]>
stage() still copied the files beside every loaded module, so one import of lib/publish-gate.mjs staged all of lib/ and one `new URL` of scripts/upstream-drift-vendored-report.sh staged all of scripts/. It now copies the entry script's own directory one level deep (where a computed-path sibling read happens), every other loaded file, module or data, as that single file at its repository path, resolve-config's node_modules beside any resolve-config module it loads, and a directory load (docs/upstream/) recursively. collect-base-activity.test.mjs gains a test that staging issue-spec.mjs copies scripts/upstream-drift-vendored-report.sh alone and staging write-verdict.mjs copies lib/publish-gate.mjs alone; it fails on the previous stage(). address-feedback.test.mjs declares .github/scripts/pr-unblock/* and docs/upstream/*, and publish-feedback.test.mjs declares docs/upstream/*, the reads the strict trace still reported. Finding: https://github.com/melodic-software/claude-code-plugins/actions/runs/45340727053/job/138263845585 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The staging tests copy files from .github/actions/resolve-config/, .github/scripts/intake-triage/, pr-unblock/, pr-verify/, work-resolve-issue/package.json and docs/upstream/. The suite now declares each in a test-scope line, and the strict trace reports no gap. Finding: https://github.com/melodic-software/claude-code-plugins/actions/runs/45349918725/job/138293818756 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The claude-review IMPORTANT finding on collect-base-activity's action.yml description: it and pr-run-activity.md step 8 still described copying the directory of every loaded file, while stage-closure.mjs copies the files in the entry script's own directory and each other loaded file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t outside the base The claude-review suggestion that the closure test shares the stager's own loads() detector held: resolve-config.mjs read lane-rules.json and its four sibling rule files by a name passed through readOwn, which loads() cannot see, so a staged declare-test-scope.mjs failed with ENOENT in testScopeFromBase. Each rule file is now a literal new URL() the stager follows. Two tests check the staged tree without loads(): every runner .mjs entry imports from it, and a staged declare-test-scope reads the base config. The claude-review and claude-security-review suggestions on the entry-directory copy: stage() now refuses a script path that is absolute or resolves outside the base before it reads or copies anything. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review findings on head 09bf9b9 (claude-review findings=3, claude-security-review findings=1, critical=0): all four are fixed in two new commits. 1. IMPORTANT (claude-review), the action description and convention doc describe directory-per-load staging. Fixed. The 2. SUGGESTION (claude-review), the closure test uses the stager's own
The second test failed before the fix and passes after it. The search's other hits are not reached from a runner script activity: 3. SUGGESTION (claude-review) and 4. SUGGESTION (claude-security-review), the entry-directory copy does not apply the outside-base check. Fixed. Verification: |
…listed rule files
Round-two claude-review suggestions on the base-script stager:
- Shell entries were checked only by loads(). A new test counts each
BASH_SOURCE[0] or dirname "$0" reference in every shell file a runner
shell entry reaches, and fails when loads() follows fewer, so a
`here=$(dirname "${BASH_SOURCE[0]}")` load cannot be skipped silently.
- resolve-config.mjs's readOwn names OWN_FILES and the stager in its error
for a name the map does not list, in place of readFileSync(undefined).
- The reason the write runner's apply-base step copies patch-rules.json and
dependabot.yml out of .base, which the deleted comment held: the head
checkout replaces .base, and apply-patch reads patch-rules.json and the
dependency-manifests rule reads dependabot.yml's pairs after it. The
comment-lint hook refuses that comment, so the reason lives here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ty-import-closure
|
Round two on head 8c89616 (claude-review findings=3, critical=0): two findings are fixed in a new commit, and the third is dispositioned below. 1. SUGGESTION: shell entries are checked only by 2. SUGGESTION: 3. SUGGESTION: the deleted workflow comment held the reason apply-base copies Verification: |
…are staged pr-review-main SUGGESTION at 5378943: stage() copied every file beside the entry script but never walked them, so a sibling reached by a computed path (an `import(./${name}.mjs)` or `node "$here/$tool"`) was staged while its own imports outside the entry directory were not, and failed at run time with ENOENT or ERR_MODULE_NOT_FOUND. Each sibling is now visited like a loaded file, so its loads are staged as single files. Test files beside the script (*.test.mjs, *.test.sh) are copied but not walked: nothing in an activity runs them, and walking them staged their fixtures/ subtrees. A new test stages an entry whose sibling imports ../lib/x.mjs; it fails on the previous stager and passes now. The data-file test now allows the one workflow file a sibling loads (intake-triage.yml, 1 of 43) and still fails on a whole-directory copy. Two new single-file test-scope lines cover check-born-triaged.mjs and check-wip-cap.mjs, which the walk now reads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
pr-review-main claude-review SUGGESTION at 5378943 ( |
… the walk's reads claude-review at f929bbe flagged the admit.mjs staging test's relaxed workflows assertion as a loosened check. With test files no longer walked, no workflow file is staged at all, so the original assertion (no .github/workflows entry) holds again and is restored unchanged. Test Selection at f929bbe failed on address-feedback.test.mjs reading lib/conflict-record.mjs undeclared; the strict trace over all five stager suites also found 15 reads in report-outcome.test.mjs. Declared: conflict-record.mjs in address-feedback.test.mjs, and work-resolve-issue/*, branch-cleanup/* and check-born-triaged.mjs in report-outcome.test.mjs. The trace over the five suites now reports no gap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No related issue: staging gaps found by the test in #18660
Summary
A script activity runs from a base copy under
$RUNNER_TEMP, staged bycollect-base-activity. That copy held the script's own directory atbase-script/, plus a hand-kept list of siblings (lib/,pr-merge/merge-holds.mjs,apply-patch/cdn-paths.mjs, and the write runner's apply-base copies). Any load outside that list failed at run time:report-escalation.shcould not load../pr-merge/refire-refused.mjs. Its stderr goes to/dev/null, so the workflow-modified refusal hold never fired. It also skipped the API budget wrapper, because../../../.github/actions/log-api-budget/api-budget.bashdid not resolve.declare-test-scope.mjs(fix-test-scope) could not load../maintenance-reconcile-lost-runs/infra-failure.mjsorrate-guard.mjs.address-feedback.mjs's dynamic imports ofpr-verify/resolve-pr.mjs,intake-triage/admit.mjsandrate-guard.mjsfailed. The scripts that import it areapply-dependency-verdict,publish-feedback,resolve-threadsandreport-escalation.Fix
.github/actions/collect-base-activity/stage-closure.mjs. It walks the script's loads transitively: static and literal dynamic imports andimport.meta.urlresources in a module, and paths besideBASH_SOURCEin a shell script. Under$RUNNER_TEMP/base-script, at each file's repository path, it copies the entry script's own directory one level deep (no subdirectories), where a sibling read by a computed path happens. Every other loaded file, module or data, is copied as that single file, so one import oflib/publish-gate.mjsno longer stages all oflib/andadmit.mjs's read of.github/recurring-schedule.jsonno longer stages all of.github/.resolve-config's installednode_modulesis copied whole beside anyresolve-configmodule the closure loads, and a directory load (docs/upstream/) copies that directory recursively. Nothing outside the base is read or copied.$RUNNER_TEMP/base-script/$SCRIPT. The base tracker-config and trusted-actors copies keep their paths at the staging root.lib/,pr-unblock/,pr-merge/), since the closure carries them. It still copiespatch-rules.jsonanddependabot.yml.plugins/). It also costs the test one full copy per script. A mirror of.github/alone misses four loads outside it:lib/publish-gate.mjs,scripts/upstream-drift-vendored-report.sh,plugins/work-items/scripts/charge-words.jsonanddocs/upstream/. The directory-granular closure stages what each script loads and nothing else.Security
Every staged file comes from
$BASE_PATH, which is.base: the default-branch tip checked out withpersist-credentials: false, never the PR head. The stager runs from$GITHUB_ACTION_PATH, which is the action loaded from./.base. Staging more base files does not change what PR-head content can reach. In the read runner, head code and the model already share$RUNNER_TEMPwithbase-script/, as before. In the write runner, no step after the head checkout runs head code (write-runner-never-rules.test.sh). The stager copies symlinks verbatim and skips any load that resolves outside the base.Loosened checks
scripts/write-runner-never-rules.test.sh: the assertion "the apply-patch base copy holds every sibling-directory module apply-patch.mjs and its predicates import" is removed. Its subject, the apply-base step's hand-writtenmkdir/cplines for apply-patch's sibling modules, no longer exists. The same property is now checked more strictly bycollect-base-activity.test.mjs, which runs the real stager onapply-patch.mjs(and every other runner script) and requires every transitive load to resolve. The hand-listed assertion covered only direct../<dir>/<module>imports.Verification
collect-base-activity.test.mjshas a new test. It runs the real staging step for every script activity in a lane that uses the read or write runner, with the entry path taken from the runners' own invocation line. It then walks every load and requires all of them to resolve. TheUNSTAGED_DECLARE_TEST_SCOPE_IMPORTSpin is gone; the gap is empty.admit.mjsand requires.github/recurring-schedule.jsonto be the only top-level.github/file copied; it fails on the directory-per-load stager. Three more: stagingissue-spec.mjscopiesscripts/upstream-drift-vendored-report.shalone and stagingwrite-verdict.mjscopieslib/publish-gate.mjsalone (both fail on a stager that copies a module's directory); stagingpublish-feedback.mjsleavespr-unblock/fixtures/out; and a stagedresolve.mjsstill importsyamlandajvfrom the copiednode_modules.address-feedback.test.mjsdeclares.github/scripts/pr-unblock/*anddocs/upstream/*, andpublish-feedback.test.mjsdeclaresdocs/upstream/*: the readsscripts/selection-audit.sh trace --strictstill reported for the staged closure.report-escalation.sh(api-budget.bash,pr-merge/refire-refused.mjs,rate-guard.mjs,trusted-actors.jsonand others),declare-test-scope.mjs,apply-dependency-verdict.mjs,publish-feedback.mjs,resolve-threads.mjs,report-outcome.mjsandapply-patch.mjs.apply-patch,address-feedback,publish-feedbackandreport-outcomenow import each module from a realstage()output, not a hand-built layout.write-runner-never-rules.test.shchecks the new invocation path.collect-base-activity.test.mjs163,apply-patch.test.mjs446,address-feedback.test.mjs213,publish-feedback.test.mjs164,report-outcome.test.mjs437 andcallers.test.mjs306 pass;scripts/check-affected.sh --base origin/main: 20 passed, 4 skipped.Related
🤖 Generated with Claude Code