Repository navigation
test: replace better-sqlite3 with node:sqlite - #3510
Conversation
|
Scope checkThis PR changes 664 lines across 93 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://codex-node-sqlite-tests.try.emdashcms.com, https://codex-node-sqlite-tests-emdash-playground.emdash-cms.workers.dev (commit 8f61911)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
There was a problem hiding this comment.
This is the right change for the stated goal. EmDash's runtime already moved to node:sqlite; finishing the same migration in the test suites removes a native compilation dependency from developer installs and container builds, and keeps test behavior aligned with production.
I checked:
- Unified diff and full authored files for
packages/core/src/db/node-sqlite-compat.ts, affected tests,packages/core/package.json,packages/workerd/package.json,pnpm-workspace.yaml,pnpm-lock.yaml, andDockerfile. - Searched the tree for remaining
better-sqlite3imports/usages (only historical CHANGELOG entries and bot eval fixtures remain). - Verified the
node-sqlite-compatadapter supports both the array-binding contract Kysely uses and the direct variadic/exec/get/close usage that tests previously routed throughbetter-sqlite3. - Confirmed transaction replacements in
content-order-plan.test.tsanddirect-executor.test.tsare equivalent BEGIN/COMMIT/ROLLBACK wrappers. - Confirmed the
node:sqliteimport is available on the declarednode >=22.16engine.
The adapter change is shared with the production emdash/db/sqlite runtime path, but the behavior is additive and backward-compatible: the same prepare/exec/close surface Kysely needs remains, close becomes idempotent, and parameter normalization still flattens the single-array case. No AGENTS.md conventions are violated (no UI/i18n changes, no new logged-out queries, no security-sensitive SQL interpolation, no questionable comments), and a changeset is not required for this test-only/dependency-cleanup PR.
@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-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@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. |
emdash-cms#3409 pinned the pivot join for temp sorts and freed it for every indexed sort. This branch frees it only for a single large term under an indexed sort with a LIMIT, which already keeps temp sorts pinned, so its join condition stays. The comment keeps emdash-cms#3409's reason for the temp-sort pin and drops the claim that D1 keeps no planner statistics, which emdash-cms#3409's production statistics contradict. emdash-cms#3409's join test moves into the large-term block, the only shape whose indexed sort still frees the join. emdash-cms#3510 replaced better-sqlite3, so the plan test uses the node:sqlite helper.
What does this PR do?
Replaces
better-sqlite3in the core and workerd test suites with the existingnode:sqlitecompatibility adapter.The adapter now supports the direct test usage that previously depended on
better-sqlite3: construction,exec,get, variadic statement bindings, connection state, and idempotent close. The native dependency, its type package, build permission, bundler external, lockfile entries, and Docker compiler toolchain are removed.This keeps tests on the same built-in SQLite driver used by the Node runtime and removes the native compilation/download requirement from installs and container builds.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.The i18n, changeset, Discussion, and screenshot items are not applicable: this only changes test infrastructure and development dependencies, with no admin UI or published user-facing behavior.
AI-generated code disclosure
Screenshots / test output
Not applicable (no UI changes).
Validated with:
pnpm formatpnpm buildpnpm typecheckpnpm lint:quickpnpm --silent lint:json | jq '.diagnostics | length'(0 diagnostics)