Files

123 lines
17 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
> 2026-11-12 集群验证结果见 [cluster.md](cluster.md):公网 P2P、双节点真机回退、Go race、Rust 测试及桌面真机投屏均已验证。以下保留早期单中继检查记录。
# Verification record
Validated on Windows x64 during implementation:
- `go test ./...`: role authentication, offline devices, duplicate registration, exclusive leases, ticket ownership and replay rejection, bidirectional bytes, stream cancellation, agent disconnect cleanup.
- `go vet ./...`: passed.
- `cargo test --workspace --locked`: configuration validation and ADB smart socket handshake with fragmented replies.
- `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed.
- Release builds: Go relay and both Rust executables built successfully.
- `python tests/e2e.py` against the release binaries: passed 2 MiB binary transfer, eight concurrent streams, an idle stream across control ping/pong, competing-client rejection, agent restart and relay restart recovery.
- Existing Python bridge unit tests: all three passed.
Read-only real-device smoke test:
- Remote ADB Server `192.168.5.222:5037` listed `192.168.100.141:5555` as online.
- Started a temporary relay and both Rust daemons, with the gateway using the existing remote ADB transport.
- Initial attempt reached the phone but returned `unauthorized`. After the user approved the local computer's key, the same test was rerun successfully.
- Ordinary local `adb devices -l` listed `127.0.0.1:51847` as `device`, with product `aosp_crosshatch` and model `AOSP_on_crosshatch`.
- Remote `adb shell getprop ro.product.model` returned `AOSP on crosshatch`; the read-only shell echo marker also matched. All three release programs were involved in the successful test.
- App installation, Android Studio and scrcpy have not yet been exercised through the new path.
- Temporary processes and local ADB endpoint were disconnected after the test; unrelated local ADB devices were preserved.
Public deployment follow-up:
- Linux amd64 server is now running on Debian 12 at `175.178.213.60`, as an enabled systemd service under a dedicated user.
- Existing Nginx proxies `https://ttstd.com/ads/` to loopback `127.0.0.1:18081`, stripping the prefix. Its existing root-domain certificate was verified without disabling certificate checks.
- A real public WSS smoke test passed: both Rust daemons connected to the public origin while keeping TLS SNI/hostname `ttstd.com`; ordinary local ADB listed `127.0.0.1:59671` as `device`, and both read-only shell commands passed.
- The initial public test used a temporary local gateway and the VPN-reachable remote ADB Server. Follow-up deployment now runs the actual gateway on the remote Windows PC; see the next section.
- Public Cloudflare DNS connectivity timed out from the current PC; the explicit origin-address option was used. No DNS records were changed.
- macOS runtime and Linux Rust daemon hosting remain untested. See `deployment-ttstd.md` for deployed configuration and certificate expiry.
Remote Windows gateway follow-up:
- Installed release `ads-agent.exe` on `192.168.5.222`, under `C:\Users\TT\AppData\Local\AndroidDeviceStreaming\agent`. Remote SHA256 matched the local release artifact.
- Created an ACL-protected credential directory and registered `ADS-Agent` as a hidden background task under `TT`, with password logon, startup/logon triggers and failure restart. No account password is written into source or deployment files.
- The gateway directly connects to phone `192.168.100.141:5555` and public relay origin `175.178.213.60:443`, retaining hostname `ttstd.com` and normal TLS checks.
- Ran `tests/real_device.py --existing-device home-phone`: only a local client was started; no local gateway and no remote ADB Server transport were used. Ordinary local ADB showed the phone as `device`, and model query plus shell marker passed.
- Restarted the remote task and repeated that test: passed again, with local endpoint `127.0.0.1:49832` and model `AOSP on crosshatch`.
- Remote gateway remains running. Temporary local smoke-test endpoints/processes were cleaned up. Startup trigger configuration was inspected without rebooting the PC. System VPN was not disabled; it was only needed for remote SSH management, not the tested ADB data path.
Desktop follow-up:
- Avalonia now defaults to `wss://ttstd.com/ads`, with explicit origin `175.178.213.60:443`. HTTPS catalog requests and the Rust child share the same prefix/origin configuration; neither disables TLS validation.
- Twelve .NET tests passed: URI prefix/port handling, invalid configuration, migration, role-token import, environment isolation and non-persistence, and rejection of an untrusted local TLS certificate even with an origin override.
- Official Avalonia headless tests loaded the real XAML and checked bindings/button state. Real live-device tests passed public catalog discovery, GUI command connect, ADB readiness, model/Android/API display, reconnect, disconnect and lease release.
- Official scrcpy 5.0.1 archive matched its published SHA-256. The desktop command started real public video streaming; scrcpy reported `Texture (D3D11VA): 944x1920`. Stop, reconnect and disconnect checks passed after that.
- Rendered normal and minimum-size layouts were inspected. No token was present in saved settings or UI logs. Windows self-contained publishing succeeded, excluding credentials.
- Native Windows UI automation could not initialize because its runtime reported a sandbox setup error. Tests were Avalonia headless plus real network/process/video operations; native mouse/keyboard, clipboard/file picker and tray behavior have not been automatically exercised in this run.
Port cleanup follow-up:
- Added the clear-port action to the connection card and local connection settings. Windows reads native IPv4/IPv6 TCP listener tables; non-Windows uses lsof when available.
- Cleanup rechecks port ownership and process creation time, terminates only the matching process (not its entire process tree), verifies the port can be bound, and removes the corresponding local ADB endpoint.
- Fifteen .NET tests passed, including actual disposable listener-process termination, unrelated-process survival, stale identity rejection, and protection for the current process / ADB main-service port.
- Avalonia headless test invoked the new command against a real child listener and verified both process exit and port release. Temporary listener children were cleaned up after testing.
### 2026-11-13:模拟器离线修复与桌面日志同步
- Flutter 本地滚动日志中 `phone-006f8b2ae57e` 持续掉线;远端 Agent 对 emulator-5556/5558 报 `cannot reach phone adbd`。三个模拟器的主机 5555/5557/5559 端口均可返回 ADB CNXN。
- `ads-core` 对 `emulator-N` 改用同一 ADB 主机的 N+1 原始 adbd 端口;实体手机继续原有 smart socket 选定 transport 后连接内部 TCP adbd。错误状态保存完整错误链。
- 修复后的 Agent 已部署 Ubuntu-224,备份保留在原二进制旁。`phone-a9bbc18df94c` 通过公网 relay-1 被本地 ADB 识别并执行 shell;原离线虚拟 USB `ADS-phone-006f8b2ae57e` 已恢复 device,shell getprop ro.product.model 成功。临时网络 ADB 测试连接已断开。
- Rust ads-core 6 项测试、Avalonia 22 项测试、Flutter 27 项测试通过,Flutter analyze 无问题。
- 两桌面端新增打开日志目录;Avalonia 同步电脑名、电脑排序、固定高度刷新指示与按天滚动日志。安装位置采用 TongTongStudio,保留既有私有配置和日志路径。
### 0.2.1 Windows DLL 精简发布
- Avalonia 根目录 DLL 从 211 降至 4:托管程序集使用 .NET bundle,保留 3 个原生图形/字体库与 Rust 工具必需的 vcruntime140.dll;没有启用反射裁剪或把 Rust、ADB、scrcpy 合并进主程序。
- Flutter 根目录 DLL 从 15 降至 6:保留引擎、4 个插件和 Rust 所需的 vcruntime140.dll;宿主、包装库及源码插件采用静态 MSVC CRT。PE 直接/延迟导入扫描按实际闭包补齐运行库,不再整目录复制 VC Redist。
- Avalonia 实际发布包 `--package-check` 成功创建窗口并退出,未读取正式凭据、未建立设备连接;Flutter 6 个根目录 DLL 可由 Windows 加载。Avalonia 22 项、Flutter 27 项测试通过。未在全新 Windows 虚拟机执行本轮完整安装回归。
- 新版 Windows Setup 安装包和 Linux amd64 Avalonia/Agent deb 均为 0.2.1,带 SHA256 校验。Linux deb 元数据已验证;Flutter Linux 宿主仍未实现,本轮未生成 Flutter Linux 包。
- DLL 数量指安装目录根目录;tools/scrcpy 自带库保持完整。打包减少散落 DLL,不承诺安装程序体积同步减小。
### 0.2.2:安装目录迁移后的工具启动修复
- 现场 settings.json 中 client、adb、scrcpy 三项仍为 Programs/TTSTD/ADS-Flutter,且三文件已不存在;当前 TongTongStudio 安装目录中的工具存在,ads-client --version 与 adb version 可运行。已备份现场配置后修复三项路径,其他设置和凭据保持不变;已运行的旧 UI 需重启才能重新读取设置。
- Flutter 新增 ToolPaths:启动及连接前解析、持久化当前工具位置,优先当前安装包,保留有效自定义工具。缺失工具在分配端口和建立租约之前报出修复方法,避免底层 ProcessException。投屏也解析 scrcpy/ADB 及工作目录。
- Avalonia 同步旧路径回退、启动迁移及保存。Flutter 32 项测试、Dart 静态分析、Avalonia 24 项测试通过,实际发布包窗口启动检查 PACKAGE_CHECK_OK。并行编译压力下一次端口测试超时,完整复跑 24 项均通过。
### 0.2.3:Avalonia Semi 主题与 UTF-8 日志
- 现场日志出现“鍦ㄥ叾…”等 UTF-8 字节被按 Windows 本地编码解释后的乱码。ProcessTools 对 stdout/stderr 显式使用 UTF-8,覆盖同步命令与流式日志;本机 Agent 管理 JSON stdin 同步 UTF-8,非重定向后台启动清空输出编码选项。
- 锁定 Semi.Avalonia 11.3.7.3,与当前 Avalonia 11.3.8 兼容。设备、Agent 管理、设置、日志及 Agent 托盘统一使用 Semi 资源;新增 WorkbenchStyles.axaml,替换硬编码深色配色,使用左侧导航和明暗主题开关。
- 27 项 Avalonia 测试通过,包含中文及 emoji stdout/stderr、流式日志和中文 JSON 输入。离屏渲染四个页面的浅色/深色和 980×700 最小窗口共 10 张 PNG 并检查截图;实际 Windows 发布包 PACKAGE_CHECK_OK,PE 运行库检查通过。
- Windows 安装器为 0.2.3;Linux 发布同版本 Avalonia/Agent deb。历史乱码日志不改写;安装新版本并重启后,新日志按 UTF-8 正常显示。尚未在本轮执行干净虚拟机完整安装/卸载和 Linux GUI 实机回归。
### 0.2.4:Linux deb 公共 CLI 入口
- Avalonia 桌面包通过 postinst 注册 `/usr/bin/adsctl`、`ads-agent`、`ads-client`、`ads-usb`,由 update-alternatives 链接至 `/opt/ttstd/ads-avalonia/`;Agent 包为其自带的两个 CLI 注册独立提供者。无直接重复拥有的公共命令文件。
- 优先级为 Agent 80、Avalonia 60、Flutter 50;保留手动 alternatives 选择及既有同名普通文件。prerm/postrm 撤销当前包,剩余包自动回退,最后一个提供者移除后清理公共及 alternatives 链接。
- 文件触发器处理 0.2.3 旧 Agent 包直接拥有两个 /usr/bin 命令的过渡:升级或移除旧包后,剩余桌面提供者重新注册。不会自动启动/重启 Agent 或删除用户配置。
- 6 项隔离 dpkg 生命周期测试通过,覆盖共存、重装、手动选择、桌面切换、旧 Agent 升级/移除、普通文件保护和正式 0.2.4 deb。真实包安装后四个原生工具的 --version 均为 0.2.4,移除 Agent 后均回退桌面路径。测试使用临时根和 alternatives 守卫,不修改宿主 /usr/bin;GUI 依赖在临时根用 force-depends 跳过,真实系统仍应使用 apt 正常解析依赖。
### 0.2.5:Flutter Linux 原生 deb
- 新增 Linux GTK 宿主、Linux 原生构建脚本及 deb 入口。SDK 为 Flutter 3.50.0 / Dart 3.14.0,Linux SDK 归档按官方发布清单 SHA256 校验;Ubuntu 24.04 原生编译,未使用 Windows bundle 冒充 Linux 程序。
- Linux 配置使用 XDG_CONFIG_HOME/ads-flutter,日志使用 XDG_STATE_HOME/ads-flutter/logs,缺省分别为 ~/.config 与 ~/.local/state;Windows 原有设置位置保留。托盘使用 PNG,Linux 文件选择不过滤为 .exe。
- Linux 投屏使用独立窗口,Windows 内嵌及 USB 驱动 UI 禁用;运行时模型也防止错误开启。Linux 正常关闭窗口退出,避免没有托盘扩展时程序隐藏后无法恢复;已规避旧窗口插件销毁 Linux implicit view 的退出警告。
- Linux 和 Windows 各 35 项 Flutter 测试通过,双平台静态分析无问题;真实 Ubuntu 桌面临时单元执行 --package-check 输出 ADS_FLUTTER_PACKAGE_OK,状态 0,不读取真实配置、凭据或建立设备连接。
- Linux 包携带已验证的原生 ADB / scrcpy 5.0.1 完整发行资源及 LICENSE、Rust 四个 CLI 和应用菜单,检查 ELF 架构和动态库。六项隔离 dpkg 生命周期测试包含正式 Flutter deb、命令链接、CLI 版本和卸载回退。GUI 依赖由 apt 解析,完整 apt 仓库解析及 arm64 未在本轮实机验证。
最终正式包验证在 Ubuntu 24.04 的临时 dpkg 根完成:6 项全部通过,包含随包 ADB/scrcpy 执行和 CLI 版本;正式 deb 解包后以 TT 普通用户在桌面会话启动 --package-check,输出 ADS_FLUTTER_PACKAGE_OK,退出 0。包声明 glibc >=2.35;本地旧 WSL 的 glibc 低于要求,因此随包 scrcpy 的执行验证转到目标 Ubuntu 完成,未放宽测试断言。
### 0.2.6:Agent 持续监听 ADB 上下线
- 新增 `tests/agent_adb_presence.py`,通过真实控制中心、Agent、客户端及可控 ADB smart socket 验证缺失、未授权、离线、ADB 服务失败/恢复和慢查询超时。验证一台手机断开不会中断另一台手机数据流,离线旧流关闭,恢复后可重新转发。
- 验证同一 ADB server 共享查询、管理 IPC 在慢查询时仍响应、Agent PID 与配置保持不变、设备 ID 保持不变、手动停用不会被自动恢复。原管理集成测试通过。
- Agent 状态解析单元测试通过,Avalonia 30 项测试及 Flutter 37 项测试通过,Flutter 静态分析无问题。两套 UI 显示未就绪原因并避免本地残留通道显示旧的在线状态。
- 本机 local-pc 已从 0.2.4 更新到 0.2.6,原程序备份在忽略的 work 目录,配置哈希保持一致。实测 ADB 列表为空时,Agent connected=false 并显示“ADB 未发现该设备”,管理 IPC 持续可用;本轮未要求插拔真实手机,恢复路径由真实三端集成测试覆盖。
- 0.2.6 Windows Avalonia/Flutter Setup 与 Linux Agent/Avalonia/Flutter deb 已生成。Windows Avalonia 正式包启动检查通过;Linux Flutter 原生静态分析及 37 项测试通过,Linux Agent/Avalonia 正式 deb 的 6 项临时根安装/卸载测试通过。
- Ubuntu 24.04 对正式 Flutter/Agent deb 的 6 项隔离安装测试通过;正式 Flutter deb 解包后在真实桌面会话执行 --package-check,输出 ADS_FLUTTER_PACKAGE_OK 并退出 0。
### 0.2.7:可选真实 USB 自动注册
- Agent 配置新增默认关闭的 auto_register_usb、ignored_usb_serials 与 usb_device_ids。后台扫描仅允许回环 ADB server 的 device 状态与原生物理 USB 清单的交集,排除模拟器、网络设备和 ADS 虚拟 USB;已有同序列号配置优先,不覆盖手动 ID/停用状态。
- Windows PnP 查询实际运行通过;纯逻辑测试覆盖默认关闭、非物理来源排除、忽略、持久化 ID、停用、ADB 地址别名去重与非本机 ADB 排除。当前没有接入可用于插拔的新真实 USB 手机,因此尚未做真实新手机自动添加的插拔验收。
- 真实控制中心、Agent 和 CLI 集成测试验证开启/关闭、删除写入忽略、取消忽略与过期配置拒绝;原设备离线注销、恢复、管理 IPC、受监督重启、多设备流隔离测试仍通过。
- Flutter 38 项测试、静态分析,以及 Avalonia 30 项测试通过;Windows/Linux 管理界面均接入开启/关闭与取消忽略。策略操作使用配置比对,配置有并发修改时拒绝覆盖并提示刷新。
- 本机 local-pc 已更新到最终 0.2.7,确认 auto_register_usb=false,配置哈希未变;运行程序与两套 Windows 发行目录 Agent 的 SHA256 一致。正式发布二进制的策略/上下线集成测试通过,Avalonia 正式包启动检查通过。
- Windows 两套 Setup 与 Linux Agent/Avalonia/Flutter deb 已生成;Linux Agent/Avalonia 0.2.7 正式 deb 的 6 项临时根安装、版本和 CLI 链接回退测试通过。
- Ubuntu 24.04 的正式 Flutter/Agent deb 也通过 6 项隔离安装测试;解包后的 Flutter GUI 在真实桌面会话输出 ADS_FLUTTER_PACKAGE_OK,退出 0。