Mentor ACP test-harness hardening: cancel-acknowledging fake + deferred teardown #124

Closed
opened 2026-10-20 12:49:22 +02:00 by AlexKucera · 0 comments
Owner

What to build

Two hardening pieces for the mentor's ACP test harness, deferred from the #24 close-out audit:

  1. A cancel-acknowledging fake engine mode. The fake currently ignores the session/cancel notification, so tests that cancel a turn only observe the outcome through teardown — the pass bar's Cancel rail is covered in aggregate (fire-and-forget pin + cancelled-doesn't-advance pin) but never individually discriminated. The new mode answers its hanging session/prompt with stopReason "cancelled" the moment the cancel notification arrives, mirroring the real engine's contract.

  2. Deferred teardown as the harness convention. Tests that spawn the fake engine and poll with throwing sleeps call shutdown at the end of the happy path — a cancelled or interrupted test skips it and leaks a sleeping fake process for its hang window (30 s, self-healing). Teardown moves into a defer right after the rig is built, so the child dies with the test no matter how it exits.

Scope: the ACP fake harness and the pass-run suite. The provisioning fakes are short-lived and unaffected.

Acceptance criteria

  • New fake mode: session/cancel on a hanging session/prompt answers the prompt with stopReason "cancelled"
  • The pass bar's Cancel rail is individually pinned — cancelling a held pass ends the turn cancelled with no state advance; the pin fails if the Cancel handler's body is emptied
  • Every fake-spawning test in scope tears down via defer at rig creation — cancellation mid-poll cannot leak the child past test end
  • Full suite green; lint/format clean on touched files

Blocked by

  • None (can start immediately).

[Generated by AI]

## What to build Two hardening pieces for the mentor's ACP test harness, deferred from the #24 close-out audit: 1. **A cancel-acknowledging fake engine mode.** The fake currently ignores the session/cancel notification, so tests that cancel a turn only observe the outcome through teardown — the pass bar's Cancel rail is covered in aggregate (fire-and-forget pin + cancelled-doesn't-advance pin) but never individually discriminated. The new mode answers its hanging session/prompt with stopReason "cancelled" the moment the cancel notification arrives, mirroring the real engine's contract. 2. **Deferred teardown as the harness convention.** Tests that spawn the fake engine and poll with throwing sleeps call shutdown at the end of the happy path — a cancelled or interrupted test skips it and leaks a sleeping fake process for its hang window (30 s, self-healing). Teardown moves into a defer right after the rig is built, so the child dies with the test no matter how it exits. Scope: the ACP fake harness and the pass-run suite. The provisioning fakes are short-lived and unaffected. ## Acceptance criteria - [ ] New fake mode: session/cancel on a hanging session/prompt answers the prompt with stopReason "cancelled" - [ ] The pass bar's Cancel rail is individually pinned — cancelling a held pass ends the turn cancelled with no state advance; the pin fails if the Cancel handler's body is emptied - [ ] Every fake-spawning test in scope tears down via defer at rig creation — cancellation mid-poll cannot leak the child past test end - [ ] Full suite green; lint/format clean on touched files ## Blocked by - None (can start immediately). [Generated by AI]
AlexKucera added the ready-for-agent label 2026-10-20 12:49:22 +02:00
Sign in to join this conversation.