fw-01 step 02 — Feel the bugs, then add the guards
Goal
Each stage-4 test corresponds to a real defence in Redux. Reproduce the bug first; only then write the guard.
Tasks
- Dispatch inside a reducer. Reproduce it. Observe that nothing throws and the result depends
on ordering. Then add
isDispatching. - Unsubscribe during notification. Build the version that iterates the live array with an index and splices on unsubscribe. Watch a listener get skipped. Then snapshot the list — and note that Redux's documented semantic is that a listener unsubscribed mid-dispatch is still called that time.
- Mutating reducer + memoised selector. Reproduce a stale UI with no error. This is stage 5, which passes when the bug is present: read it, do not fix it in the store.
- Middleware re-entrancy. Dispatch synchronously from within middleware; find the loop.
- Re-run the spec; 15/15.
Done when
- Every stage-4 bug reproduced before its guard was written
- 15/15 passing
- For each guard, you can name what makes the bug silent