MechaCat02
05373814b2
fix(stateful-templates): serialize the materialization reconciler (review)
...
The reconciler read `should` and `existing` in separate statements under READ
COMMITTED, and its queue one-consumer check wasn't locked — so two concurrent
reconcilers (e.g. two parallel app-creates) could (a) spuriously DELETE a valid
materialized cron copy when one committed a copy between the other's two reads
(a lost copy self-healing only on the next mutation), or (b) both pass the
queue slot check and double-fill a consumer slot. Take a fixed xact-scoped
advisory lock (REMATERIALIZE_LOCK_KEY) at the top of the reconcile so each pass
is atomic w.r.t. the others. Reconciles are infrequent + fast, so serializing
is cheap; the ON CONFLICT guard stays as defense in depth.
Found by the M5 review. Pinned by the existing stateful_templates test + the
full journey suite (which previously flaked on the race).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-07-02 20:06:11 +02:00
..
2026-06-01 21:46:45 +02:00
2026-05-25 19:30:25 +02:00
2026-05-27 19:27:52 +02:00
2026-06-12 18:12:54 +02:00
2026-05-26 22:21:37 +02:00
2026-06-12 18:12:54 +02:00
2026-06-25 20:10:20 +02:00
2026-07-01 19:32:20 +02:00
2026-05-25 21:03:05 +02:00
2026-05-27 22:00:04 +02:00
2026-06-24 19:59:00 +02:00
2026-06-24 19:59:00 +02:00
2026-06-12 17:15:09 +02:00
2026-06-06 12:10:32 +02:00
2026-06-06 18:03:51 +02:00
2026-06-07 20:50:25 +02:00
2026-06-07 20:09:31 +02:00
2026-06-05 23:17:24 +02:00
2026-06-06 12:04:09 +02:00
2026-07-01 20:16:22 +02:00
2026-07-01 21:47:27 +02:00
2026-07-01 21:47:27 +02:00
2026-06-12 18:37:34 +02:00
2026-05-27 19:27:52 +02:00
2026-06-12 19:08:31 +02:00
2026-06-05 23:15:47 +02:00
2026-06-30 19:38:46 +02:00
2026-06-24 22:00:32 +02:00
2026-06-26 07:07:04 +02:00
2026-07-01 21:34:14 +02:00
2026-06-01 21:46:45 +02:00
2026-06-01 22:17:25 +02:00
2026-06-09 18:34:42 +02:00
2026-06-13 15:01:04 +02:00
2026-06-26 07:17:33 +02:00
2026-06-02 19:55:14 +02:00
2026-06-30 07:33:39 +02:00
2026-06-10 21:22:15 +02:00
2026-06-12 18:38:28 +02:00
2026-06-24 19:06:52 +02:00
2026-06-29 20:31:14 +02:00
2026-06-12 18:38:28 +02:00
2026-06-30 19:46:39 +02:00
2026-06-11 20:24:55 +02:00
2026-06-30 20:04:09 +02:00
2026-06-06 15:02:21 +02:00
2026-07-01 21:22:07 +02:00
2026-06-30 19:19:48 +02:00
2026-07-01 21:17:12 +02:00
2026-07-01 21:17:12 +02:00
2026-07-01 21:17:12 +02:00
2026-07-01 21:17:12 +02:00
2026-07-01 21:17:12 +02:00
2026-07-01 21:17:12 +02:00
2026-06-24 19:59:00 +02:00
2026-07-01 21:17:12 +02:00
2026-06-24 19:59:00 +02:00
2026-06-29 19:32:34 +02:00
2026-07-01 21:47:27 +02:00
2026-06-10 21:03:10 +02:00
2026-06-26 07:17:33 +02:00
2026-06-13 15:01:04 +02:00
2026-06-01 21:29:59 +02:00
2026-06-10 21:22:15 +02:00
2026-07-01 21:47:27 +02:00
2026-06-13 15:01:04 +02:00
2026-06-11 20:42:51 +02:00
2026-07-02 20:06:11 +02:00
2026-05-23 00:31:08 +02:00
2026-06-29 20:07:59 +02:00
2026-07-01 20:33:09 +02:00
2026-06-06 19:08:21 +02:00
2026-06-01 22:01:42 +02:00
2026-07-01 07:39:06 +02:00
2026-06-07 20:00:36 +02:00
2026-06-07 20:16:33 +02:00
2026-06-07 20:00:36 +02:00
2026-06-09 20:03:10 +02:00
2026-06-12 20:43:18 +02:00
2026-06-25 21:11:59 +02:00
2026-07-01 19:34:22 +02:00
2026-07-01 20:07:06 +02:00
2026-05-23 16:26:12 +02:00
2026-05-22 23:16:32 +02:00
2026-06-24 22:00:32 +02:00
2026-06-24 22:13:00 +02:00
2026-06-24 21:48:33 +02:00
2026-06-03 20:23:18 +02:00
2026-07-01 20:04:32 +02:00
2026-06-06 15:00:47 +02:00
2026-06-24 19:59:00 +02:00
2026-06-06 19:08:21 +02:00
2026-07-01 21:34:14 +02:00
2026-07-01 20:55:49 +02:00
2026-06-07 20:50:25 +02:00
2026-06-13 09:59:24 +02:00
2026-06-24 21:11:46 +02:00
2026-06-24 21:11:46 +02:00
2026-06-24 20:59:23 +02:00