Uh oh!
There was an error while loading. Please reload this page.
refactor(runtime): unify standalone default-driver construction via the shared factory (ADR-0062) - #2207
Merged
Conversation
…asource factory (ADR-0062) Unifies driver CONSTRUCTION: createStandaloneStack builds its `default` driver for the user-facing kinds (memory / better-sqlite3 / postgres / mongodb) through the same createDefaultDatasourceDriverFactory used for declared + runtime-admin datasources — one "driver kind → instance" path instead of two hand-mirrored ones. URL→config translation, mkdir, and pre-engine DriverPlugin registration stay in the stack (unchanged); the factory only constructs the driver. The pure-JS WASM sqlite driver stays bespoke (standalone-specific CI-safe default, not a user-creatable datasource type — single construction site already). No behavior change — same driver instances for the same inputs. Verified by a per-kind connect + CRUD round-trip test (memory/better-sqlite3/sqlite-wasm) and a real `os dev` boot (factory-built default SqlDriver serves the live app; external auto-connect still works). Adds @objectstack/service-datasource as a runtime dep (no cycle: it depends only on core/spec). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 17 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
ADR-0062 follow-up — unify the
default-driver construction (Variant A)The deferred "default-driver refactor", done as the low-risk, debt-killing slice (not the full pre-engine rewrite).
What & why
createStandaloneStackhand-mirrored the driver-construction switch thatcreateDefaultDatasourceDriverFactoryalready implements — so adding a dialect or changing connection/pool defaults meant editing two places that drift. This routes the user-facing kinds (memory / better-sqlite3 / postgres / mongodb) through the same factory used for declared + runtime-admin datasources: one "driver kind → instance" path.mkdir, and pre-engineDriverPluginregistration stay in the stack (unchanged) — the factory only constructs the driver.driver-sqlite-wasmintoservice-datasource, which it shouldn't depend on).defaultthrough the post-engineDatasourceConnectionService.connect()/ policy path. That fights the bootstrap ordering (DriverPlugin is pre-engine) for a trusted local primary DB with no payoff — explicitly out of scope (see the ADR D5 note + the long-term rationale).No behavior change
Same driver instances for the same inputs. Adds
@objectstack/service-datasourceas aruntimedependency — no cycle (that package depends only oncore/spec; full-repo build 76/76).Tests / validation
standalone-stack.test.ts): extracts the constructed driver from the stack'sDriverPluginand does connect → syncSchema → create → find formemory(→ InMemoryDriver),file:(→ better-sqlite3 SqlDriver), anddatabaseDriver:sqlite-wasm(→ SqliteWasmDriver). Existing artifact-RBAC tests still pass (8/8).runtime413,service-datasource85 (zero net diff there — the factory already supported these kinds).os devboot: factory-built defaultSqlDriver(sqlite)serves the live app (showcase_projectreturns data); external auto-connect (showcase_ext_customer) still works.Closes#2163 (the final, optional consolidation item).
🤖 Generated with Claude Code