Add cluster integration test suite - #6800
Conversation
🦋 Changeset detectedLatest commit: 10f570f The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Cluster integration Vitest project: adds an opt-in
cluster-integrationproject gated behindEFFECT_CLUSTER_TESTS=1andisNode, with serial execution and a 60-second test timeout. - Test container global setup:
globalSetup.tsstarts onepostgres:alpineand onemysql:ltscontainer for the entire suite lifecycle and provides connection URIs viaproject.provide. - Cluster test harness (
harness.ts): a scoped multi-runner harness with in-process socket runners, freeze/kill lifecycle controls, deadline-based polling helpers (waitUntil,waitForStableAssignments), and SQL-backed storage assertions (messageCounts,repliedMessageCount,failedMessageCount). - Smoke test: starts a 3-runner cluster on both PostgreSQL and MySQL backends, verifies entity RPC delivery, freezes and kills the owning runner, then asserts rebalancing and message persistence.
- Manual CI workflow:
workflow_dispatch-only GitHub Actions job with Docker image pre-pulling andpnpm test-cluster. - Vitest config: extends the
projecthelper withprojectExclude/projectIncludeand excludestest/cluster-integration/**from all non-cluster projects.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
|
|
||
| const registrations = (yield* cluster.diagnostics()).registrations | ||
| assert.strictEqual(registrations.length, runners.length) | ||
| }).pipe(Effect.scoped)) |
There was a problem hiding this comment.
it.live scopes the effects for you, so this isn't needed
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Entity integration test suite: adds
Entity.test.tswith nine test cases covering entity state isolation and routing, mailbox saturation and idle entity revival, rebalancing across runner addition/graceful stop/abrupt death, row-lock and advisory-lock expiry modes, shard-group-targeted entity assignment, singleton migration on owner death, andEntityResourcepersistence across movement with explicit release. - Configurable shard groups and per-runner options:
harness.tsnow acceptsconfiginMakeOptionsandStartOptions(assignedShardGroups,runnerShardWeight) instart(), updatingrunnerConfigandmakeRunnerStorageper-runner so the shard-group and lock-mode tests can tune the cluster without affecting the default harness setup. - New harness helpers: exposes
clientSharding(the client-sideShardingservice),ownersOfShard(ShardId, includeInactive?)for direct ownership assertions on frozen/killed runners, andshardOfEntityas a factored-out alias used by bothownerOfEntityand the entity tests.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Entity.test.ts closing brace fix: restored the missing
})that closes the outerdescribeblock andforloop, fixing the unterminated module from commit 68e2521. - Persistence.test.ts: new test file with seven cases covering the persistence contract end-to-end on both PostgreSQL and MySQL backends — exactly-once delivery after runner restart, stored-reply deduplication by primary key, uninterruptible-request handoff during graceful shutdown, volatile (non-persisted) request discard after abrupt death, typed-failure and defect replay without re-execution, streamed-reply round-trip, and scheduled-message delivery timing.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since prior Pullfrog review (5769808):
-
Workflow integration test suite:
Workflow.test.tsadds seven test cases covering end-to-end execution with caller deduplication, completed-activity replay after abrupt owner death, deferred workflow resume across a whole-cluster restart resolved from another runner, activity retry policy with both success and exhausted-error paths, durable-clock wake after restart,DurableQueuepersistence and once-only consumption across restart, and interruption persistence. -
Cluster cron integration test suite:
ClusterCron.test.tsadds five test cases covering per-second cron execution with failure recovery,calculateNextRunFromPreviousmode difference (next-run-from-previous vs next-run-from-current-time), catch-up vsskipIfOlderThanbehavior across cluster restart, singleton owner failover without duplicate or missing ticks, and shard-group-targeted singleton assignment with per-group runner isolation. -
CI script entry:
package.jsongains thetest-clusterscript mapping tovitest run --project cluster-integration.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since prior Pullfrog review (e6de6e7):
-
SqlMessageStorage.replyFromRownull-safety fix:replyKind.WithExitmaps to0, andNumber(null)also evaluates to0, so anullrow kind (representing aChunkreply) was incorrectly deserialized as aWithExitreply, breaking persisted stream recovery. The fix adds arow.kind !== nullguard before the comparison. -
Stream recovery integration test: added a test to
Persistence.test.tsthat streams chunks from a runner, kills it mid-stream at the third value, starts a replacement, and verifies the stream resumes fromlastSentChunkValuewith correct deduplication — all five values arrive and message counts are clean. TheStreamedhandler was updated to respectlastSentChunkValuefor subset replay and includes aLatchgate so the test can precisely control when the persisted stream blocks and resumes.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Summary
Testing
pnpm lintpnpm checkEFFECT_CLUSTER_TESTS=1 pnpm test-cluster@effect/platform-nodeproject exclusion checkCloses EFF-248