Why
event-cleanup.test.tsx (#502) pins the subscription seam with a RouteProbe that mirrors the production subscription shape: removing the onCleanup wrappers from the real Session/Prompt routes would leave the test green, so it does not protect the actual change it was written for.
Scope
packages/tui/test/cli/tui/event-cleanup.test.tsx (plus the existing sync-fixture.tsx harness if it needs extension).
Approach
- Mount the REAL Session and Prompt route components inside the existing harness (per AGENTS.md TUI:
SyncProvider requires Exit/Args/KV/SDK/Project providers), count event-bus listeners around mount/unmount, and assert unmount returns the count to the pre-mount baseline.
- Keep the RouteProbe seam test as the context-level contract; the new tests are the production-shape protection.
Acceptance
- Temporarily removing an
onCleanup wrapper from routes/session/index.tsx or prompt/index.tsx makes the new test fail (verify locally, then restore); full TUI test suite green.
Why
event-cleanup.test.tsx(#502) pins the subscription seam with a RouteProbe that mirrors the production subscription shape: removing theonCleanupwrappers from the real Session/Prompt routes would leave the test green, so it does not protect the actual change it was written for.Scope
packages/tui/test/cli/tui/event-cleanup.test.tsx(plus the existingsync-fixture.tsxharness if it needs extension).Approach
SyncProviderrequires Exit/Args/KV/SDK/Project providers), count event-bus listeners around mount/unmount, and assert unmount returns the count to the pre-mount baseline.Acceptance
onCleanupwrapper fromroutes/session/index.tsxorprompt/index.tsxmakes the new test fail (verify locally, then restore); full TUI test suite green.