Skip to content

docs: correct the auto-selection note for the Cloudflare email provider - #2371

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
danielmlr:docs/cloudflare-email-autoselect
Aug 8, 2026
Merged

docs: correct the auto-selection note for the Cloudflare email provider#2371
ascorbic merged 1 commit into
emdash-cms:mainfrom
danielmlr:docs/cloudflare-email-autoselect

Conversation

@danielmlr

Copy link
Copy Markdown
Contributor

What does this PR do?

The Cloudflare deployment guide states about cloudflareEmail():

the provider is never auto-selected — you must choose it under Settings → Email.

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 — and createPlugin() in packages/cloudflare/src/plugins/cloudflare-email.ts registers a plain exclusive: true hook 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 from astro 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

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes — n/a, docs-only change
  • pnpm lint passes — n/a, docs-only change
  • pnpm test passes — n/a, docs-only change; the behavior described is covered by existing tests named above
  • pnpm format has been run
  • I have added/updated tests for my changes — n/a
  • User-visible strings in the admin UI are wrapped for translation — n/a
  • I have added a changeset — n/a, no published package changed
  • New features link to an approved Discussion — n/a

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Fable 5

Screenshots / test output

n/a

@changeset-bot

changeset-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4805ee3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • resolveExclusiveHooks in packages/core/src/plugins/hooks.ts auto-selects the sole active provider of an exclusive hook (email:deliver) both at runtime init and when the plugin pipeline is rebuilt.
  • createPlugin() in packages/cloudflare/src/plugins/cloudflare-email.ts registers email:deliver with exclusive: true and no opt-out, so it follows the generic exclusive-hook path.
  • packages/core/src/emdash-runtime.ts gates the dev console email provider with import.meta.env.DEV, so in production the Cloudflare provider is typically the only active one and gets selected automatically; in astro dev the 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") and packages/cloudflare/tests/plugins-cloudflare-email.test.ts (exclusive email:deliver hook).

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.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Aug 8, 2026

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ascorbic
ascorbic enabled auto-merge (squash) August 8, 2026 06:58
@pkg-pr-new

pkg-pr-new Bot commented Aug 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@2371

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@2371

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@2371

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@2371

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@2371

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@2371

emdash

npm i https://pkg.pr.new/emdash@2371

create-emdash

npm i https://pkg.pr.new/create-emdash@2371

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@2371

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@2371

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@2371

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@2371

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@2371

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2371

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@2371

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@2371

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@2371

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@2371

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@2371

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@2371

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@2371

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@2371

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@2371

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@2371

commit: 4805ee3

@ascorbic
ascorbic merged commit 8c5e8e7 into emdash-cms:main Aug 8, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants