docs: correct the auto-selection note for the Cloudflare email provider - #2371
Conversation
|
There was a problem hiding this comment.
This is a correct, docs-only correction.
The PR fixes an inaccurate statement in the Cloudflare deployment guide. I traced the runtime behavior to confirm the new wording matches the code:
resolveExclusiveHooksinpackages/core/src/plugins/hooks.tsauto-selects the sole active provider of an exclusive hook (email:deliver) both at runtime init and when the plugin pipeline is rebuilt.createPlugin()inpackages/cloudflare/src/plugins/cloudflare-email.tsregistersemail:deliverwithexclusive: trueand no opt-out, so it follows the generic exclusive-hook path.packages/core/src/emdash-runtime.tsgates the dev console email provider withimport.meta.env.DEV, so in production the Cloudflare provider is typically the only active one and gets selected automatically; inastro devthe console provider is always present as a second provider, so a manual choice is required.- Existing tests already assert this behavior:
packages/core/tests/unit/plugins/exclusive-hooks.test.ts("auto-selects single active provider") andpackages/cloudflare/tests/plugins-cloudflare-email.test.ts(exclusiveemail:deliverhook).
The change is confined to docs/src/content/docs/deployment/cloudflare.mdx, uses the same indentation/style as the surrounding file, and introduces no AGENTS.md or style-guide issues. The docs package is private, so a changeset is not required.
Nothing to fix — LGTM.
@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-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: |
What does this PR do?
The Cloudflare deployment guide states about
cloudflareEmail():That does not match the runtime.
resolveExclusiveHooks(packages/core/src/plugins/hooks.ts) auto-selects any exclusive-hook provider that is the sole active one — on plugin activation and on runtime init — andcreatePlugin()inpackages/cloudflare/src/plugins/cloudflare-email.tsregisters a plainexclusive: truehook with no opt-out, so it takes the generic route. The behavior is already asserted by the existing tests (tests/unit/plugins/exclusive-hooks.test.ts→ "auto-selects single active provider";packages/cloudflare/tests/plugins-cloudflare-email.test.ts→ "returns a resolved plugin with an exclusive email:deliver hook").On a stock Workers deployment this is the common case, not a corner: the built-in dev console provider is
import.meta.env.DEV-gated (emdash-runtime.ts), so in production a single configured mail plugin is the only provider and gets selected without any visit to Settings → Email — which matches what we observe on a production site. The "you must choose" experience comes fromastro dev, where the console stub is a second provider. As written, the note makes operators either conclude mail isn't wired up when it already is, or trust that an unselected provider cannot send when it can.This PR rewrites the note to describe the actual behavior, including the dev/prod difference. Docs only — the auto-selection itself is consistent with every other exclusive hook and worth keeping.
Type of change
Checklist
pnpm typecheckpasses — n/a, docs-only changepnpm lintpasses — n/a, docs-only changepnpm testpasses — n/a, docs-only change; the behavior described is covered by existing tests named abovepnpm formathas been runAI-generated code disclosure
Screenshots / test output
n/a