Repository navigation
feat(plugins): say why the sandbox runner is unavailable - #3041
Conversation
isAvailable() answers only true or false, so a missing worker_loaders binding, a missing PluginBridge export and a workerd binary that does not run all produced the same startup warning and the same SANDBOX_NOT_AVAILABLE refusal on install and update. SandboxRunner gains an optional unavailableReason(). The Cloudflare and workerd runners report their cause, and the startup warning and the four refusals append it; runners without the method keep the previous text.
🦋 Changeset detectedLatest commit: bcb9351 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR template validation failedPlease fix the following issues by editing your PR description:
See CONTRIBUTING.md for the full contribution policy. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
There was a problem hiding this comment.
This is a well-scoped, backwards-compatible improvement. Adding an optional unavailableReason() to SandboxRunner and wiring it into the startup warning and the four SANDBOX_NOT_AVAILABLE refusal paths is the right-shaped fix for the issue described in #1680/#1686: today the same opaque message hides several distinct misconfigurations.
I read the full diff, the changed source files, the test files, the changeset, and the docs update. I also checked the existing MiniflareDevRunner and the three SandboxRunner implementations to confirm the optional method does not break third-party runners or the dev runner.
What I checked:
- Approach: the change is additive (optional interface method), keeps existing plain messages for runners that don't implement it, and is consistent across Cloudflare (
worker_loadersbinding /PluginBridgeexport) and Node.js (workerdbinary check). - API surface:
withUnavailableReasoncorrectly handles anullrunner and a runner withoutunavailableReason; callers use the exact sameSandboxRunner | nulltype they already had. - Behavior:
EmDashRuntimelogs the reason when present and falls back to the prior workerd-specific guidance when absent; handlers append the reason for marketplace install/update and registry install/update. - Tests: new tests pin the Cloudflare runner outputs, the workerd binary failure reason, all four refusal messages, and the startup warning. They exercise observable error messages, not implementation details.
- Docs: the plugin-sandbox troubleshooting section maps each new reason to its fix and matches the implementation.
- Changeset: follows
.changeset/README.md— present tense, names the affected error/warning, proportional detail, no unnecessary headings.
I didn't find any logic bugs, regressions, AGENTS.md convention violations, or missing test coverage. The PR is ready to merge as-is.
What does this PR do?
Names the cause when a configured sandbox runner cannot run plugins.
isAvailable()answers only true or false, so a missingworker_loadersbinding, a missingPluginBridgeexport and aworkerdbinary that does not run all produce the same startup warning and the sameSANDBOX_NOT_AVAILABLErefusal.SandboxRunnergets the optionalunavailableReason()the workerd runner already had. The Cloudflare and workerd runners report their cause, and the warning and the four install and update refusals append it after a colon. Runners without the method keep today's text: the noop runner, whose "Sandbox runner is required" already names what is missing, and the Miniflare dev runner, which the factory returns only once Miniflare resolves. The sandbox guide maps each reason to its fix.Part of #1686 and #1680.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change) (theemdash,@emdash-cms/cloudflareand@emdash-cms/sandbox-workerdsuites)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain. (n/a: server-side error and log text, no admin UI strings)AI-generated code disclosure
Screenshots / test output
Not applicable for screenshots. These new tests failed before the change:
With the change:
pnpm typecheck,pnpm lint,pnpm formatand the docs build are clean.pnpm test:e2ewas not run.