Skip to content

statecharts-2.0.6

Choose a tag to compare

@yenda yenda released this 24 Apr 09:14
· 5 commits to main since this release
6dbd4f4

Five correctness fixes on invoke-id handling and the JDBC event loop

Regression tests for all five in `persistence/jdbc/regression_test.clj` — findings #G–#K.

P1 — correctness

  • `job_store/invokeid->str` no longer corrupts non-keyword invoke-ids. `(subs (str invokeid) 1)` was only correct for keywords; for string/UUID/number invoke-ids (all valid `::sc/id` shapes reachable via `idlocation`) it silently stripped the first character (`"report"` → `"eport"`, `42` → `"2"`), and the worker then built `done.invoke.` / `error.invoke.` from the corrupted value.
  • `datasource-closed?` now only uses `isClosed()`. The 2.0.2 `getConnection` probe couldn't distinguish transient outages from permanent shutdown; a transient DB blip on a non-Hikari DataSource flipped `running=false` and stopped the event loop forever. DataSources without `isClosed()` return `false` — operators call `(:stop! loop-handle)` explicitly.

P2 — correctness/contract

  • `durable-job/invoke-data-keys` dispatches on id shape. `(name x)` only accepts keyword/string/symbol — UUID/number invoke-ids crashed `start-invocation!` AFTER `create-job!` had already inserted a pending row, leaving orphans.
  • `invocation/future` attaches `:invoke-id` to both done and error sends so `handle-external-invocations!` runs `finalize`/`autoforward` against the right `` in all cases.
  • `start-event-loop!` returns `:env` so `send!` can auto-wake the loop. `env-with-signal` was previously trapped in the closure — callers holding the original env saw `::wake-signal=nil` and events waited up to `poll-interval-ms`.

Tests

485 tests, 2212 assertions, 0 failures.