fix(#769): drive retry-backoff tests with a simulated actor clock - #770
Conversation
The submitter's retry-loop tests ran on real 5-20ms backoff timers, so CI load could slide an extra retry attempt (or one fewer) across an assertion window - the checkpoint-submitter held-count test flaked both directions on GitHub runners while passing locally. Inject an xstate clock into createCheckpointSubmitter (spawned per-activity children inherit it through the actor system) and drive both submission test suites with SimulatedClock: a backoff attempt now fires only on an explicit clock.increment, making attempt counts exact and removing the real-time sleeps. The test-only retryTimings override on the submitter goes away - tests use the production timings and advance the clock past them. Closes #769
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe submitter now accepts an optional XState clock, and retry-related tests use ChangesCheckpoint retry timing
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@libs/game/idle-client/src/submission/checkpoint-activity-machine.test.ts`:
- Line 47: Update the direct-machine test fixture’s retryTimings to reference
the imported production retry timing constants instead of duplicating literal
maxTimeout and minTimeout values. Keep the test aligned with the production
configuration and preserve the existing retry behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ed0275b3-fe36-4c4f-be04-23a49d5fd479
📒 Files selected for processing (4)
.oxlintrc.jsonlibs/game/idle-client/src/submission/checkpoint-activity-machine.test.tslibs/game/idle-client/src/submission/create-checkpoint-submitter.test.tslibs/game/idle-client/src/submission/create-checkpoint-submitter.ts
Description
Closes #769
The submitter retry tests ran on real 5–20ms backoff timers, so CI load could slide an extra retry attempt (or one fewer) across an assertion window — the held-count test flaked both directions on GitHub runners. Retry timing is now driven by an injected xstate clock, so a backoff attempt fires only on an explicit
clock.increment.createCheckpointSubmittertakes a test-onlyclockoption, forwarded to the parent actor; spawned per-activity children inherit it through the actor system.clock: undefinedclobbers xstate's default system clock.SimulatedClock; the test-onlyretryTimingsoverride is gone, tests advance past the production timings instead.Clockjoins the readonly-parameter-types allow list: a two-method behaviour handle with no readonly form.Testing
bun run typecheckpassesbun run testpassesbun run lintpasses