Skip to content

refactor(runtime): unify standalone default-driver construction via the shared factory (ADR-0062) - #2207

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0062-default-driver-construction
Jun 22, 2026
Merged

refactor(runtime): unify standalone default-driver construction via the shared factory (ADR-0062)#2207
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0062-default-driver-construction

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

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

createStandaloneStack hand-mirrored the driver-construction switch that createDefaultDatasourceDriverFactory already 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.

  • 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 in the stack: it's the standalone-specific, CI-safe default and not a user-creatable datasource type, so it already has a single construction site (routing it through the factory would've pulled driver-sqlite-wasm into service-datasource, which it shouldn't depend on).
  • Deliberately not done: routing default through the post-engine DatasourceConnectionService.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-datasource as a runtime dependency — no cycle (that package depends only on core/spec; full-repo build 76/76).

Tests / validation

  • New per-kind driver test (standalone-stack.test.ts): extracts the constructed driver from the stack's DriverPlugin and does connect → syncSchema → create → find for memory (→ InMemoryDriver), file: (→ better-sqlite3 SqlDriver), and databaseDriver:sqlite-wasm (→ SqliteWasmDriver). Existing artifact-RBAC tests still pass (8/8).
  • Full repo build 76/76, runtime413, service-datasource85 (zero net diff there — the factory already supported these kinds).
  • Real os dev boot: factory-built default SqlDriver(sqlite) serves the live app (showcase_project returns data); external auto-connect (showcase_ext_customer) still works.

Closes#2163 (the final, optional consolidation item).

🤖 Generated with Claude Code

…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>
@vercel

vercelBot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 22, 2026 1:02pm

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file tests tooling size/m labels Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime.

17 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx(via packages/runtime)
  • content/docs/concepts/implementation-status.mdx(via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx(via packages/runtime)
  • content/docs/concepts/packages.mdx(via @objectstack/runtime)
  • content/docs/guides/api-reference.mdx(via @objectstack/runtime)
  • content/docs/guides/authentication.mdx(via @objectstack/runtime)
  • content/docs/guides/cloud-deployment.mdx(via @objectstack/runtime)
  • content/docs/guides/deployment-vercel.mdx(via @objectstack/runtime)
  • content/docs/guides/driver-configuration.mdx(via @objectstack/runtime)
  • content/docs/guides/hook-bodies.mdx(via @objectstack/runtime)
  • content/docs/guides/packages.mdx(via @objectstack/runtime)
  • content/docs/guides/plugin-chatbot-integration.mdx(via @objectstack/runtime)
  • content/docs/guides/production-readiness.mdx(via @objectstack/runtime)
  • content/docs/guides/single-project-mode.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/http-protocol.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/index.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/lifecycle.mdx(via @objectstack/runtime)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@xuyushun441-sys
xuyushun441-sys merged commit 94d2161 into mainJun 22, 2026
17 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/adr-0062-default-driver-construction branch June 22, 2026 13:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Epic: External Datasource Runtime — implement ADR-0062 (auto-connect, credentials, analytics, cleanup)

2 participants

@xuyushun441-sys@os-zhuang