fix(FN-891): stabilize flaky restart integration test assertions

- Replace exact createKbAgent call-count assertions with behavioral checks (toHaveBeenCalled, toBeGreaterThanOrEqual) to avoid flakiness from retry-with-new-session internals
- Add resume log entry assertions as stable behavioral guarantees for restart semantics
- Add testing guidance section to README for writing deterministic executor tests
This commit is contained in:
gsxdsm
2026-04-04 20:47:03 -07:00
parent d4971c2d4a
commit c5d2a7e989
2 changed files with 22 additions and 4 deletions

View File

@@ -399,6 +399,12 @@ pnpm --filter @fusion/core build # Regenerate dist/
pnpm test # Verify downstream consumers
```
### Writing Deterministic Executor Tests
The `TaskExecutor` implements retry-with-new-agent-session behavior: when an agent session completes without calling `task_done()`, the executor automatically creates a new session and retries. Tests that are **not** specifically validating retry semantics should avoid asserting exact `createKbAgent` call counts, as the count varies depending on whether the retry path is triggered.
**Prefer behavioral assertions** — verify that tasks are dispatched for execution, resume log entries are written, error handlers fire, and semaphore slots are released. These guarantees are stable regardless of how many internal agent sessions are created.
## Dashboard Features
### Interactive Terminal