Skip to content

test(infra): reuse the shared npm call presence guard - #137254

Merged
steipete merged 1 commit into
mainfrom
codex/test-npm-managed-root-call-guard
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-npm-managed-root-call-guard

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The managed npm-root tests use a local generic helper solely to unwrap the first recorded command call, duplicating existing assertion support.

Why This Change Was Made

Use the shared expectDefined helper through its narrow entrypoint at both assertion sites. Preserve first-call tuple checks, the existing repair call count, and all command arguments and options. Keep requireCommandOptions, which distinguishes the runner's numeric options variant.

User Impact

No runtime behavior changes. All existing fallback, manifest and lockfile, plugin preservation, host and symlink, executable-shim, path-safety, and fixture-cleanup assertions remain. Production: 0 lines changed; tests: +9/-13 (net -4). No test cases were added or removed.

Evidence

  • The same complete managed npm-root, safe-package-install, and canonical assertion-helper suites passed all 39 cases before and after, with identical case inventories and suite order.
  • env -u OPENCLAW_TESTBOX node scripts/check-changed.mjs -- src/infra/npm-managed-root.test.ts: all 20 selected canonical local stages passed, including infra test types, unused-export scans, and type-aware lint.
  • Formatting and independent Codex review passed with no actionable P0-P2 findings. Node 26.8.1 was pinned. This is test-only proof; no live npm operation was needed.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review September 3, 2026 10:54
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 7:08 AM ET / 11:08 UTC.

ClawSweeper review

What this changes

The PR replaces a local helper that unwraps the first mocked npm command call with the shared expectDefined assertion helper in two managed npm-root tests.

Merge readiness

✅ Ready for maintainer review

No blocking finding: the introduced test-only cleanup replaces a duplicate presence guard with the established shared helper while preserving the command-option check. This PR remains open because it is maintainer-labeled, not because a repair is needed.

Priority: P3
Reviewed head: d21cf043828039dc2253279768a82d86e470caac

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving test cleanup using an existing exported helper, with no blocking fault found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only cleanup changes no production behavior; source review and the focused test contract are the relevant evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-only cleanup changes no production behavior; source review and the focused test contract are the relevant evidence.
Evidence reviewed 6 items Shared helper contract: expectDefined returns its defined input and throws only for null or undefined, matching the removed helper’s presence invariant for a recorded mock-call tuple.
Supported narrow import: The normalization-core package explicitly exports the ./expect subpath used by the PR.
Owner and caller coverage: The peer-plan test still invokes the managed-root sync owner, asserts a recorded first call, then validates the command tuple and options.
Findings None None.
Security None None.

How this fits together

Managed npm-root tests validate the infrastructure flow that plans peer dependencies and repairs stale OpenClaw npm installs. They inspect recorded command invocations before asserting the command arguments and execution options.

flowchart LR
  A[Managed npm-root test] --> B[Mock command runner]
  B --> C[Recorded command calls]
  C --> D[Shared presence assertion]
  D --> E[Tuple and options checks]
  E --> F[Npm root repair coverage]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -4. Total -4 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 9 13 -4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 9 13 -4

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +9/-13 (net -4) The change removes duplicate test-only assertion code without changing npm-root runtime behavior.

Technical review

Best possible solution:

Keep the narrow replacement: use the shared nullish-presence assertion and retain the local command-options validator for its distinct numeric-option contract.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR changes test assertion plumbing rather than a reported runtime defect.

Is this the best way to solve the issue?

Yes. The shared helper has the required nullish-presence behavior and a package-supported narrow import, while the specialized options validator remains in place.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c4fd629a6da9.

Labels

Label changes:

  • add P3: This is a small, behavior-neutral test maintenance cleanup.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only cleanup changes no production behavior; source review and the focused test contract are the relevant evidence.

Label justifications:

  • P3: This is a small, behavior-neutral test maintenance cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only cleanup changes no production behavior; source review and the focused test contract are the relevant evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • wangyan2026: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete steipete self-assigned this Sep 3, 2026
@steipete
steipete merged commit 50ec6a7 into main Sep 3, 2026
165 of 174 checks passed
@steipete
steipete deleted the codex/test-npm-managed-root-call-guard branch September 3, 2026 11:36
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 3, 2026
* commit '13b1f71c7010baaf2394555198e2fc04bef03586': (283 commits)
  fix(ui): retire stale MCP feedback across context changes (#128490)
  fix(agents): clarify set-identity workspace output (#126320)
  fix(auth): preserve OAuth metadata during session SDK refresh (#127988)
  fix(agents): recover catalog worker after generation mismatch (#127712)
  fix(memory-wiki): reject out-of-range claim confidence (#125656)
  ci: remove redundant contract runs and costly test work (#137220)
  fix(release): assert the Codex CLI pin the candidate declares (#137136)
  test(voice-call): reuse shared guards and deferred gates (#137262)
  fix(cron): isolate scheduler-disabled shared-store writes (#131733)
  fix(telegram): surface allowed custom reactions in react guidance (#129817)
  test(infra): reuse the shared npm call presence guard (#137254)
  fix: generated images disappear after failed tool calls (#131226)
  fix(docs): match source anchor checks to published sections (#137157)
  fix(backup): preserve audit capture across slow snapshots (#130962)
  fix(release): preserve legacy gh log reads (#137016)
  fix(memory-core): make forget rewrites atomic (#131383)
  fix(agents): write settings atomically (#131431)
  fix(plugins): keep the memory indexing runtime with the selected slot owner (#131779)
  fix(ci): pin iOS screenshot evidence to workflow revision (#136334)
  test(logging): remove redundant stderr spy casts (#137238)
  ...

# Conflicts:
#	scripts/e2e/lib/codex-release-package-assertions.mjs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant