Skip to content

Fix MySQL JSON-column guard dropping flow.Interrupt payloads

Choose a tag to compare

@bw19 bw19 released this 14 Jun 00:39
· 723 commits to main since this release
handleInterrupt writes the interrupt payload to the leaf and its surgraph-chain
ancestors guarded by `AND interrupt_payload='{}'` (first-writer-wins, so a
concurrent fan-out interrupt does not clobber a payload already set on a shared
ancestor). On MySQL the `interrupt_payload` column is JSON-typed, and a JSON
column does not match a bare string literal with `=`: `json_col = '{}'` returns
zero rows. So the payload write matched nothing and Snapshot/Await returned an
empty InterruptPayload. Verified against MySQL 8: `WHERE p='{}'` matches 0 rows
while `CAST(p AS CHAR)='{}'` matches the default.

The predicate matches fine on SQLite (TEXT), Postgres (JSONB casts the literal),
and SQL Server (NVARCHAR), so this surfaced only once the MySQL pipeline started
running the suite (the migration fix unblocked it). Branch the guard on
db.DriverName() to use CAST(interrupt_payload AS CHAR)='{}' for MySQL; other
dialects keep the literal. Document the JSON-vs-string comparison gotcha under
"MySQL Column Defaults".

Fixes TestInterruptpayloadflow and TestSubgraphinterruptflow on MySQL; full
fixtures suite now passes against MySQL 8 and SQLite.