refactor(scripts): migrate the OpenClaw diagnostics patch tool to .mts (#6931) - #6942
Conversation
NVIDIA#6931) Signed-off-by: Atulya Singh <atulyarajsingh@gmail.com>
📝 WalkthroughWalkthroughThe Issue ChangesOpenClaw diagnostics patch migration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. Since last review: 0 prior items resolved · 0 still apply · 0 new items found E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
|
✨ Thanks for the migration. The ESM module boundary update follows the established precedent and keeps the patch behavior intact. Ready for maintainer review. Related open issues: |
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed the diagnostics tool migration and its merge resolution against current main. References consistently use the .mts entrypoint, the combined dependency-review coverage is preserved, and focused tests plus CLI build pass.
|
@cv Normal CI is green for fork head |
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
cv
left a comment
There was a problem hiding this comment.
Maintainer gate complete for exact head f1e829c: mechanical migration conflicts resolved, calibration provenance corrected, focused tests and hooks green, DCO/GitHub verification valid, automated review clear, and the trusted fork workflow recorded the audited credentialed-E2E skip without exposing secrets (coordination check 87574815173; observer 87574748983).
cv
left a comment
There was a problem hiding this comment.
Reconfirming exact-head approval after the ready-for-review retrigger: all 46 current checks are green, including the fresh required E2E observer and both fresh advisor lanes; no unresolved review threads remain.
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Migrates
scripts/patch-openclaw-issue-4434-diagnostics.tsto.mts, following thescripts/patch-openclaw-mcp-npx.mtsprecedent. Module-boundary migration only — no change to the patch shape, selectors, markers, or output.Related Issue
Fixes #6931
Parent: #6918
Changes
scripts/patch-openclaw-issue-4434-diagnostics.ts→.mts(git detects the rename at 97% similarity). The file was already TypeScript, so the port is small:require("node:fs")/require("node:path")→ ESM imports. These were the only CommonJS globals; there is nomodule.exportsand norequire.mainguard (the script runs its mode dispatch at top level, which is unchanged).#!/usr/bin/env node→#!/usr/bin/env -S node --experimental-strip-types. The old shebang could not execute a TypeScript file standalone; it now can..mts, since it names the file it prints for.Dockerfile:COPYandchmodpaths. TheRUNinvocation is unchanged — line 762 already passed--experimental-strip-types, because the tool was already.ts.src/lib/sandbox/build-context.ts: staged build-context copy path.openclaw-issue-4434-diagnostics-patch.test.ts,openclaw-dependency-review.test.ts,issue-4434-error-fields.test.ts,openclaw-integrity-pin-suite.ts,openclaw-real-patched-dist-harness.test.ts,sandbox-build-context.test.ts.docs/security/openclaw-2026.6.10-dependency-review.md: the reviewed-patch references, per the epic's rule to update every documentation reference affected by a rename.No live reference to the old
.tspath remains.Note on the coupled guards
Two reference sites are load-bearing rather than cosmetic, and are worth a reviewer's eye:
test/openclaw-dependency-review.test.tsgreps the Dockerfile for exact literal strings (grep -Fq 'COPY scripts/patch-openclaw-issue-4434-diagnostics.ts ...'). A rename that missed these would leave the guard asserting against a path that no longer exists.docs/security/openclaw-2026.6.10-dependency-review.mdis the reviewed-dependency record for OpenClaw 2026.6.10, andissue-4434-error-fields.test.ts/openclaw-integrity-pin-suite.tsassert the doc names this script. The doc's security content is unchanged; only the path is updated.Preserved contracts
Shebang, executable mode (
755, carried throughgit mv), SPDX header,--auditflag, patch/legacy markers, and all three exit codes are unchanged. Verified by direct execution:The fail-closed behavior the security review depends on is intact: unknown shapes still exit non-zero rather than silently passing.
Testing
npx vitest run test/openclaw-issue-4434-diagnostics-patch.test.ts test/openclaw-dependency-review.test.ts test/issue-4434-error-fields.test.ts test/sandbox-build-context.test.ts→ 21 passednpm run typecheck:cli→ clean2, apply failure1, audit failure3) and via the shebang standalone.Docs
docs/security/openclaw-2026.6.10-dependency-review.mdupdated for the rename (path references only; no security content changed). No other documentation references this tool.Note for reviewers
The Docker image build is the one contract not exercised locally. The
RUNline is unchanged by this PR and already used--experimental-strip-types, so the risk is limited to theCOPY/chmodpaths — worth a CI image build to confirm.Checklist
Signed-off-by: Atulya Singh atulyarajsingh@gmail.com
Summary by CodeRabbit
Bug Fixes
#4434diagnostics compatibility patch to the correct.mtsmodule format and ensure it’s copied, permissioned, and executed properly during Docker build/staging..mtsdiagnostics patch.Documentation
.mtsdiagnostics patch script.Tests
.mtsfilename/usage..mtspatch script inputs.