You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(runtime,datasource): default-datasource factory seam + adopt pre-built drivers via one connect path (#3968)
* feat(runtime,datasource): default-datasource factory seam + adopt pre-built drivers via one connect path (#3826)
DefaultDatasourcePlugin accepts an injected IDatasourceDriverFactory
(default: the shared open-core factory, unchanged when omitted), and
createPrebuiltDriverFactory wraps a host-built driver instance as a
factory — the "adopt an existing driver" seam, landed as a factory so
the connect + failure-verdict orchestration stays the single
DatasourceConnectionService implementation. This is what the cloud
compositions (turso, pooled control-plane/environment drivers) need to
converge without forking the verdict.
The @objectstack/verify dogfood harness now boots the declared default
(sqlite-wasm definition) instead of a pre-built DriverPlugin, so the
dogfood gate covers the converged path — the ADR-0062 §Risk mitigation.
ADR-0062's header no longer understates D1 (open-core converged; the
cloud repo is the last second site), and the degraded-boot parity
guard's comment now describes what it actually guards.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GK5nd3gtehcAhrF6Zzp2on
* chore: update pnpm-lock.yaml for the removed verify dependency
CI frozen-lockfile caught the miss: dropping @objectstack/driver-sqlite-wasm
from @objectstack/verify's dependencies needs the lockfile regenerated.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GK5nd3gtehcAhrF6Zzp2on
* docs(drivers): DriverPlugin is the escape hatch, not "the same path the CLI uses"
Stale since #3886: the CLI's primary boots as a declared default
definition, not a pre-built DriverPlugin. Flagged by the docs drift
check on this PR.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GK5nd3gtehcAhrF6Zzp2on
---------
Co-authored-by: Claude <noreply@anthropic.com>
feat(runtime,datasource): the default-datasource connect seam accepts a host driver factory — adopt pre-built instances without forking the verdict (#3826)
8
+
9
+
ADR-0062 D1's open-core convergence (#3869/#3886) left one structural question
10
+
open: a host whose `default` needs a driver the shared factory cannot build —
11
+
the cloud distribution's `turso`, or an instance pooled BEYOND one kernel (the
12
+
cloud control-plane driver doubles as the proxy base of every environment
13
+
kernel; per-environment drivers are cached across kernel rebuilds) — had only
14
+
two options, both bad: stay on the legacy pre-built `DriverPlugin` path, whose
15
+
connect verdict lives in `ObjectQLEngine.init()` (the second implementation
16
+
#3826 exists to retire), or fork the connect orchestration. Either re-opens the
17
+
#3741 → #3758 drift this whole line of work is about.
18
+
19
+
Two additive pieces close it:
20
+
21
+
-**`DefaultDatasourcePlugin` accepts an injected `IDatasourceDriverFactory`**
22
+
(defaults to the shared open-core factory, byte-for-byte unchanged when
23
+
omitted). The factory only changes what `create()` returns — the policy-free
**Status**: Accepted (2026-06-22) — D2–D8 implemented (`service-datasource` connection service + opt-in-safe gate + fail-closed connect policy; native-SQL declines external per D6; D7 lint in `validate-expressions.ts`). **D1 partially implemented**: declared datasources auto-connect through the one service, but the `default` driver still has its own connect + failure path — see the status correction under D1 (#3826).
3
+
**Status**: Accepted (2026-06-22) — D2–D8 implemented (`service-datasource` connection service + opt-in-safe gate + fail-closed connect policy; native-SQL declines external per D6; D7 lint in `validate-expressions.ts`). **D1 implemented for every open-core boot path** (#3826: the standalone/artifact `default` and the CLI serve fallback are declared definitions connected through the one service — see the status notes under D1); the cloud repo's own stack composition is the last remaining second site, and the parity guard stays until it converges.
4
4
5
5
**Supersedes the runtime portions of**: ADR-0015 §18 addendum (kept as the historical record). ADR-0015 remains the canonical spec/binding decision; this ADR is the canonical *runtime* decision.
6
6
@@ -68,7 +68,9 @@ Introduce a single service that, given a datasource definition, builds a driver
68
68
>
69
69
> **Config-load fallback converged too (#3826, third pass).**`createStorageDriver` is gone: the CLI's serve fallback (a host `objectstack.config.ts` with objects but no driver plugin) now emits a definition via `resolveStorageDefinition` and hands it to the same `DefaultDatasourcePlugin`. `mysql` joined the shared factory for it; the dev loosen-only self-heal (#2186) rides as `config.autoMigrate` and the CLI's wasm persistence mode as `config.persist` — host-composition passthroughs the factory honours, never part of the app-facing datasource spec. `turso`/libSQL keeps its loud typed failure at *resolution* (nothing is constructed to fail later). The `telemetry` sibling datasource deliberately stays a pre-built `DriverPlugin` (the documented escape hatch for named auxiliary drivers): it is best-effort, dev-oriented, and its own `resolveSqliteDriver` step-down check replaces the old primary-resolution coupling.
70
70
>
71
-
> **Remaining second site: the cloud stack's own composition** (cloud repo, `cloud-stack.ts`), which also owns the `turso` driver. Until it converges, `packages/runtime/src/degraded-boot-parity.test.ts` remains load-bearing: it pins both connect paths to the same operator-visible contract (fail-fast by default, identical `OS_ALLOW_DRIVER_CONNECT_FAILURE` parsing, `DEGRADED BOOT` on stderr). #3741 → #3758 was exactly the miss it exists to catch.
71
+
> **Remaining second site: the cloud repo's own compositions** — the real primary-driver sites are `environment-kernel-factory.ts` (each environment's per-tenant driver) and the control-plane preset fed by `cloud-stack.ts`'s `buildControlDriver`, which also owns the `turso` driver. Until they converge, `packages/runtime/src/degraded-boot-parity.test.ts` remains load-bearing: it pins both connect paths to the same operator-visible contract (fail-fast by default, identical `OS_ALLOW_DRIVER_CONNECT_FAILURE` parsing, `DEGRADED BOOT` on stderr). #3741 → #3758 was exactly the miss it exists to catch.
72
+
>
73
+
> **The convergence seam (#3826, fourth pass).** Two properties of the cloud composition made "just declare it" impossible: its driver kinds live outside open-core (`turso`), and its instances are *pooled beyond one kernel* (the control-plane driver doubles as the proxy base of every environment kernel; per-environment drivers are cached across kernel rebuilds — reconstruction per boot would multiply pools). So `DefaultDatasourcePlugin` now accepts an **injected `IDatasourceDriverFactory`** (defaulting to the shared open-core factory), and `createPrebuiltDriverFactory` wraps an already-built instance as a factory — the "adopt an existing driver" entry point this ADR's first pass found missing, landed *as a factory* so the connect orchestration (policy-free init connect, `bootCritical` verdict, shared escape hatch, start() replay into retained state) stays this one implementation. Construction and pooling remain host concerns; only the verdict converges. The `@objectstack/verify` dogfood harness also boots through the declared default now (not the `DriverPlugin` escape hatch), making the §Risk mitigation — "behind the dogfood gate" — actually true for the converged path.
72
74
73
75
### D2 — Connect is opt-in-safe: existing managed apps are byte-for-byte unchanged
0 commit comments