test(control): adversarial restart replay invariants#187
Conversation
Add a strict restart replay suite for #169 that appends interleaved frontier, memory, task, critic, and worker events with duplicate idempotency keys, reopens the durable event log, replays projections from zero, and compares the replayed tail against BootContext projection cursors. Introduce guarded projection cursor advancement so stale or past-tail updates fail instead of silently blessing an unsafe replay position.
hadamrd
left a comment
There was a problem hiding this comment.
[sev2/tests] replay_projection is a new public function, but the tests only cover successful replay. Add an adversarial test where projection.apply() raises partway through replay and assert the stored projection cursor remains at its original sequence; that exercises the helper's promised failure behavior instead of only the lower-level cursor guard.
| """Persist a cursor only when it is monotonic and within the log tail.""" | ||
| ... | ||
|
|
||
|
|
There was a problem hiding this comment.
[sev2/tests] replay_projection is a new public function, but the tests only cover successful replay. Add an adversarial test where projection.apply() raises partway through replay and assert the stored projection cursor remains at its original sequence; that exercises the helper's promised failure behavior instead of only the lower-level cursor guard.
hadamrd
left a comment
There was a problem hiding this comment.
Manifesto violations:
- [sev2] testing.md#TE-002 —
def replay_projection( event_log: ProjectionEventLog, projection_name: str, projection: Projection, ) -> Pro→ Add a sad-path test forreplay_projectionusing a projection that raises duringapply, then assertadvance_projection_cursorwas not persisted and the original cursor is unchanged.
Fixes #169
Acceptance criteria
Test evidence
PYTHONPATH=/tmp/wt-loop-169/src pytest -q tests/test_control_restart_replay.py::TestControlRestartReplayInvariantsuv run ruff format --check src/forge_loop/eventlog/__init__.py src/forge_loop/eventlog/projections.py src/forge_loop/eventlog/sqlite.py src/forge_loop/eventlog/store.py tests/test_control_restart_replay.pyuv run ruff check src/forge_loop/eventlog/__init__.py src/forge_loop/eventlog/projections.py src/forge_loop/eventlog/sqlite.py src/forge_loop/eventlog/store.py tests/test_control_restart_replay.pyuv run mypy src/forge_loop/eventloguv run pyright src/forge_loop/eventlogNotes
mcp__lumen__semantic_searchwas unavailable.