fix(example-showcase): route external-datasource fixture through the sqlite fallback#2890
Merged
Merged
Conversation
…sqlite fallback
`setupShowcaseExternalDatasource` (run from the showcase app's `onEnable`
at boot) built its MANAGED provisioning driver with a raw
`new SqlDriver({ client: 'better-sqlite3' })`. `better-sqlite3` loads its
native addon lazily at first query, so a `NODE_MODULE_VERSION` ABI mismatch
(e.g. after a Node upgrade) threw `ERR_DLOPEN_FAILED` here — which propagated
through `onEnable` -> `AppPlugin.start()` and bricked `plugin.app.com.example.showcase`,
failing `pnpm dev` entirely, even though the default datasource had already
stepped down to wasm SQLite.
Every other sqlite construction site was hoisted onto the shared
`resolveSqliteDriver` native -> wasm -> in-memory step-down (#2229); this
fixture site was missed. Route it through the same helper so a native ABI/load
failure degrades to wasm in dev (real SQL + on-disk persistence) instead of
crashing boot, and still fails closed in production. Adds
`@objectstack/service-datasource` (which exports `resolveSqliteDriver`) as a
dependency of the example.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UUWGgTT5s7XgBb2eLtzhfU
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
os-zhuang
marked this pull request as ready for review
July 14, 2026 03:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
pnpm devin the showcase crashes at boot with the app plugin rolled back:…even though the default datasource had already logged the graceful step-down
(
native better-sqlite3 unavailable … dev using wasm SQLite).Root cause
setupShowcaseExternalDatasource(invoked from the showcase app'sonEnableat boot, inexamples/app-showcase/src/system/datasources/external-fixture.ts) built its MANAGEDprovisioning driver with a raw
new SqlDriver({ client: 'better-sqlite3' }).better-sqlite3loads its native addon lazily at first query, so aNODE_MODULE_VERSIONABI mismatch (e.g. after a Node upgrade) surfaces as
ERR_DLOPEN_FAILEDright here. The errorpropagates through
onEnable→AppPlugin.start()and bricksplugin.app.com.example.showcase.Issue #2229 hoisted every SQLite construction site onto the shared
resolveSqliteDrivernative → wasm → in-memory step-down. This fixture site was the one that got missed — so the
platform's own fallback machinery couldn't save it.
Fix
Route the fixture through the same
resolveSqliteDriverhelper (@objectstack/service-datasource):instead of throwing, so
onEnable/ app-plugin boot survives — consistent with the defaultdatasource and the declared
showcase_externaldatasource, which already use this helper.Adds
@objectstack/service-datasource(which exportsresolveSqliteDriver) to the example'sdependencies.
Verification
tsc --noEmiton@objectstack/example-showcase: 0 errors (after building the workspace deps).objectstack compileon the showcase config: succeeds (import chain resolves at bundle time).objectstack serve --dev: app plugin starts, the fixture provisionsshowcase_external.db, server listens — 0Plugin startup failed/ERR_DLOPEN/NODE_MODULE_VERSIONoccurrences (native happy path unbroken).@objectstack/service-datasourcetest suite: 93/93 pass, including the sqlite-driverfallback tests that back this step-down.
🤖 Generated with Claude Code
Generated by Claude Code