octopus-rpa-app-runner B-02 修复记录
原始文件:wecom_7ea3083a_octopus-rpa-app-runner_B02修复记录.md
octopus-rpa-app-runner B-02 修复记录
- 修复日期:2026-08-06(Asia/Shanghai)
- 修复目标:关闭最终验收报告 v2 的 B-02,消除 PowerShell 平行编排函数未接入生产路径
- 执行约束:全程未连接、启动、驱动或操作真实 Octopus RPA/UI
- 结论:B-02 已关闭;公开 launcher -> impl 的 direct、close、参数策略生产动作均调用同一可注入 Orchestration 核心
1. 根因
此前 OctopusRpaAppRunner.Orchestration.ps1 虽被 impl 加载,但仅由测试直接调用。公开 CLI 仍由 Invoke-DirectParameterRun、Invoke-CloseRunWindowAction 和 Invoke-RunParameterDialogIfPresent 各自执行内联编排,因此测试覆盖的是平行状态机,而不是公开生产调用链。
2. 修复
- 保留公开 launcher、参数、输出和退出码契约,不改变
OctopusRpaAppRunner.ps1 -> OctopusRpaAppRunner.impl.ps1入口。 Invoke-DirectParameterRun仅负责生产确认、adapter 构造和结果映射;确认后的快照复核与单次点击顺序委托给Invoke-OctopusDirectOrchestration。Invoke-CloseRunWindowAction仅负责生产确认、UI 原语 adapter 和结果映射;stop -> 重新枚举 -> close -> Studio/run-list 验证顺序委托给Invoke-OctopusCloseOrchestration。Invoke-RunParameterDialogIfPresent保留目录确认/创建这一生产前置策略,leave/direct/auto 的写入、回读、TOCTOU 和 submit 顺序委托给Invoke-OctopusParameterOrchestration。- Orchestration 返回补齐生产结果映射所需的
Found、StopClicked、WindowClosed、StudioRestored、RunListState和错误消息;不包含 UIAutomation 依赖。 - 原 direct/close/parameter 内联平行状态机已删除,未保留仅测试用编排副本。
- impl 测试门仅在
OCTOPUS_RUNNER_TEST_MODE=1时调用注入入口;正常生产调用不受影响。
3. 生产路径证据
当前 impl 中存在且仅由生产 wrapper 调用的委托点:
Invoke-DirectParameterRun -> Invoke-OctopusDirectOrchestrationInvoke-CloseRunWindowAction -> Invoke-OctopusCloseOrchestrationInvoke-RunParameterDialogIfPresent -> Invoke-OctopusParameterOrchestration
行为 harness 不再单独 dot-source 编排文件,而是加载 OctopusRpaAppRunner.impl.ps1,通过 impl 的测试 dispatch 执行。它验证:
- 三个生产 wrapper 的函数体均调用对应 Orchestration 函数;
- Orchestration 命令身份来自生产
OctopusRpaAppRunner.Orchestration.ps1; - direct 行为经生产
Invoke-DirectParameterRunwrapper 执行; - close/parameter 使用生产 wrapper 所调用的同一函数对象和注入接口;
- 输出包含路径证据
launcher-impl-production-wrappers-shared-orchestration。
4. 行为测试
PowerShell 行为测试 16/16 通过:
- impl 已加载生产 Orchestration 函数身份;
- direct wrapper 委托共享核心;
- close wrapper 委托共享核心;
- parameter wrapper 委托共享核心;
- direct 缺授权零副作用;
- direct 确认后窗口替换零点击;
- direct 复核后仅点击一次;
- close 缺授权零 stop/close;
- stop effect unknown 不 close;
- stop 后旧 handle 消失不 close;
- stop 后替换窗口不 close;
- stop -> close 严格有序,active 不 verified;
- parameter leave 零副作用;
- integrated direct 只 submit、不 write;
- auto 回读失败不 submit;
- auto 写后 TOCTOU 不 submit。
5. 验证结果
| 检查 | 结果 |
|---|---|
| 全量 Python unittest(含 PS harness 聚合) | 73/73 通过 |
| PowerShell 生产调用链行为测试 | 16/16 通过 |
tests_static.py | STATIC_TESTS_PASSED |
Python 编译(排除 .venv) | 13/13 通过 |
| PowerShell AST | 4/4 通过 |
| launcher 安全黑盒 | 4/4 通过 |
| config 不落盘 | 根目录与 scripts/ 均不存在 config.json |
| 真实 RPA/UI | 未执行 |
launcher 黑盒明细:
| 场景 | exit | ERROR_CODE | 单一 JSON | changed |
|---|---|---|---|---|
| 未知参数 | 3 | ARG_CONFLICT | 是 | false |
空 -RunExactName | 3 | ARG_REQUIRED | 是 | false |
-ListOnly + -CheckRunList | 3 | ARG_CONFLICT | 是 | false |
-ProcessSnapshot | 3 | UNSUPPORTED_IN_FALLBACK | 是 | false |
6. 修改文件
skills/octopus-rpa-app-runner/scripts/OctopusRpaAppRunner.impl.ps1skills/octopus-rpa-app-runner/scripts/OctopusRpaAppRunner.Orchestration.ps1skills/octopus-rpa-app-runner/tests/powershell_orchestration_tests.ps1skills/octopus-rpa-app-runner/tests/test_round4_regressions.pyskills/octopus-rpa-app-runner/tests/test_round5_regressions.pyoctopus-rpa-app-runner_B02修复记录.md
7. 判定
B-02 的原阻断事实已消除:生产与测试不再各自维护一套编排状态机。测试加载 impl 并验证生产 wrapper 委托关系,行为断言执行的是公开生产路径调用的同一 Orchestration 核心。CLI、结构化输出、确认边界、fail-closed 语义和 config 不落盘保持兼容。