Repository navigation
fix(scripts): restore missing helpers in materialized PR anchors - #134366
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 2:57 PM ET / 18:57 UTC. ClawSweeper reviewWhat this changesThe PR expands the trusted Merge readinessThis PR remains necessary: current main still materializes an anchor without the helper closure needed by its own review and gate paths. The follow-up physical-path fix and closure tests address the observed failure without a discrete introduced defect; the maintainer label and trust-boundary change require explicit maintainer handling after exact-head CI completes. Priority: P2 Review scores
Verification
How this fits togetherThe native flowchart LR
A[Linked PR worktree] --> B[Native PR launcher]
B --> C{Wrapper differs from trusted main}
C -->|yes| D[Verified anchor extraction]
C -->|no| E[Local wrapper execution]
D --> F[Anchored helper closure]
F --> G[Review and gate operations]
E --> G
Decision needed
Why: The repair restores a maintainer workflow by adding helper sources and package links inside a code-execution trust boundary, and the PR carries the protected maintainer label. Before merge
Agent review detailsSecurityNone. PR surfaceTests +143, Other +81. Total +224 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one explicit, blob-verified source inventory and its inventory-derived fixtures, then accept the bounded four-package linkage only after exact-head checks and maintainer trust-boundary review pass. Do we have a high-confidence way to reproduce the issue? Yes, by source: current main materializes a list that omits a helper imported by the anchored review-artifact path, and the PR supplies a disposable-worktree regression scenario for that route. This read-only review did not execute the scenario. Is this the best way to solve the issue? Yes. Extending the existing blob-verified inventory at the extraction owner is preferable to bypassing trust checks, copying broad directories, or adding a second resolver. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2d5f0f348a88. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Native verification exposed a nearby execution bug: a helper invoked through a symlinked temporary/checkout path could exit 0 with empty output because Node canonicalized the module URL while the wrapper passed a logical path. This PR now resolves the wrapper path physically with The new regression failed before the change with exit 0 and empty output, then passed with a correctly PR/head-bound template. The full wrapper/lock suites pass 137 tests (one Linux-only case skipped on macOS); changed checks and a fresh full-candidate Codex autoreview passed. The original head's hosted CI and native preparation were green; this behavior-changing follow-up will get its own exact-head CI and refreshed native artifacts before merge. The latest review had no discrete repair finding or rank-up beyond normal CI and maintainer review. Requesting a refresh because this follow-up changes behavior beyond the reviewed diff: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision: accept the bounded anchor-closure expansion and physical-path repair at Exact-head proof is green: CI 33427336100, attempt 1 and Workflow Sanity 33427336082. Native review artifacts were refreshed and validated after the final push. The real extracted-anchor tests failed against the incomplete inventory, then passed with the closure repair. Native verification additionally exposed the symlink-path exit-0/empty-artifact failure; its extracted-wrapper regression failed before Key final local commands (the PR body records the complete owner/sibling command list): node scripts/run-vitest.mjs test/scripts/pr-wrappers.test.ts -t 'symlinked temporary root'node scripts/run-vitest.mjs test/scripts/pr-wrappers.test.ts test/scripts/pr-operation-lock.test.tsnode scripts/check-changed.mjs -- scripts/pr test/scripts/pr-wrappers.test.tsbash -n scripts/prProduction is +84/-3 (net +81), primarily the 72 explicit closure declarations; tests/support are +315/-172 (net +143) after removing parallel fixture inventories. No full local product build/suite is claimed. Final native merge admission must still resolve GitHub's mergeability projection and revalidate the pinned head before dispatch. Old invoking launcher bytes retain their old inventory; adoption requires using the updated launcher. |
|
Merged via squash.
|
…nclaw#134366) * fix(scripts): restore missing helpers in materialized PR anchors * fix(scripts): resolve PR wrapper paths physically
Related: #133913 (trusted PR-wrapper anchor materialization).
What Problem This Solves
Resolves a problem where maintainers running the native PR review or landing workflow from a stale or wrapper-changing worktree hit missing-module errors after the trusted
origin/mainwrapper was materialized. Review artifact initialization/validation could fail withERR_MODULE_NOT_FOUNDforscripts/lib/record-shared.mjs, leaving the normal operation lock retained for explicit recovery.This is a separate tooling repair, not a change to the TLS work where the first failure was observed.
Why This Change Was Made
Complete the existing
pr_wrapper_componentssource inventory rather than patching extracted copies or bypassing wrapper trust. The trace covers review artifacts, shell-resolved attribution tooling, TypeScript CLI shims, hosted gates, CI dispatch, and the publisher's canonical test-planner import closure. The same inventory continues to own dirty-file checks, revision comparisons, extraction, and per-blob verification.The private extracted tree exposes only the four existing third-party tooling packages it requires (
tsx,zod,minimatch, andyaml), not a wholenode_moduleslink that could resolve unanchored workspace source. Hosted-gate normalization now imports the archived canonical implementation. Candidate build/test commands and candidate workflow inputs retain their existing ownership. There are no new packages, configuration options, runtime dependency resolvers, or fallback paths.Native verification also exposed a nearby false-success path: a symlinked temporary/check-out path left helper arguments logical while Node canonicalized the module URL, so a direct-run guard could skip the helper and produce an empty artifact with exit 0. Resolve the wrapper's own path physically with
pwd -P, preserving that canonical path through child execution. A real extracted-wrapper regression covers this path.Wrapper, lock, and main-refresh fixtures now consume one inventory-driven source copier instead of maintaining incomplete parallel lists. Production LOC: +84/-3, net +81, principally 72 explicit source-closure entries plus physical wrapper-path normalization. Tests/support: +315/-172, net +143, including the shared fixture helper. Broad directory copies and a new runtime resolver would enlarge the trust surface or introduce another mechanism; restructuring the general test planner is not necessary for this repair.
User Impact
No bot/runtime product behavior changes. Maintainers using the repaired launcher can execute the real review and gate helpers from a materialized anchor while retaining blob verification, restrictive 0700 temporary-root permissions, protected GitHub routing, and existing lock supervision.
Adoption boundary: an old invoking launcher still contains its old extraction inventory. Use an updated launcher when adopting this fix; advancing the fetched ref does not rewrite already-running or stale launcher bytes. The relevant helper flows still require the existing installed third-party toolchain.
Evidence
Before the production repair, archiving the exact declared components into a fresh directory and dynamically importing the real review-artifact helper reproduced the missing
record-shared.mjserror. The new extracted-anchor execution tests also failed against the original production code, exposing missing loader, attribution, and planner dependencies rather than being satisfied by marker stubs.After repair, the real extracted review helper generates a correctly bound template and validates synthetic authored artifacts. Real CI/hosted-gate shims reach their argument guards, attribution tooling runs, the publisher emits its command, and the trusted planner discovers a non-sibling importing test from a synthetic candidate change. A tampered extracted dependency is refused before execution; the extracted root is asserted to be 0700. All execution proof uses disposable repositories, isolated HOME/Git/GitHub configuration, and fixture-owned or deny-all GitHub executables—no real GitHub writes or operator-state access.
Focused local proof (macOS; Node 24.20.0 and Node 26.8.1):
git diff --check: passed.Commands:
node scripts/run-vitest.mjs test/scripts/pr-wrappers.test.ts -t 'extracted anchor'No full local product build/suite or authenticated end-to-end landing was used as proof of the candidate. Exact-head hosted CI and native landing verification remain required. Live open issue/PR searches for quoted
record-shared.mjsplusanchor, and an additional anchor-closure PR search, found no matching open work before publication on 2026-08-31.