test(app_controller): offloading - verify Result unwrap in success and error paths

Adds 2 tests to tests/test_app_controller_offloading.py covering the
fix from commit 26e57577:

1. test_offload_entry_payload_tool_call_unwraps_result
   - Confirms _on_comms_entry with kind=tool_call produces a [REF:script_NNNN.ps1]
     reference in payload['script'] and the offloaded file exists with the
     original script content. This is the canonical happy path that exercises
     the unwrap ref_result.ok + ref_result.data branch.

2. test_offload_entry_payload_preserves_script_on_log_tool_call_error
   - Mocks session_logger.log_tool_call to return Result(errors=[...]) and
     asserts that payload['script'] is preserved unchanged AND a debug log
     is emitted via caplog. This is the failure-path that exercises the
     ref_result.errors branch with logging.debug per Heuristic #19.

Both tests use the existing tmp_session_dir and app_controller fixtures
from test_app_controller_offloading.py. The Result / ErrorInfo / ErrorKind
imports are added to the test file's import block.

Refs: 26e57577 (Task 1.3 fix)
Refs: spec.md FR5
This commit is contained in:
ed
2026-06-18 19:33:10 -04:00
parent e8a4ede534
commit 4b07e9341c
2 changed files with 103 additions and 22 deletions
@@ -28,7 +28,7 @@ phase_5 = { status = "pending", checkpointsha = "", name = "Verify, document, en
t1_1 = { status = "pending", commit_sha = "", description = "Create sub-track folder (spec.md exists; plan.md, metadata.json, state.toml)" }
t1_2 = { status = "pending", commit_sha = "", description = "Update conductor/tracks.md with the new sub-track row" }
t1_3 = { status = "completed", commit_sha = "", description = "Fix _offload_entry_payload call site in src/app_controller.py:3709-3725 (unwrap Result from log_tool_call; log_tool_output already returns Optional[str])" }
t1_4 = { status = "pending", commit_sha = "", description = "Add 2 unwrap-path tests in tests/test_app_controller_offloading.py" }
t1_4 = { status = "completed", commit_sha = "", description = "Add 2 unwrap-path tests in tests/test_app_controller_offloading.py (test_offload_entry_payload_tool_call_unwraps_result + test_offload_entry_payload_preserves_script_on_log_tool_call_error)" }
t1_5 = { status = "pending", commit_sha = "", description = "Run targeted regression test (test_tool_ask_approval + test_execution_sim_live); verify both pass" }
t1_6 = { status = "pending", commit_sha = "", description = "Phase 1 checkpoint commit" }