Skip to content

fix(service-datasource): a pool rebuild syncs the managed objects bound to the datasource (#27750) - #27874

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-ia5zz6
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-ia5zz6

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #27750

维护者速读

  • 改了什么:管理员修改一个 Setup 创建的托管数据源(换库、换凭据、改 schemaMode 或重新启用)导致连接池重建时,绑定到它的代码对象会在新库上建表。
  • 为什么改:service-datasource: a code object bound to a runtime (Setup-created) managed datasource never gets its table; registerPool connects with no objects, so reads 500 with 42P01 on create and after restart #27701 只修了"创建"和"重启"两条路;"修改后重建"仍不建表,换库后该对象每次读取都失败,只能手工建表。
  • 风险与回滚:只对 schemaMode: managed 生效,external / validate-only 依旧零 DDL;重建失败保留旧池时不同步。回滚 = revert 本 PR。
  • 先看:datasource-admin-plugin.ts 新的共用 helper managedObjectsBoundTo,以及 reconnect 新增的 objects 参数。
  • 两分钟验证:pnpm --filter @objectstack/service-datasource exec vitest run src/__tests__/runtime-datasource-bound-object-storage.test.ts(新增 3 例;回退连接服务的改动后换库那例变红)。
  • 需要你做的:无(Tier S,按本期落地授权由席位落地)。

What changes

Why

#27701 synced bound managed objects when a runtime datasource's pool opens. An admin update that rebuilds the pool (PATCH /api/v1/datasources/:name → updateDatasource → reregisterPool → reconnect) still passed none, so moving warehouse to a new database left wh_note without a table there and every read of it failed.

Verification

  • Pinned red on main first: in runtime-datasource-bound-object-storage.test.ts (real plugin, real ObjectQL, SQLite), create warehouse on a.db, update config to b.db → hasTable('wh_note') was false on b.db. Green with the fix; ablating the connection-service change turns it red again, restoring turns it green.
  • New ⛔ cases: external and validate-only datasources updated to a new database sync nothing and create no table.
  • @objectstack/service-datasource: 63 files / 1031 tests pass; tsc --noEmit clean.
  • dispatch-gates --ran: 60 derived families accounted for: 59 run green, 1 NOT MEASURED (check:dual-build-cjs-loads, exit 3, needs a whole-tree build; CI runs it). pnpm lint exit 0. check:commit-card-trailers green.

Clause-②: no
Metadata-protocol: none

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Serial note: draft PR #27819 (#27746) edits both files; this PR keeps to reconnect, registerPool / reregisterPool and the shared helper. The later lander merges main.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4d1ZEsJ6Xne4sn5EXtT

…nd to the datasource

An admin update that rebuilds a runtime managed datasource's pool (a
changed config, credential, schemaMode or active) went through
reconnect, whose inner connect carried no objects, so the objects bound
to it got no table on the new database. reconnect now takes the bound
objects and forwards them to the rebuild's connect; registerPool and
reregisterPool read them through one managed-only helper, so an
external or validate-only datasource still never gets DDL.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1ZEsJ6Xne4sn5EXtT
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-datasource, touching 2 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/data-modeling/external-datasources.mdx (via DatasourceAdminServicePlugin (symbol, a top-level class))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via DatasourceConnectionService (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

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): node scripts/docs-audit/affected-docs.mjs --json c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef → packageMentionDocs.

Which tree this was computed on

This run read content/docs from db97f0ea77aef97c39ab6b5294d7b0ee56eef4f8 — the merge of head f0ef0a93476dc0a7c1f197d21c4b93a1d7ed56a9 into base c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin db97f0ea77aef97c39ab6b5294d7b0ee56eef4f8 && git checkout db97f0ea77aef97c39ab6b5294d7b0ee56eef4f8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef f0ef0a93476dc0a7c1f197d21c4b93a1d7ed56a9 && git checkout -B drift-repro c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef && git merge --no-ff f0ef0a93476dc0a7c1f197d21c4b93a1d7ed56a9

node scripts/docs-audit/affected-docs.mjs --json c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c4cb5ec0c3936dd2c24ae2aa9a349449d8e33bef → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia

Seat ACCEPT · PR #27874 · head f0ef0a93476dc0a7c1f197d21c4b93a1d7ed56a9 · 2026-10-30T02:46Z

维护者速读

An admin edit that rebuilds a Setup-created managed datasource's pool (a changed connection config, credential, schemaMode or active) now gives the code objects bound to it their tables on the new pool, as the create and restart path already does since #27701. external and validate-only datasources still never get DDL.

席位核对

ACCEPT

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 30, 2026 02:47
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 30, 2026 02:47
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 3e039e0 Oct 30, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ia5zz6 branch October 30, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

2 participants