Repository navigation
test(sse): update three backoff assertions stale since the #8396 cooldown cap - #8539
Conversation
…pw#8396 cooldown cap These three cases assert that a transient-error cooldown keeps doubling to baseCooldownMs * 2^maxLevel — roughly 45.5h at the default constants. That is precisely the blackout diegosouzapw#8396 removed: capScaledCooldownMs (open-sse/services/accountFallback/cooldownCap.ts) now bounds every scaled cooldown by profile.maxCooldownMs, falling back to BACKOFF_CONFIG.max when the profile does not configure one. All three call checkFallbackError with a null provider, so the fallback ceiling applies and the observed value is BACKOFF_CONFIG.max. The backoff-level clamping each case was written to guard is unchanged and still asserted; only the expected duration moved. The expressions keep the original formula wrapped in the cap so the relationship stays readable, and the first case gains a precondition assertion so it cannot silently become vacuous if the constants change. Fixes the error-classification (x2) and thundering-herd (x1) failures that are red on release/v3.8.49 at its own HEAD.
|
Reviewed and verified independently. On a clean checkout of release/v3.8.49 (current tip), the three cited tests fail exactly as described in the PR body (160000 vs actual 120000; 163840000 vs actual 120000, twice). With this PR's diff applied, all 33 tests in both files pass. I also read |
…pw#8396 cooldown cap (diegosouzapw#8539) These three cases assert that a transient-error cooldown keeps doubling to baseCooldownMs * 2^maxLevel — roughly 45.5h at the default constants. That is precisely the blackout diegosouzapw#8396 removed: capScaledCooldownMs (open-sse/services/accountFallback/cooldownCap.ts) now bounds every scaled cooldown by profile.maxCooldownMs, falling back to BACKOFF_CONFIG.max when the profile does not configure one. All three call checkFallbackError with a null provider, so the fallback ceiling applies and the observed value is BACKOFF_CONFIG.max. The backoff-level clamping each case was written to guard is unchanged and still asserted; only the expected duration moved. The expressions keep the original formula wrapped in the cap so the relationship stays readable, and the first case gains a precondition assertion so it cannot silently become vacuous if the constants change. Fixes the error-classification (x2) and thundering-herd (x1) failures that are red on release/v3.8.49 at its own HEAD.
…pw#8396 cooldown cap (diegosouzapw#8539) These three cases assert that a transient-error cooldown keeps doubling to baseCooldownMs * 2^maxLevel — roughly 45.5h at the default constants. That is precisely the blackout diegosouzapw#8396 removed: capScaledCooldownMs (open-sse/services/accountFallback/cooldownCap.ts) now bounds every scaled cooldown by profile.maxCooldownMs, falling back to BACKOFF_CONFIG.max when the profile does not configure one. All three call checkFallbackError with a null provider, so the fallback ceiling applies and the observed value is BACKOFF_CONFIG.max. The backoff-level clamping each case was written to guard is unchanged and still asserted; only the expected duration moved. The expressions keep the original formula wrapped in the cap so the relationship stays readable, and the first case gains a precondition assertion so it cannot silently become vacuous if the constants change. Fixes the error-classification (x2) and thundering-herd (x1) failures that are red on release/v3.8.49 at its own HEAD.
Problem
Three unit tests fail on
release/v3.8.49at its own HEAD (7a8f9156d), with no PR content applied. They show up on theUnit Tests fast-pathshards:502 transient: exponential backoff doubles until the configured max backoff steperror-classification.test.ts160000120000high transient backoff levels clamp to the configured maxBackoffStepserror-classification.test.ts163840000120000Exponential backoff clamps to the configured maxBackoffLevelthundering-herd.test.ts163840000120000Root cause: the tests assert the behavior #8396 deliberately removed
163840000ms is 45.5 hours —transientInitial * 2^maxLevel. That unbounded growth is exactly what #8396 fixed. From the header of the module it added:capScaledCooldownMsnow bounds every scaled cooldown by the operator-configuredprofile.maxCooldownMs, falling back toBACKOFF_CONFIG.maxwhen the profile does not set one. All three cases callcheckFallbackError(502, "", level, null, null)with a null provider, so no profile resolves and the fallback ceiling applies — hence120000across the board.So the production behavior is correct and intentional; the assertions are stale. #8396 landed the cap and its own test but did not update these three pre-existing cases. (The same PR also left its test unregistered in
stryker.conf.json— that half is #8538.)Change
Only the expected durations move. The backoff-level clamping each case was written to guard (
newBackoffLevel === maxLevel/=== level + 1) is untouched and still asserted.Math.min(COOLDOWN_MS.transientInitial * Math.pow(2, BACKOFF_CONFIG.maxLevel), BACKOFF_CONFIG.max)— rather than a bare120000, so the relationship between the exponential series and the ceiling stays readable and survives a constant change.so it cannot silently become vacuous if
transientInitialorBACKOFF_CONFIG.maxis retuned later.cooldownCap.ts, so the next reader does not mistake this for a relaxed assertion.Verification
eslintexit 0 andprettier --checkclean on both files. No production code touched.Note for maintainers
CLAUDE.md→ Resilience Runtime State → Connection Cooldown still documents the pre-#8396 rule:with no mention of the ceiling. That is now inaccurate. I left it alone to keep this PR to the test change — happy to send a docs follow-up if you want the cap documented there.