Files
Logan.LiandCursor 08696896f9 feat: harden local shell, SFTP, and desktop session reliability
Finder-launched terminals now inherit a login PATH so tools like ollama resolve, destructive SFTP/editor actions require confirmation, and terminal search plus window dragging work again. SSH forwards and RDP sessions keep listeners and survive reconnect without FastPath crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 16:08:11 +08:00

2.8 KiB
Raw Permalink Blame History

OpsXShell 测试计划

最后更新:2026-08-16
持续开发默认测试先行:先锁定失败用例或巡检,再改实现。门禁细节见 docs/testing-acceptance.md。

原则

  • 改 SSH / SFTP / 转发 / RDP / VNC 后,先跑 npm run test:patrol。
  • 渲染层只测 src/platform 契约与 UI 状态;真实 TCP/SSH 不进默认 Vitest。
  • 原生新 command 必须同步 src/desktop.d.ts、src/platform/*.ts、test/setup.ts,否则 typecheck:test 应失败。
  • 七语种 key 对齐是硬门槛:test/i18n/localeKeys.test.ts。
  • 没有签名凭据的构建测试不得断言「已公证」。

日常命令

npm run test:patrol          # 基础巡检(优先)
npm run acceptance:quick     # typecheck + 全量 Vitest + Rust fmt/check
npm run acceptance:full      # 发包:再加 lint、clippy -D warnings、Rust test、生产构建
./scripts/build.sh           # 当前平台安装包;内部会跑完整门禁

真实探针(需显式主机,默认 ignored):

OPSX_TEST_SSH_HOST=… OPSX_TEST_SSH_PORT=… OPSX_TEST_SSH_USER=… \
  cargo test --manifest-path src-tauri/Cargo.toml real_ssh_exec_and_sftp_probe -- --ignored --nocapture

自动化分层

层 路径 覆盖
巡检 test/patrol/ SSH 开终端、SFTP 双栏/拖拽/冲突、RDP·VNC 对话框、平台契约
单元 test/、src-tauri tests 转发规则、forwardIntent、resume 回写 tab、错误文案映射、隧道 orphan
门禁 scripts/acceptance.mjs ESLint、tsc、Vitest、rustfmt、clippy、cargo test
发布 scripts/build.sh、scripts/release.py --dry-run 产物、SHA-256;不自动宣称签名

下一任务对应的测试(先写再改)

  1. 断开原因
    keepalive 失败 → 事件/文案不是「用户关闭」。覆盖 sshDisconnect reason 与终端/SFTP 回收。

  2. SFTP 自动重连
    mock onConnectionClosed 后活跃 SFTP tab 有限次重连,并 loadRemoteDirectory(lastBrowsePath)。

  3. 远程文本冲突
    open 记 mtime;save 前 stat 变化 → 确认对话框;取消则不调用 write。

  4. 目录冲突文案
    同名目录覆盖 vs 跳过;断言文案含「合并/内部同名」,且七语种 key 存在。

  5. 远程 bind 展示
    请求 0.0.0.0 但运行态 bind 为 127.0.0.1 时,列表不得显示为全接口已开。

  6. RDP 缩放
    回归:K64 协商;DeactivateAll 后 pending 脏区被清空;解压失败不直接 Terminate。

发布门槛

  1. 本项对应测试或巡检通过。
  2. npm run acceptance:full 通过后再打安装包。
  3. 平台包必须在目标 OS 实机点开验证;macOS 不能替代 Windows。
  4. 无 APPLE_* / Authenticode 时,文档只写 ad-hoc / 未签名。