Repository navigation
feat: SQL 库与终端 reintegrate 恢复(#313) - #383
Merged
Merged
Conversation
- core: 新增 sql-library 存储层——默认库根目录、挂载/卸载用户目录(持久化到配置目录)、 目录列表、新建/重命名/删除 SQL 文件与子目录、SQL 文件名校验 - db_view: 数据库页右侧新增「SQL 库」面板,库树懒加载、文件操作弹窗与通知 - 点击库内 .sql 文件用 SQL 编辑器打开,页签按文件路径复用,连接可在编辑器内切换 - 文件名校验统一收敛到 core,db_view 的 query_file_path_for_name 改为委托,删除重复实现 - 新增单测:core 13 项(临时目录)、面板 11 项(树状态 + 接线/i18n 契约)
查询结果里 `SELECT * FROM ads.tbl` 解析出的表名是 `ads.tbl`(库名与表名用 . 拼接), 复制 INSERT/UPDATE/DELETE 时被整体当成一个标识符加引号,产出 `ads.tbl` 这种库表名 粘在一起的非法名字。 - table_identifier 改走新增的 qualified_identifier:按 . 拆分逐段引用,兼容 db.schema.table,仅一段时行为不变 - 新增 3 个契约测试(MySQL 逐段引用并覆盖 INSERT/UPDATE/DELETE、无插件的回退引号 与三段名、非限定名不受影响) 验证:cargo test -p db_view --lib(927 passed / 0 failed)。
sudo -i / su 等嵌套 shell 不继承运行时注入的 shell integration,
OSC 133 事件流断开后 supervisor readiness 卡死在瞬态,
terminal.exec 持续 terminal_busy 且 interrupt 的 ETX 无法恢复。
- ExecSupervisor::reintegrate_shell 门控:exec 在途/断连拒绝,
卡在瞬态 readiness 时放行,不改状态
- SSH actor 写 runtime_shell_integration_command() 重注入;
新提示符的 OSC InputStart 无条件翻回 Ready,状态机自愈
- local actor 返回 terminal_control_unsupported(集成形态不同,fail closed)
- readiness_before 改 Option,reintegrate 恒 None
- Busy 出口富化为 BusyContext{readiness},指引 Agent 走
read → reintegrate → retry 自救链路
…tream sync) kit upstream sync brings caret-pinned gpui-pre 0.3.9 + gpui-fast 0.1.7 workspace requirements (satisfied by the existing release/v0.1.8 shim snapshot at 0.3.126/0.1.8), caret-anchored completion popups, auto-grow row fitting, TextView selection-under-glyphs painting. Fix the terminal.control test stub missed by a6b91ff: readiness_before is Option<TerminalControlReadiness> now.
feigeCode
added a commit
that referenced
this pull request
Oct 16, 2026
恢复 a9ed96b6b 被遗落在 feat/issue-313-sql-library 分支的完整实现: SQL 库整理成 feat/sql-library 走 PR #383 时只挑了 b801a46, 磁盘下拉 UI 接线被丢下,dev 只剩 checkpoint 半截(WIP 标记 + allow(dead_code))。 cherry-pick 仅一处冲突(local_volume.rs 测试 import 块),取完整版; 另删掉 lib.rs / local_volume.rs 里已失效的 WIP 注释与 allow(dead_code)。 验证:cargo test -p sftp_view --lib 118 passed;cargo check -p main --tests、 cargo clippy -p sftp_view --all-targets 均通过
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 #313
Description
本 PR 包含两个特性:
1. SQL 库(standalone SQL library)
Adds a standalone SQL library: a global, connection-agnostic home for
.sqldocuments, so scripts no longer have to live inside a per-(connection+database)
query folder.
core: newstorage::sql_librarymodule — default library root(
<data_dir>/sql-library, deliberately outside~/Documentsto avoid themacOS TCC prompt), mounted user directories persisted to
config/sql-library-directories.json, directory listing, create / rename /delete for
.sqlfiles and subfolders, and shared SQL file-name validation.db_view: newSqlLibraryPanel, reachable from a rail button on the databasetab's right sidebar. Lazy-loading tree (one level per expand), create / rename /
delete / remove-from-library dialogs, notifications, empty and load-error
placeholders.
.sqlfile opens it in the existing SQL editor, reusing syntaxhighlighting, execution and autosave. Tabs are keyed by file path, so clicking
the same file again focuses the tab that is already open.
first connection) is used as the default, and the connection can be switched
inside the editor. If no connection exists, the panel just notifies instead of
opening an empty editor.
core::storage::sql_library(
sql_file_path_for_name);db_view::sql_editor_view::query_file_path_for_namenow delegates to it, removing the duplicated implementation.
on disk.
2. 终端 reintegrate 恢复(terminal.control action=reintegrate)
嵌套 shell(
sudo -i/su)不继承运行时注入的 shell integration,OSC 133事件流断开后 supervisor readiness 卡死在瞬态,
terminal.exec持续terminal_busy且interrupt的 ETX 无法恢复(空提示符上只回显^C,不产生 OSC 事件)。
ExecSupervisor::reintegrate_shell门控:exec 在途 / 断连拒绝,卡在SubmissionPending/CommandRunning瞬态时放行,不改状态runtime_shell_integration_command()重注入;新提示符的OSC
InputStart无条件翻回Ready,状态机自愈,等 1-2 秒重试 exec 即可terminal_control_unsupported(本地集成形态不同,failclosed)
readiness_before改Option,reintegrate 恒NoneBusyContext{readiness},指引 Agent 走read → reintegrate → retry 自救链路
terminal.read确认空闲提示符 →
control action=reintegrate→ 重试Screenshot
.sqlfilesNo screenshots attached — the UI has not been captured yet.
How to Test
Automated, run on top of
origin/main(this branch's base):SQL 库:
cargo test -p one-core sql_library→13 passed, 798 filtered outcargo test -p db_view sql_library→11 passed, 914 filtered outcargo check -p main→0 errorsThe db_view suite covers the tree state machine (expansion, lazy loading, stale
state on root reset) and source-level contracts for the wiring and the i18n keys;
the core suite covers the storage layer against a temp directory, never the real
config dir.
reintegrate:
cargo test -p terminal --lib reintegrate→10 passed(门控 fail-closed、瞬态放行、端到端自愈、SSH actor 注入 contract、local Unsupported contract)
cargo test -p public_mcp --test terminal_control→ schema enum、parse、reintegrate 结果
readiness_before=null、未知 action 拒绝cargo test -p terminal -p public_mcp -p terminal_view→1307 passed, 0 failedcargo clippy -p terminal -p public_mcp -p terminal_view --all-targets→新增代码零告警
cargo check -p main→0 errorsManual: SSH 连接后进入
sudo -i,确认terminal.exec报带指引的 busy,terminal.read看到空闲 root 提示符后terminal.control action=reintegrate,1-2 秒后重试 exec 正常执行。