Commit Graph
9 Commits
Author SHA1 Message Date
Qiu Yuzhou 7951d5aa65 feat(ng2): add proxy control workflow as unified UI seam
Issue #47: application-layer ProxyControlWorkflow wrapping the existing
ProxyRuntimeController with a whole-published ProxyControlSnapshot (typed
runtime facts, current mode, available modes, active-target facts with
safe path summary, skipped-invalid-server count, HTTP export capability)
and typed async commands (enable/disable/mode) that republish the full
snapshot on completion. Production runtime adapter delegates to the
controller without duplicating generation, health gating or system-proxy
ownership; catalog target facts arrive through a narrow seam
(CatalogTreeSnapshot.pathSummary) that never exposes the tree.

Status menu now reads runtime state and issues proxy commands only via
the workflow snapshot; catalog tree, activation and subscription actions
stay on CatalogWorkflow. MainApp wires the production adapters once as
composition root. No change to persistence order, failure taxonomy,
mode-availability policy (#46), catalog commit sync (#40), settings
(#44) or diagnostics (#43) seams.

Tests: fake-adapter snapshot/command/boundary contract tests plus
real-controller integration matrix (enable failures, approval, system
proxy, mode persistence failure and no-op) and an integration-level
status-menu model test proving the menu derives everything from the
workflow. Unavailable-mode no-op and runtime-stop-failure items of the
spec matrix are vacuous after ADR-0007 (no constructible unavailable
ProxyMode; controller stop path has no distinct failure category).
2026-09-23 20:54:08 +08:00
Qiu Yuzhou 6c98930999 refactor(ng2): unify runtime facts and proxy mode availability 2026-09-23 11:48:13 +08:00
Qiu Yuzhou fe4c3e166e refactor(ng2): centralize typed failure presentation 2026-09-23 10:51:26 +08:00
Qiu Yuzhou 3df1624d91 refactor(ng2): add settings workflow module as single UI-facing seam
建立设置工作流深 module(App/SettingsWorkflow/),把设置编辑的编排从视图
收拢到一个 seam,镜像 #41 的目录工作流模式:

- UI-facing interface:可编辑 draft 投影(binding 直连)、占用/校验/门禁/
  保存中/待确认 PAC 失效提示/错误等只读投影,与 suggestPort、save、
  confirmPACNotice、cancelPACNotice、reset、reloadFromCommitted 等 typed
  command;登录启动项是独立偏好域(ADR-0005),视图直连其控制器,不经本
  module。
- implementation(灰置):端口占用探测的 Task.detached 编排(代际去竞态)、
  保存门禁(validationErrors+占用)、「当前运行端口」例外、PAC 失效确认
  流、重置事务与 ProxySettingsStoreError 文案映射。
- isOn 判定从 StatusMenuModel 迁至 ProxyRuntimeController.ProxyState 扩展,
  菜单摘要与设置工作流共用同一事实来源;设置视图不再持有
  ProxyRuntimeController 与探测缝,组合根在 MainApp 接线一次,设置窗口
  scene 的显式触达路径不变。

测试:设置编辑 workflow 不经 SwiftUI 即可全测——占用反应与门禁阻塞、
运行端口例外放行、PAC 失效确认/取消、校验阻塞、提交失败保留旧值并点名、
重置回出厂、建议端口只写草稿(8 项;全量 376 项通过)。

Out of scope:设置视觉重设计、ProxyRuntimeController 拆分、独立编译
target。
2026-09-22 17:36:40 +08:00
Qiu Yuzhou 3dc6043dc6 refactor(ng2): remove system-level shortcuts
Keep proxy controls explicit and leave existing shortcut preferences untouched.
2026-09-22 16:16:58 +08:00
Qiu Yuzhou 2fe401cd50 feat(ng2): add catalog workflow module as single UI-facing seam (#41)
建立目录工作流深 module(App/CatalogWorkflow/),收窄主窗口与配置 UI 对
配置目录、凭据存储、订阅快照、Legacy 导入与运行时收敛的访问:

- UI-facing interface:非敏感树/编辑面/订阅 projection、opaque NodeID 查询、
  typed command(ServerEditDraft 等)、typed error 与 structured outcome
  (BatchImportOutcome 逐行点名、RemovalOutcome selection invalidation);
  秘密值只在显式编辑/分享/订阅 URL 命令中出现。
- 服务器编辑:配置与凭据作为一个逻辑变更,CredentialWriteJournal 保证目录
  持久化失败时旧配置与旧凭据都保持有效(story 12/13,含测试)。
- 提交与收敛分离:目录提交成功与 runtimeSync 收敛阶段是独立观察面,运行时
  失败不回滚已提交目录(story 38/39,含测试)。
- 订阅:创建/刷新/换址/删除沿用原子快照、last-good 保留与凭据回滚;卡片
  projection 只含 host,结构化刷新状态由呈现层本地化。
- Legacy 导入端到端编排:不驱动运行时收敛、不自动重复、显式再导入创建独立
  分组;handoff 仍经组合根注入的独立边界。
- Deletion test:删除 CatalogViewModel/Types/+Subscriptions 旧 facade,全部
  视图与状态菜单迁移到新 seam;选择、pane、sheet、alert 状态收归 UI 持有
  (ErrorAlertPresenter)。导入失败行以行号点名,不再回显 ss:// 行内容。

测试经 module interface 观察(395 项全部通过):持久化失败凭据回滚、提交/
收敛阶段分离、收敛失败不回滚、导入不触发运行时等新增场景;既有 Domain、
协调器与运行时测试保持不变。

Out of scope(spec #41):设置编辑、ProxyRuntimeController、Legacy handoff、
新视觉设计、独立编译 target。
2026-09-22 11:39:07 +08:00
Qiu Yuzhou ea801d5f38 feat(catalog): remove node enable state
Migrate legacy enabled fields to v3 without preserving their semantics.
Keep recoverable invalid imports visible and filter them during activation.
2026-09-22 08:40:13 +08:00
Qiu Yuzhou 8ec4a57deb feat(ng2): import Legacy configuration (#36) 2026-09-21 11:27:05 +08:00
Qiu Yuzhou c3a9f62216 feat(ng2): menu bar quick actions and global shortcuts (#31)
Status menu rebuilt around the D11 eight-item whitelist: header summary
(running status, mode, active target path), proxy toggle, mode picker with
checkmark, read-only active-target cascade over the catalog tree, update
all subscriptions, copy HTTP export line, open main window, and quit that
states the proxy keeps running in the background. Out-of-whitelist items
(copy PAC URL) removed. Two global shortcuts (KeyboardShortcuts 3.1.0)
toggle the proxy and cycle modes through the same controller entry points
as the menu.

Presentation logic extracted to StatusMenuModel (state summary mapping,
HTTP export line, mode cycle, read-only target tree) with unit tests;
activeTargetID is now published so the menu stays live when activation
happens while the proxy is off.
2026-09-21 07:39:22 +08:00