Commit Graph

35 Commits

Author SHA1 Message Date
jxxghp
5fa5b414aa feat(agent): harden tool outcomes, recovery and discovery 2026-09-09 19:55:21 +08:00
Aqr-K
862ed4d5b8 fix(plugin): 插件 schema 不再回落 public,迁移目录拒绝相对路径
PostgreSQL 下 search_path 留了 public 兜底,插件 schema 里不存在的表名会继续
解析到宿主同名表,一条未限定的 DELETE 就能改到宿主数据;解析根收敛为插件自己的
schema,找不到的表名直接报错。

get_database_migrations() 的合同要求绝对路径,此前只校验目录是否存在,相对路径
会按宿主进程的当前工作目录解析成另一条迁移链,改为直接拒绝。
2026-09-02 02:38:18 -04:00
Aqr-K
a4d38e0f12 fix(plugin): 卸载先停后删、销毁全程持锁,PostgreSQL 会话按插件 schema 解析原生 SQL
卸载编排改为先停插件再删数据:插件的停机钩子取一次自有库句柄就能把刚删除的数据重新
建出来,注册表因此不再需要销毁墓碑,release 恢复为「只释放连接、保留数据」的单一语义。
停止同时注销插件类,其后的删除一律按 force 执行。

destroy_database 的摘句柄、关连接与删载体全部收进同一把锁:原先在锁外删除载体,并发的
get_database 能在间隙注册一个指向同一载体的新句柄,随后的删除会把它一并抹掉。

PostgreSQL 句柄在派生引擎上注册 begin 监听器,按事务执行 SET LOCAL search_path,让
schema_translate_map 覆盖不到的原生 SQL 同样解析到插件自己的 schema;监听器只挂在
OptionEngine 上,宿主引擎与其它插件的连接不受影响。
2026-09-02 02:14:19 -04:00
Aqr-K
d7c5955031 fix(plugin): 插件自有数据库释放与销毁全程容错,并修正建表去重与 schema 命名
release/destroy 统一经 _close_handle 先清线程局部会话再 dispose,两步失败都
只记日志:单个插件的连接池故障不再让 close_database 跳过宿主同步与异步引擎的
释放,release_all_databases 也逐插件隔离。按模型建表对 __table__ 去重,单表
继承的父子类一并声明时不再对同一张表建两次。

卸载编排先删插件数据、后停插件,停机钩子里的 get_database() 会把刚销毁的库
重新建出来:注册表记下已销毁的插件标识,其后的 release 改为再次销毁并清除
标记,ensure 则撤销标记,宿主编排代码不动。PostgreSQL schema 名在归一改写过
标识或超长时追加插件标识哈希并截到 63 字节,My-Plugin、My_Plugin 与
my_plugin 不再折叠到同一个 schema 而在卸载时互相 DROP。

start 的失败分支释放已经建立、却进不了运行态的句柄,整体停止把只登记在
_classes 里的插件一并释放。声明的迁移目录不存在时在建句柄之前抛
FileNotFoundError,不再留下空库;SQLite 迁移 URL 改由引擎渲染;
_get_sqlite_engine 的连接参数下沉到实际使用它的异步分支。
2026-09-02 02:14:19 -04:00
Aqr-K
626d8217ba feat(plugin): 开放插件自有数据库声明与句柄接口
_PluginBase 新增 get_database_models()/get_database_migrations() 声明钩子
与 get_database() 句柄入口,按类名(含分身)解析插件标识;
app/sdk/database.py 导出 plugin_declarative_base 与 PluginDatabaseHandle。
docs/rules/10-data-and-persistent.md 补充 Plugin-Owned Databases 小节,
说明 db_query/db_update 的自动兜底仍绑定宿主会话、需显式传入插件会话。
2026-09-02 02:14:19 -04:00
jxxghp
7a10964526 refactor(subscription): close typed persistence boundary 2026-08-28 13:56:42 +08:00
jxxghp
c656da1e28 refactor(site): close typed persistence boundary 2026-08-28 12:37:30 +08:00
jxxghp
017fecabd6 refactor(history): close transfer history boundary 2026-08-28 11:57:38 +08:00
jxxghp
aa8751f775 refactor: close transactional boundary debt batch 2026-08-28 10:36:12 +08:00
jxxghp
3bf94ffeda docs(architecture): enforce host persistence boundary 2026-08-27 05:44:33 +08:00
jxxghp
362f606751 feat(governance): unify durable event retention 2026-08-26 12:45:44 +08:00
InfinityPacer
f28e8b1538 feat(plugin): add source identity foundation (#6454) 2026-08-25 19:58:56 +08:00
jxxghp
9fede7fb2d docs: sync architecture docs with current structure 2026-08-24 12:38:38 +08:00
jxxghp
6e69258e3c refactor: make model sessions explicit 2026-08-23 23:33:07 +08:00
jxxghp
e1509c4e0d refactor: reorganize startup persistence boundaries 2026-08-23 21:24:34 +08:00
jxxghp
5e9933ca8b refactor: isolate subscribe history queries 2026-08-23 14:46:39 +08:00
jxxghp
8b955c04d6 refactor: isolate passkey queries 2026-08-23 14:37:21 +08:00
jxxghp
2120b8040a refactor: isolate pending transfer and config queries 2026-08-23 14:29:59 +08:00
jxxghp
8fc9a021b0 refactor: isolate agent history queries 2026-08-23 14:21:53 +08:00
jxxghp
d8b8583d49 refactor: isolate media server and site userdata queries 2026-08-23 14:15:37 +08:00
jxxghp
be1071b6cd refactor: isolate workflow queries 2026-08-23 14:06:14 +08:00
jxxghp
4074fa4e42 refactor: isolate transfer and download history queries 2026-08-23 13:59:12 +08:00
jxxghp
f1e542bef0 refactor: govern background tasks and query ownership 2026-08-23 13:24:04 +08:00
jxxghp
4d1be26a31 docs: close debt governance status 2026-08-23 04:01:02 +08:00
jxxghp
1c457143f7 test: refresh architecture debt baselines 2026-08-23 01:02:00 +08:00
jxxghp
2031f3c420 refactor: migrate agent task query ownership 2026-08-23 00:37:03 +08:00
jxxghp
be18cace1f refactor: finish transactional runtime migration 2026-08-22 15:18:16 +08:00
jxxghp
e61b5168ad refactor: move workflow execution writes to uow 2026-08-22 13:21:52 +08:00
jxxghp
b598b516d5 refactor: migrate high-risk write transactions 2026-08-21 20:46:57 +08:00
jxxghp
7de72e0e83 refactor: own subscription create transactions 2026-08-21 20:37:31 +08:00
jxxghp
de2957b9de refactor: add transaction ownership ratchet 2026-08-21 20:16:30 +08:00
Aqr-K
8a11214a43 refactor(db): 修复异步连接池无界增长,并完成 SQLAlchemy 2.0 迁移与分层归位 (#6320) 2026-08-15 06:58:38 +08:00
jxxghp
369d7d6448 refactor: reorganize backend module boundaries 2026-08-14 19:53:33 +08:00
jxxghp
7b3444c366 refactor backend module architecture 2026-08-14 15:45:38 +08:00
DDSRem
784672af5c docs: restructure AGENTS.md and add docs/rules agent documentation system (#5830) 2026-05-25 13:48:43 +08:00