Skip to content

fix: ClusterCron InitialRun messages are deduplicated on pod restart, breaking cron chain #5960 - #5

Draft
Smerly wants to merge 7 commits into
mainfrom
deduped-messages
Draft

Smerly wants to merge 7 commits into
mainfrom
deduped-messages

Conversation

@Smerly

@Smerly Smerly commented Feb 19, 2026 •

Copy link
Copy Markdown
Owner

Fixes Effect-TS/effect#5960

Fixes #6

With SQL message storage and calculateNextRunFromPrevious: true, ClusterCron stops running after a pod restart. InitialRun sends a message with a fixed entity id and empty primary key, so the same message_id is used every time. SQL storage deduplicates on message_id and ignores the duplicate on restart, so the cron chain never picks up again.
This change makes the InitialRun message use a unique message_id on each start so it’s no longer treated as a duplicate after restart.
Added a test that runs the cluster twice against the same SQLite DB (simulating a restart) and checks that the second run still executes the cron at least once. Also fixed the pg/mysql test fixtures (proper re-exports) and tightened SqlMessageStorage tests (truncate + outcome-based duplicate assertion).

SqlMessageStorage / SqlRunnerStorage: Only the sqlite dialect runs in this package; pg/mysql are skipped here to avoid cross-package test deps and dialect flakiness (they’re covered in their own packages). Short comments in both files explain this.
Fixtures: Removed test/fixtures/utils-mysql.ts and utils-pg.ts; cluster tests no longer depend on other packages’ test utils.
tsconfig: Cluster tsconfig.test.json is back to include: ["test"] and rootDir: "test"] (no sibling package includes).
CI: Dropped the unused “Set cluster-only when only cluster package changed” step and the full clone (fetch-depth: 0); Test job uses the default checkout again.
ClusterWorkflowEngine: Two tests that were hitting the 5s default timeout now use a 15s timeout so they pass reliably.
Types: Dialect layers use inferred types (as const) instead of a forced Layer<unknown, ...> so tsc -b passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant