refactor(db): 消除隐式状态通道,收敛 LLM 上下文消息 - #9
Merged
zavier merged 3 commits intoAug 1, 2026
Conversation
删除 ready() 影子守卫,readiness 由 resolveTarget 单一持有: - 六个工具统一 getWorkspace() 后走 facade 入口 resolve-and-throw, 修掉 connection-only 显式目标被误拒的 bug - db_relation 缺目标时改抛与 resolveTarget 一致的文案 db_tables list 模式补 truncate()(上万张表不再原样灌进上下文), 并按场景定制截断提示语——表列表/表结构不再是 query 专用的 "add a LIMIT" 文案。
候选 8 的两半: - lastRelatedCache 从 module 级单例改为注入式 RelatedBrowserCacheStore (db.ts 注册时创建,经调用链传入 query 路径写入、related 路径读取), 消除显示函数副作用与测试顺序依赖 - 新建 commands/llm-context.ts 作为 LLM 英文消息的唯一构建点; index.ts(session_start)/ db.ts(仪表盘)/ switch.ts(切换后) 三处复用,active 文案三处统一
table-tool-consolidation / extension-toggle 两份文档表头更新为已实施。 删除与 getCompletions 逐字复制的 repro-autocomplete.mjs——真实函数 已由 __tests__/db-command.test.ts 覆盖,保留只会静默漂移。
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.
变更内容(3 个 commit)
依赖 PR #8(候选 7)——base 为
refactor/dead-interface,合并后可将 base 改回main。1. refactor(db): 删除 ready() 并补齐 db_tables 截断
ready()影子守卫,readiness 由resolveTarget单一持有;六个工具统一getWorkspace()后走 facade 入口 resolve-and-throwconnection单独传(无 workspace)时不再被误拒,经defaultDatabase正常解析db_relation缺目标时改抛与resolveTarget一致的文案db_tableslist 模式补truncate(),并按场景定制截断提示语(表列表/表结构不再是 query 专用的 "add a LIMIT")2. refactor(db): 消除隐式状态通道,收敛 LLM 上下文消息
lastRelatedCache从 module 级单例改为注入式RelatedBrowserCacheStore(db.ts 注册时创建,经调用链传入 query 路径写入、related 路径读取),消除显示函数副作用与测试顺序依赖commands/llm-context.ts作为 LLM 英文消息唯一构建点;index.ts / db.ts / switch.ts 三处复用,active 文案统一3. chore(docs): 修正已实施文档表头,删除过期复现脚本
getCompletions逐字复制的 repro-autocomplete.mjs(真实函数已由 db-command.test.ts 覆盖)行为变更
db_list_relations无 workspace 且无 database 时从报错改为列出全部关系验证
npm run check(tsc --noEmit)通过npm test(vitest,223 tests)通过npm run lint(oxlint,0 errors,warnings 15→13)通过npm run fmt/npm run fmt:check通过