Make the sink-base fault-mix test clock-driven - #1085
Conversation
Replace the closed-loop concurrency load with a rate-based open loop and an injected Clock, so the sink-base fault-mix test's dispatch count no longer depends on completing two requests inside a real 25ms window. scheduleArrivals() fixes the arrival count (3) up front from rate/duration alone, and both the load generator and each remote-fault drain poll consume the injected clock instead of wall-clock time. fedify-dev#951 Changelog: none Assisted-by: Claude Code:claude-sonnet-5
✅ Deploy Preview for fedify-json-schema canceled.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe remote fault mix test now uses rate-based load and simulated time. It asserts that the measured request count equals the three trigger calls. ChangesRemote fault mix test
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to This test-only change makes dispatch timing deterministic while retaining checks for successful requests and both inboxes. No merge-blocking risk is evident. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Closes #951.
failureRunner - shares sink base across remote fault mixran a closed-loop load (concurrency: 1) for a real 25 ms and assertedrequests.total > 1.runClosedLoopyields between dispatches and never callsclock.sleepUntil(), so the assertion's actual guarantee was "the host completed a second async round trip within 25 real milliseconds" — which failed once under CI scheduling load in #949's Node.js job.This switches the scenario to a rate-based open loop (
load: { rate: 100 }) and injects aClockviaRunContext.clock- the same mechanismfanoutRunner's own tests already rely on (fanout.test.ts:362-374).scheduleArrivals()(load/arrival.ts) computes the arrival count purely fromrateanddurationbefore the loop ever runs, so withrate: 100andduration: "25ms"the three dispatches at t=0/10/20 are fixed by arithmetic, not by how fast the host executes.runOpenLoopcallsclock.sleepUntil()per arrival, and each remote fault's drain wait (waitForRemoteFault) also polls through the same injected clock, so nothing on this path touches real wall-clock time anymore.Checks
node --test --experimental-transform-types packages/cli/src/bench/scenarios/failure.test.ts— 17/17 pass.--test-name-pattern='failureRunner - shares sink base across remote fault mix') — 100/100 pass.measurement.requests.total === triggerCalls === 3and both/inbox/0//inbox/1still show up, so the sink-base-sharing behavior the test exists to check is unchanged.No changelog fragment, since this is test-only work; the commit carries
Changelog: none.AI disclosure
Per AI_POLICY.md: Claude Code (claude-sonnet-5) helped trace the flakiness to
runClosedLoopnever callingclock.sleepUntil(), proposed switching to the open-looprate+ injected-Clockpattern already used elsewhere in this file, and ran the checks full suite once (the first check below).I reviewed the reasoning against the actual source before accepting it, adjusted the final assertions myself, and independently re-ran the isolated test 100 times in my own terminal to confirm it no longer flakes.
The commit carries the
Assisted-by: Claude Code:claude-sonnet-5trailer.