Repository navigation
fix(service-datasource): a runtime managed datasource syncs its bound objects' tables on create and after a restart - #27748
Conversation
…s bound objects' tables registerPool opened a Setup-created datasource's pool with no objects, so a code object bound to it never got its table, on create or after a restart, and every read of it was a 500. The connect now carries the objects bound to the datasource when it is managed, read from the engine registry through the same helper listObjectsBoundTo uses. An external or validate-only datasource passes none and never gets DDL. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czbMpdApCUbUuNyHt7
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 2 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 326cad2e311bb62c995f15597eea96e3647efc74 && git checkout 326cad2e311bb62c995f15597eea96e3647efc74
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 81d00a4ed938eb896859630498fc59d91183cf71 6f7736751e98b1ff5ed6634fca470bec6f02c94a && git checkout -B drift-repro 81d00a4ed938eb896859630498fc59d91183cf71 && git merge --no-ff 6f7736751e98b1ff5ed6634fca470bec6f02c94a
node scripts/docs-audit/affected-docs.mjs --json 81d00a4ed938eb896859630498fc59d91183cf71
|
|
domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia Seat ACCEPT · PR #27748 · head
|
Requested by Elon · project thread
domain:server#3 · os-elon-musk · session_016WV4czbMpdApCUbUuNyHt7
Fixes #27701
What changes
registerPool(packages/services/service-datasource/src/datasource-admin-plugin.ts) now opens a runtime datasource's pool withobjects: the names of the objects bound to it in the engine registry. The connect's existing sync loop gives them their tables. This covers the admin create, the boot rehydration, and a peer replica's convergence on a new datasource, which all go throughregisterPool.resolveDatasourceSchemaMode, the same read the driver factory uses. Anexternalorvalidate-onlydatasource passes none and never gets DDL (triage ruling6506923793).listObjectsBoundToalready did is lifted into one local helper,objectsBoundTo, which both readers call.listObjectsBoundTo's answer is byte-for-byte the same.datasource-connection-service.ts(open PR fix(service-datasource): a plugin-driver datasource connected or reconnected through the connection service keeps the engine's floor #27715) norobjectql/src/engine.tsis touched.Why
A code object bound to a Setup-created managed datasource never got its table. Boot's schema sync skipped it, because the driver did not exist yet.
registerPoolthen calledconnect(record, { context })with noobjects, so the sync loop had nothing to sync. The datasource answeredok, and every read of the object was a 500 (Postgres42P01), the same after a restart.Verification
New pin:
src/__tests__/runtime-datasource-bound-object-storage.test.ts. It uses the realDatasourceAdminServicePluginthroughinit()andstart(), a realObjectQLengine on theobjectqlanddataslots, and the real default driver factory over SQLite files.origin/mainpluginschemaMode: external: the pool opens, nothing is syncedschemaMode: validate-only: the pool opens, nothing is syncedAblations, each restored afterwards:
objectsargument turns the 3 positive cases red.syncObjectSchemacalled 2 times).Local readings at
6f773675:@objectstack/service-datasourcetest: 62 files, 1016/1016 passed.typecheck: exit 0.dispatch-gates --commands: 59 families derived, 58 exit 0.pnpm check:dual-build-cjs-loadsexited 3, so it is NOT MEASURED (it needs a whole-tree build; CI runs it).dispatch-gates --ran: 59 accounted for.pnpm lint: exit 0.Clause-②: no
Metadata-protocol: none
Acceptance notes
config, credential,schemaModeoractive(updateDatasource→reregisterPool→DatasourceConnectionService.reconnect).reconnecttakes noobjects, and its innerconnect(record, { context })is indatasource-connection-service.ts.warehouseona.db, then update itsconfigtob.db. The result ishasTable('wh_note') === false, and the read is refused by the database.reach:the admin update door (PATCH /api/v1/datasources/:name→updateDatasource). The fix belongs in the connection service, serial behind fix(service-datasource): a plugin-driver datasource connected or reconnected through the connection service keeps the engine's floor #27715.externalset) on a managed datasource would go throughsyncObjectSchema's DDL-freeregisterExternalObjectbranch. The admin door already refuses that binding at write time (service-datasource: createDatasource / updateDatasource write sys_metadata without the save door, so they can mint or flip a datasource to managed under objects bound external (ADR-0015 §4.2) #25277).Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses.main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4czbMpdApCUbUuNyHt7