fix(service-datasource): the mongodb and sqlite-wasm arms tell you how to install the optional driver they are missing (#7385) - #7418
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 1 changed package(s). ✅ |
os-help
marked this pull request as ready for review
August 10, 2026 10:51
This was referenced Aug 10, 2026
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.
Fixes #7385
All three of
sqlite-wasm,mongodbandtursoare built from OPTIONAL packages in the same factory, so all three have to answer "the package is not here". After #7314 / PR #7384 fixed the libSQL arm, the other two still answered with the fault and nothing else:No install command, no statement of what happens next, and not even the name of the datasource that failed — while the
tursoarm one screen below stated all three. One class of problem, two qualities of answer, decided by nothing but which driver the admin picked in Setup.What landed
A shared
missingDriverPackageMessage(driver, args)builder over a smallOptionalDriverPackagedescriptor, plus per-driver wrappers and the same constant seam #7384 introduced for libSQL:SQLITE_WASM_DRIVER_PACKAGE/SQLITE_WASM_DRIVER_INSTALL_COMMAND/missingSqliteWasmDriverMessageMONGODB_DRIVER_PACKAGE/MONGODB_DRIVER_INSTALL_COMMAND/missingMongodbDriverMessageall re-exported from the package index, so a host that renders its own remedy reads one declaration instead of re-typing a command.
#7384's two discipline points are kept verbatim, because each was a fix for a measured failure rather than a style choice. The message names the datasource (several may be declared and only one of them is this engine). It names exactly one fix and no escape hatch — no
OS_ALLOW_DRIVER_CONNECT_FAILURE(it would only hide a package that does not exist) and noOS_DATABASE_URL/--database(they select the HOST'sdefaultdatasource and can do nothing for the one that failed), which is theconnect-failure-remedy.tsfailure of #5794. And the import error is interpolated at the end and in full, which is what keepsisUnbuiltWorkspaceFailureable to recognise a half-built checkout from these arms at all — the re-throw drops the originalcode, so only that text survives.The consequence sentence is per-engine, not copied
#7384 wrote its consequence around a REMOTE database being shadowed by a local one. That is true for mongo and false for
sqlite-wasm, which opens a local file and has no remote to shadow — so copying the prose would have produced a remedy that reads well and lies.A test asserts the sqlite-wasm text does not contain
wrong database/stays untouched, so the libSQL prose cannot be copied back onto it later.Optionality, measured (the card asked)
Neither package is a runtime dependency of
@objectstack/service-datasource— both aredevDependenciesonly, which is how the construction suites build real drivers. So from this package's own manifest both arms' missing-package path is reachable, and the messages' "It is an OPTIONAL package" is true.Reachability differs per package once a host is in the picture, and the doc comments say so rather than overclaiming:
@objectstack/runtime@objectstack/cli@objectstack/driver-turso@objectstack/driver-mongodboptionalDependenciesdependencies--omit=optional, or a direct install of this service@objectstack/driver-sqlite-wasmdependenciesdependenciesFor a CLI or runtime host,
sqlite-wasm's common real cause is therefore an unbuilt workspace, not an uninstalled package — which is exactly why the verbatim import error matters:isUnbuiltWorkspaceFailurereads it downstream and re-routes the remedy topnpm install && pnpm buildinstead of telling a contributor to install what they already have. A test pins that classification for both arms.Tests
20 new cases: #7384's 7-case content-pinned pattern mirrored per arm, plus a parity block asserting all three optional arms now answer in one shape (
toThrow()alone would have stayed green through the whole defect). Because both packages resolve inside this workspace, the arm-level case cannot simply ask for the driver and watch it fail the way the turso one does — it stages the absence withvi.doMock+vi.resetModules, undone infinallyso the real construction suites are untouched.One fixture outside the factory's own test file was re-spelled:
datasource-connection-service.test.ts's "the factory-wrapped optional-driver form" case hand-spelled the pre-#7385 sentence, so it would have gone on pinning a shape the factory can no longer emit. It now builds its input frommissingSqliteWasmDriverMessageitself. The property under test is unchanged. That is a one-fixture extension beyond the dispatched file surface, flagged here deliberately.Reverse verification, two stages, both partial-red and explained:
expected 'sqlite-wasm driver requested but @obj…' to contain 'npm install @objectstack/driver-sqlit…'), 292 of 294 green. That is the honest shape: the content pins test the exported builders, and the arm-level case is the only thing binding those builders to the arms.Not touched, per the card: the
tursoarm andmissingTursoDriverMessage(merged hours earlier, its wording pinned by #7384's own tests), and #7243'sdatasource.poolsurfaces. Converging turso onto the shared builder is left as a provably inert one-liner for whoever wants it — the parity test is what makes it provable.Generated by Claude Code