feat(usable): integrate current dbtool implementation snapshot
Some checks failed
release-smoke / macos-13 / x86_64-apple-darwin (push) Has been cancelled
release-smoke / ubuntu-latest / x86_64-unknown-linux-gnu (push) Has been cancelled
release-smoke / windows-latest / x86_64-pc-windows-msvc (push) Has been cancelled

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Paperclip CTO
2026-04-02 08:26:18 +00:00
parent a28dab4cd9
commit d5f69462b0
73 changed files with 5895 additions and 322 deletions

View File

@@ -9,6 +9,7 @@
- 2026-03-28 当前 runner 已直接执行 `CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo build -p dbtool-tui``CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo test -p dbtool-tui`;默认裸 `cargo` 仍会因为空的 `CARGO_REGISTRIES_CRATES_IO_PROTOCOL` 环境变量而失败,这属于环境口径问题,不是产品失败。
- `dbtool-tui` 是 TTY 程序2026-03-28 源码重建后的 `./target/debug/dbtool-tui --help` 已返回退出码 `1`,并明确提示需要交互式 TTY 和 `scripts/tui/smoke-tty.sh`,不能再把旧的 `No such device or address` 产物输出当成当前契约。
- 2026-03-31 当前 runner 已确认可通过 `host.docker.internal:55432/53306` 访问 demo 数据库,并直接通过 `scripts/tui/live-network-smoke.sh` 复跑 PostgreSQL / MySQL TUI live path。
- 2026-03-31 当前 runner 已进一步补齐 PostgreSQL 失败连接 / 空结果 / 坏 SQL、MySQL empty schema / `28x100` 结果浏览稳定性,以及 PostgreSQL `restricted schema` live 直证;当前未收口项已收敛为 CI / packaged artifact / 非开发者复验,而不是 runner-side restricted blocker见 [CMP-64](/CMP/issues/CMP-64)。
## usable-v1 签收关注点
@@ -24,6 +25,12 @@
- `Esc` 在编辑模式与普通导航模式都应把用户带回更稳定、更可理解的状态。
- `[` / `]` 只在 `Query Editor``Results` 生效;文档和 QA 结论不能再写入不存在的快捷键。
### 3. 连接管理与 secret 边界
- 启动前环境变量 override 仍然是 operator fallback但不再是唯一连接管理路径当前 TUI 已提供 in-app 的新增 / 编辑 / 删除 / 保存并激活 workflow。
- 当前 secret handling 已区分两层profile 文件只持久化非 secret 字段;`Session password` 只在本次 TUI 进程内复用。
- PostgreSQL / MySQL 的 demo host override`DBTOOL_TUI_POSTGRES_HOST/PORT``DBTOOL_TUI_MYSQL_HOST/PORT`)仍不能误记成普通用户主路径,它只用于特定 host 环境。
## 验收分层
### A. Shell baseline当前可验
@@ -48,13 +55,15 @@
- [x] `sqlite-local` 与 network live 都复用 `crates/db-app`,不通过 CLI 文本解析旁路取数
- [x] PostgreSQL live smoke`scripts/tui/live-network-smoke.sh postgres ./target/debug/dbtool-tui`
- [x] MySQL live smoke`scripts/tui/live-network-smoke.sh mysql ./target/debug/dbtool-tui`
- [ ] 真实连接激活可区分 `loading` / `success` / `failure`
- [ ] 真实连接失败后,错误能在 `Inspector``Status & Activity` 中持续可见
- [ ] 真实 schema browser 可展示 schema / object / column 层级
- [ ] empty schema 与 restricted schema 在 live 数据下有明确文案
- [x] 真实连接激活可区分 `loading` / `success` / `failure`
- [x] 真实连接失败后,错误能在 `Inspector``Status & Activity` 中持续可见
- [x] 真实 schema browser 可展示 schema / object / column 层级
- [x] empty schema 在 live 数据下有明确文案
- [x] connection-failure fallback 会把 browser state 渲染为 `unavailable (restricted)` 并保留恢复文案
- [x] successful live restricted schema 可与 empty / hidden 稳定区分;当前 runner 已直接观察到 `restricted_probe``Schema failure``schema access is restricted: restricted_probe` 与 query-blocking 文案,见 [CMP-64](/CMP/issues/CMP-64)
- [x] `Query Editor` 可针对真实活动连接执行查询
- [x] 真实查询可区分 `running` / `success` / `empty` / `error`
- [ ] 真实结果区在常见终端尺寸下仍可浏览
- [x] 真实结果区在常见终端尺寸下仍可浏览
- [x] export 结果会给出明确成功 / 失败反馈
### D. usable-v1 状态恢复与键盘一致性(当前可按现有实现复核)
@@ -67,6 +76,17 @@
- [x] `[` / `]``Query Editor``Results` 之外不会制造隐藏状态变化
- [x] 当前对外文档已与实现一致,不再声明不存在的 `l` / `e` 快捷键
### E. 连接管理工作流(源码已落地,待 QA 走真实 TTY
- [ ] `Connections` 视图展示的列表来自 profile store而不是硬编码 demo-only 列表
- [ ] `n` 可进入新增流程,并在中间 `Query Editor` 显示分步式字段表单
- [ ] `e` 可编辑已保存 profile`Session password` 不会明文回显
- [ ] `t` 会对 staged profile 执行 connect + inspect 测试,并在 `Results` / `Status & Activity` 中保留反馈
- [ ] `s` 会保存非 secret 字段、复用 session secret、设置 active profile并直接进入查询工作流
- [ ] `d` 会进入删除确认;只有 `Enter` 才删除,`Esc` 会取消
- [ ] `DBTOOL_TUI_PROFILE_STORE` 可将 smoke 隔离到临时 store不污染长期配置
- [ ] 持久化的 profile 文件不包含密码或 `password` JSON 字段
### C. 非交互 / 发布前路径(当前必须显式保留限制)
- [x] QA 已确认 `dbtool-tui` 需要 TTY不能用 `--help` 替代交互 smoke
@@ -77,9 +97,6 @@
## 当前 blocker
- [ ] live failure 连接在 `Inspector` / `Status & Activity` 的持续可见性仍缺 2026-03-31 当前 runner 证据
- [ ] live `empty` / `restricted` schema 文案仍缺 2026-03-31 当前 runner 证据
- [ ] 结果区在常见终端尺寸下的稳定浏览仍缺 2026-03-31 当前 runner 证据
- [ ] `.github/workflows/release-smoke.yml` 当前只覆盖 `dbtool`
- [ ] 当前 runner 默认裸 `cargo` 仍会被空的 `CARGO_REGISTRIES_CRATES_IO_PROTOCOL` 环境变量绊倒runbook 需要显式写出 override
- [ ] release artifact / packaged binary 仍缺真实 smoke 证据
@@ -100,13 +117,23 @@
- PostgreSQL live 日志摘要:已直接观察到 `Validation: Connected``3 rows returned``3 rows exported`
- MySQL live 日志摘要:已直接观察到 `Validation: Connected``3 rows returned``3 rows exported`
- network path 盘点:当前 runner 对 `127.0.0.1:55432/53306` 仍不可达,但可通过 `host.docker.internal:55432/53306` 稳定访问 demo 容器
- PostgreSQL failure visibilityTTY 脚本日志 `/tmp/dbtool-tui-postgres-auth-failure.log` 已直接观察到 `Connection Failure``Recovery path``postgres authentication failed` 与 browser `unavailable (restricted)` 占位态
- PostgreSQL empty resultTTY 脚本日志 `/tmp/dbtool-tui-postgres-empty-result.log` 已直接观察到 `empty_recent_tickets.sql``No rows returned``0 rows returned in 77 ms``Execution: Empty`
- PostgreSQL bad SQLTTY 脚本日志 `/tmp/dbtool-tui-postgres-bad-sql.log` 已直接观察到 `bad_syntax.sql``Query error``query failed: syntax error ...`
- MySQL empty schemaTTY 脚本日志 `/tmp/dbtool-tui-mysql-empty-schema.log` 已直接观察到 `Schema dbtool_demo is empty. Schema dbtool_demo has no tables or views in the current target.`
- MySQL browse-stability`28x100` TTY 脚本日志 `/tmp/dbtool-tui-mysql-browse-stability.log` 已直接观察到 `4 rows returned in 2 ms``Result columns paged to 2-5 of 6` 与结果行浏览更新
- PostgreSQL restricted-schema probe2026-03-31 当前 runner 已直接复验 `/tmp/cmp64-role-probe-v4.json``/tmp/cmp64-postgres-root-inspect-v4.json``/tmp/cmp64-postgres-restricted-schema-inspect-v4.stderr.txt``/tmp/cmp64-postgres-restricted-query-v4.stderr.txt``/tmp/cmp64-tui-restricted-live-v6.log`;证据显示 `dbtool` 为非 superuser、root inspect 保留 `restricted_probe`、显式 inspect 返回 restricted inspect error、直接 query 返回 permission denied且 release TUI log 已直接显示 `Schema Browser` / `Inspector` / `Status & Activity` / query-blocking copy 的 restricted 文案
## 当前不应误判为已通过的能力
- [x] 真实 shared app 连接切换
- [ ] 真实 inspect / schema browser
- [x] 真实 inspect / schema browser
- [x] 真实 query 执行
- [ ] 真实 empty / error 结果处理
- [x] 真实 empty / error 结果处理
- [x] 真实 export 反馈
- [ ] TUI 连接管理的真实 TTY 直证
- [ ] 连接测试后立即保存并激活自定义 profile 的 QA 直证
- [ ] session-only secret 输入 / 复用的 QA 直证
- [ ] 无需预设 host override 即可完成 PostgreSQL / MySQL 自定义配置
- [ ] TUI CI smoke
- [ ] TUI release artifact smoke