Repository navigation
statecharts-2.0.4
Six findings from the second deep review
Each fix has a regression test in `persistence/jdbc/regression_test.clj` (findings #A–#F).
P1 — correctness
- FIFO per session — `receive-events!` re-sorts the claimed rows by `(deliver_at, id)` in memory before dispatching. PostgreSQL does not preserve the subquery's `ORDER BY` through `UPDATE … RETURNING *`, so a single poll that claimed multiple ready events for the same session could deliver them out of order.
- Session-aware batch failure handling — `receive-events!` now blocks only the failed event's session for the rest of the batch (its remaining events are released for the next poll), while other sessions keep processing. Preserves per-session FIFO without letting a poison event starve the queue.
P2 — correctness/contract
- `queue-depth` with the `:session-id` filter now formats valid SQL (the previous HoneySQL predicate chain was malformed).
- Durable-job worker's `dispatch-terminal-event!` includes `:invoke-id` so `InvocationProcessor` finalize / autoforward machinery can match terminal events back to the ``.
- `DurableJobInvocationProcessor.start-invocation!` preserves keyword namespaces on the stored `job_type` (`:my.app/send-email` no longer collapses to `"send-email"`).
- JDBC event queue round-trips `:invoke-id` losslessly via `pr-str` / `edn/read-string`. `(name invoke-id)` threw on UUID/numeric IDs and stripped namespaces from keyword IDs.
Housekeeping
- Poison-event chaos test rewritten to assert the correct post-fix invariant (poison blocks its own session, other sessions unaffected).
- Concurrent-session contention test retry limits bumped to absorb real contention now that optimistic locking actually fires (follow-up from the 2.0.2 critical fix).
Tests
480 tests, 0 failures (6 new regression tests, bringing the regression_test.clj count to 13).