feat(datasource,runtime): teardown through the one datasource path, honoring adopted pools (#3993); ADR-0062 status flip (#3992) - #3999
Merged
Conversation
…onoring adopted pools (#3993); ADR-0062 status flip (#3992) DatasourceConnectionService owns the disconnect half symmetrically now: disconnect(name, { asDefault }) resolves the default under its natural name, disconnectAll() closes exactly the 'connected' pools this service opened, and the new DatasourceDriverHandle.ownership discriminator ('factory' | 'host') keeps kernel teardown away from adopted instances — createPrebuiltDriverFactory stamps 'host', so a cloud LRU eviction can never pull a shared pool from under its other consumers. Wired at the kernel's real teardown phase (destroy(); the Plugin contract has no stop()) via DefaultDatasourcePlugin and DatasourceAdminServicePlugin. ADR-0062: header and D1 notes now record the completed cross-repo convergence (cloud#915) with the escape-hatch classification and the parity guard's shifted role; D5 gains the teardown amendment. Closes #3992. Closes #3993. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GK5nd3gtehcAhrF6Zzp2on
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 23 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 30, 2026 02:33
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 free
to 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.
Closes #3992。Closes #3993。同一主题(ADR-0062 收尾)合一个 PR:teardown 代码与它要写进 ADR 的语义互为表里,ADR 终局翻转顺带一次改完。
#3993 — teardown 归一,owned vs adopted
前提事实(逐码核实,已写进 D5 增补): kernel 的 teardown 阶段是
destroy()——Plugin契约根本没有stop(),performShutdown只按注册逆序调destroy()。所以ObjectQLPlugin.stop、control-plane preset wrapper 的 stop 转发,都是从未被调用的死钩子;default(以及 declared/runtime datasource)的池在优雅关闭时无人断开,是「零份实现」而非分叉。对称补齐 connect 那半:
disconnect(name, { asDefault }):default 按自然名解析(ADR-0062 D1 收尾:defaultdriver 的 connect 与失败判决仍是第二份实现(阻塞点已定位) #3826 的既定规则——getDriverByName('default')永远找不到它;旧签名对 default 调用时会静默跳过 driver.disconnect,这不是行为回退而是从未生效)。disconnectAll():只关本 service 打开的池('connected'状态)。already-registered属于别人(onEnable桥、default 的幂等 replay)——绝不碰。DatasourceDriverHandle.ownership: 'factory' | 'host':connect 时记录进留存判决。createPrebuiltDriverFactory盖'host'章:被收养实例的池比 kernel 长寿(cloud control driver 兼任所有环境 kernel 的 proxy 基座、每环境 driver 跨 kernel 注册表缓存)——cloud 的 LRU evict(kernel.shutdown())清判决但绝不关池,否则会把共享池从其他消费者脚下抽走。cloud 仓零改动即得到正确行为(它已经在用 prebuilt factory)。DefaultDatasourcePlugin.destroy()+DatasourceAdminServicePlugin.destroy()(后者已有 destroy,扩入),均 best-effort——teardown 失败不得遮蔽关闭路径。sqlite-wasmdefault 的persist: 'on-disconnect'此前在优雅关闭时从不触发,现在真的会 flush。#3992 — ADR-0062 终局翻转
'cloud'别名注册、测试注入)。验证
asDefault自然名解析被关、disconnectAll只关自己开的/跳过 already-registered)kernel.shutdown()时被 disconnect、adopted 的disconnects === 0)pnpm turbo build两包及依赖图全绿;根配置 ESLint 对触及文件零告警Review 重点
disconnectAll的过滤判据(只'connected')是否有我没想到的第三态该关;destroy()(原来只置空 service)扩入disconnectAll是否影响某个我没跑到的宿主拓扑。Generated by Claude Code