Skip to content

fix(core): avoid optional dialect export warnings#2082

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
logelog:fix/sqlite-coalescing-warning
Jul 17, 2026
Merged

fix(core): avoid optional dialect export warnings#2082
ascorbic merged 1 commit into
emdash-cms:mainfrom
logelog:fix/sqlite-coalescing-warning

Conversation

@logelog

@logelog logelog commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes cold-start query coalescing an explicit database-adapter capability.

The cold-start batching change in #1617 reads createCoalescingDialect through a namespace import. Bundlers can still statically inspect that property access and warn when the configured SQLite, libSQL, PostgreSQL, or third-party adapter does not export it.

This change adds an optional supportsCoalescing descriptor flag, enables it for the Cloudflare D1 and Durable Objects adapters that provide the export, and emits undefined for every other adapter without probing a missing export. The runtime fallback behavior is unchanged.

Type of change

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

Checklist

  • I have read CONTRIBUTING.md
  • Affected-package typechecks pass
  • pnpm lint passes (changed files pass; the full run currently reports an unrelated existing diagnostic in packages/registry-verification/src/records.ts:276)
  • Targeted tests pass
  • Formatting checks pass
  • Tests cover both capability-enabled and fallback module generation
  • No user-visible strings were added
  • A changeset is included
  • New features link to an approved Discussion: N/A, this is a bug fix

Test output

  • Core virtual-module tests: 15 passed
  • Cloudflare descriptor tests: 4 passed
  • emdash typecheck: passed
  • @emdash-cms/cloudflare typecheck: passed
  • Both affected package builds: passed
  • Publint for both affected packages: passed
  • Type-aware oxlint on changed files: passed
  • Oxfmt and Prettier checks on changed files: passed

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b470f6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@logelog
logelog marked this pull request as ready for review July 16, 2026 22:13
@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jul 16, 2026

@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 the right fix for the right problem. Moving from a namespace import that probes a possibly-missing export to an explicit supportsCoalescing capability flag matches EmDash’s existing supportsRequestScope pattern, keeps the virtual-module generation deterministic, and avoids bundler warnings for adapters that never implemented cold-start coalescing. The change is additive on DatabaseDescriptor, defaults to false, and only D1 and Durable Objects opt in — exactly the two adapters that export createCoalescingDialect.

What I checked:

  • Traced generateDialectModule callers: only vite-config.ts and unit tests invoke it; all have been updated to pass supportsCoalescing.
  • Verified the generated output for both flag states and both request-scope settings: no syntax/ordering issues, the old _dialectModule.createCoalescingDialect namespace access is gone.
  • Confirmed D1 (packages/cloudflare/src/db/d1.ts) and DO SQL (packages/cloudflare/src/db/do-sql.ts) export createCoalescingDialect; other adapters (SQLite, libSQL, Postgres, Hyperdrive, preview/playground DO) do not, and none are flagged.
  • Confirmed the runtime already treats createCoalescingDialect as optional and just falls back to the singleton when it is undefined.
  • Checked that DatabaseDescriptor flows through EmDashConfig and the serialized virtual config without any transform stripping the new field.
  • The changeset correctly lists both affected packages as patch bumps and describes the user-visible effect.

No AGENTS.md convention violations surfaced, and the targeted test coverage (enabled and fallback module generation, plus Cloudflare descriptor tests) looks adequate. This PR is clean.

@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@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 Jul 17, 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!

@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/registry-verification

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

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: b470f6e

@ascorbic
ascorbic merged commit cf6e4fa into emdash-cms:main Jul 17, 2026
49 checks passed
@emdashbot emdashbot Bot mentioned this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants