fix: isolate plugin test helpers from sdk exports#87120
Conversation
Dependency Changes DetectedThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Codex review: needs maintainer review before merge. Reviewed May 27, 2026, 2:02 AM ET / 06:02 UTC. Summary PR surface: Source +2, Tests +10, Docs +5, Config -22, Other -1. Total -6 across 11 files. Reproducibility: yes. Source inspection shows current main exports repo-only Plugin SDK helper subpaths while those helper surfaces reach Vitest-backed test utilities; the PR body also reports the clean-package import crash that this fixes. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the package-boundary cleanup only after maintainers explicitly accept the helper-export removal tradeoff; if real consumers exist, add a named deprecation or compatibility plan instead. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main exports repo-only Plugin SDK helper subpaths while those helper surfaces reach Vitest-backed test utilities; the PR body also reports the clean-package import crash that this fixes. Is this the best way to solve the issue? Yes, if maintainers accept the compatibility break. The patch uses the existing privateLocalOnly/public entrypoint split instead of adding another shim, but the exported-subpath removal is a maintainer compatibility decision. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 798691779bee. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +10, Docs +5, Config -22, Other -1. Total -6 across 11 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Velvet Signal Puff Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
If you're here because your custom scripting that imports type file broke, sorry, I thought the tradeoff was worth it.
AI Stuff:
Package audit repro this fixes
This PR fixes the package-boundary failure found while validating
openclaw@beta: a clean installed package exposed Vitest-backed Plugin SDK test-helper subpaths as publicopenclaw/plugin-sdk/*exports.The audit found that clean consumers could import test-helper subpaths such as
openclaw/plugin-sdk/plugin-test-contractsandopenclaw/plugin-sdk/provider-test-contracts, and those imports then crashed withERR_MODULE_NOT_FOUND: Cannot find package 'vitest'. The package exported repo-only test helpers even thoughvitestis a dev-only dependency.Breaking change
The following accidental public package exports are removed from
openclaw:openclaw/plugin-sdk/agent-runtime-test-contracts,openclaw/plugin-sdk/channel-contract-testing,openclaw/plugin-sdk/channel-target-testing,openclaw/plugin-sdk/channel-test-helpers,openclaw/plugin-sdk/plugin-test-api,openclaw/plugin-sdk/plugin-test-contracts,openclaw/plugin-sdk/plugin-test-runtime,openclaw/plugin-sdk/provider-http-test-mocks,openclaw/plugin-sdk/provider-test-contracts,openclaw/plugin-sdk/test-env,openclaw/plugin-sdk/test-fixtures,openclaw/plugin-sdk/test-node-mocks, andopenclaw/plugin-sdk/testing.This is a breaking package-boundary cleanup, but the removed surface is the Vitest-backed helper layer that should not have been a published runtime contract. Clean package consumers now get package subpath-not-exported for those helpers instead of a later missing-
vitestcrash. The public Plugin SDK package exports stay focused on plugin runtime/API entrypoints.Bundle / download size
Measured against clean
origin/mainat05ff771010afterpnpm buildandnpm pack --dry-run --ignore-scripts --json.dist/plugin-sdkbytesdist/plugin-sdkfilesSummary
openclawpackage.Re-export compatibility note
There is no new re-export compatibility layer in this version. The earlier shim/package approach kept the old subpaths importable, but it added a lot of code to preserve an accidental test-helper export surface. This version treats the helper subpaths as non-contract repo internals and removes them from the package boundary.
Verification
pnpm docs:listnode scripts/run-vitest.mjs test/release-check.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts src/plugins/contracts/plugin-sdk-subpaths.test.ts src/plugins/contracts/plugin-sdk-index.test.tsnode scripts/run-vitest.mjs src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.tspnpm buildnpm pack --dry-run --ignore-scripts --jsonbefore/after measurement againstorigin/mainimported 303 plugin SDK package exports; leaked test-helper exports=0git diff --check./scripts/release-check.tsReal behavior proof
Behavior addressed: public Plugin SDK test-helper package exports could require dev-only
vitestfrom a clean installedopenclaw@betapackage.Real environment tested: local source checkout after patch with built package artifacts from
pnpm buildand npm dry-run package contents.Exact steps or command run after this patch: focused Vitest contract tests,
pnpm build, npm dry-run pack size measurement, import smoke for everyopenclaw/plugin-sdk*package export, and full./scripts/release-check.ts.Evidence after fix: focused tests passed; build passed; release-check passed; package export smoke imported 303 Plugin SDK exports and found 0 leaked test-helper exports.
Observed result after fix: clean package consumers no longer see the Vitest-backed helper subpaths as public package exports, and OpenClaw repo tests still resolve the helpers as local-only test surfaces.
What was not tested: the full external validation run was not rerun in this session; the local package-boundary proof covers the reported missing-
vitestfailure mode directly.