fix(sim): keep the autoscaler controlling when a knob is not a number - #64
Merged
Merged
Conversation
|
@kevin9327 is attempting to deploy a commit to the whoarrryou's projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
The knob() helper is a nicer shape than repeating the guard at each call site. LGTM, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The autoscaler's fallbacks carry this note:
??delivers that for an UNSET field. It does nothing for a field that is set to something which isnot a number, and none of the six knobs is among the nine config numbers
isTopologychecks. NaNthen survives every reading, because they are all written from comparisons and NaN fails all of them:
The controller does not crash. It stops controlling, which looks exactly like a design that did not
need to scale.
Measured
One client at 400 rps into a service with
capacity: 2,serviceMs: 40, one instance, with anautoscaler on a control edge. Thirty simulated seconds, so several cooldowns:
Three of the six cost 77% of the design's throughput. The reader sees a fleet that never grows under
load, which is the exact opposite of the lesson the component exists to teach — and
setpointandtargetInstancesreach the panel asNaNin two of them.Where it comes from
Not the inspector: every one of these is a bounded slider or number input.
isTopologycheckscapacity,serviceMs,serviceCv,queueLimit,hitRate,errorRate,timeoutMs,retriesand
rps, and none of the controller's knobs, so a shared link, a.breakscalefile and a restoredsession carry them through untouched.
Fix
One
knob(value, fallback)helper that treats a value which is not a finite number the way an absentone is already treated, applied to all six reads. That is what the existing note already promises;
??was simply the wrong operator to promise it with.Falling back to the module's own
DEFAULT_*is the only available answer: when the field itself isNaN there is no earlier value to recover.
Tests
src/sim/behaviour-control.autoscaler.test.ts, new. The reading that matters is not the knob, it iswhether the fleet still grows:
NaNstill scales past five instances and still serves over 4000targetUtil,minCapacityandscaleStepPctset toNaNare byte-identical to the baseline,because for those three the documented fallback is also what the node carries — the sharpest
available statement that the guard changed nothing real
setpointandtargetInstancesare numbersAgainst
main, eight of the thirteen fail:How I tested
Windows 11, Bun 1.3.14.
bun run testis 942 passed across 40 files, up from 929 by the thirteen newtests, with nothing else moving.
bun run typecheckandbun run format:checkare clean, andbun run lintreports the same pre-existing warnings asmain.Last of the family alongside #58, #60, #61, #62 and #63. This one is the only one where nothing
throws and nothing hangs — the simulation runs perfectly and teaches the wrong thing — which is why
I went looking at throughput rather than at exceptions.