Apply Steel gauge subType, Digital Meter and decimals edits immediately - #573
Conversation
Code review — testing persona, findings appliedThe reviewer mutation-tested this branch in a scratch copy rather than reading it. Two of the PR's own claims turned out to be unpinned: A regression to a rebuild per changed key passed all 14 tests. Every test batched exactly one structural key, so the central claim — one rebuild per batch, not up to three — had nothing asserting it. The symptom of a repeat rebuild is the one this file's own comment describes: the library cannot cancel a tween, so the discarded gauge keeps repainting the canvas with its stale scale and wins the last frame. Deleting all three live setters outright passed all 14 tests. The PR changed when Added
Suite: 2036 passing. Not appliedNo parent-level test proving Angular delivers these changes through the host template, which renames two of them (
|
9384649 to
c67a773
Compare
Code review — 4 personas, findings appliedReviewers: correctness, testing, maintainability, project-standards. Fresh contexts, isolated worktree. Making subType a rebuild trigger exposed stale geometryTwo reviewers found it; one captured the constructor's actual options. So the linear gauge rendered 150×150 in a 400×150 tile. It cannot self-correct: Fixed by deriving the geometry keys at build time from the last observed rect and the current subType, dropping the other class's keys. Mutation-checked: removing the re-derive fails the new test with The rebuild list is invertedMaintainability's argument: a hand-maintained list of what needs a rebuild makes "silently ignored" the default for every input added later — which is exactly #558. It is also already wrong:
The predicate now lists the four inputs steelseries exposes a live setter for and rebuilds on everything else. Same line count; a new input costs a needless rebuild at worst. CorrectedThe new comment justified the decimals rebuild with "decimals reaches the LCD through buildOptions" — construction-only. The bundled library defines The CHANGELOG bolded Gauge type and Digital Meter; the widget options panel labels those controls "Gauge Type" and "Digital display", and the decimals control "Decimal Places". Coverage, honestlysteelseries is a global script with only its enum constants shimmed, so each test installs its own constructor spy. The assertions therefore reach two surfaces: which constructor was called and how many times, and the contents of the private Not actioned
Turning Digital display off leaves Two spec-quality points stand: the batched-carry tests assert the shared mutable Version reasoning confirmed: latest stable is Gate on the head commit: 2045 tests pass, |
The library reads all three only while constructing a gauge, and ngOnChanges enumerated neither, so editing Gauge type, Digital Meter or the decimal places did nothing until an unrelated rebuild happened to pick them up. Fold them into the structural-rebuild condition, which now runs one rebuild per batch instead of up to three. Fixes #558
A reviewer mutation-tested the branch: reverting to a rebuild per changed key, and deleting all three live setters outright, each kept the suite green. Both are behaviours this change introduced, so both now have tests -- a batch of several structural changes asserting one construction, the setters on a standalone change, and the background and frame carried through a rebuild without their setters running. Fixes #558
…e flip Making subType a rebuild trigger exposed stale geometry. The radial writes `size`; the linear pair writes `width`/`height` and, absent those, falls back to the canvas element's dimensions — which the outgoing radial had set square. A radial-to-linear flip therefore drew the new face at the tile's shorter side, and no resize follows the flip to correct it. The rebuild list is now inverted to the inputs the library exposes a live setter for. A hand-maintained list of what needs a rebuild fails silent, which is the bug it was written to fix; this way a new input costs a needless rebuild at worst. It also picks up `theme`, whose zone-band colours were baked in at construction and kept the previous theme's palette until something else rebuilt.
ea3639f to
96e97f6
Compare
Why
GaugeSteelComponent.ngOnChangesenumeratedvalue,zones,title,backgroundColor,frameColor,radialSize,units,minValueandmaxValue. Three inputs had no branch at all —subType,barGauge(the Digital Meter setting) anddecimals— and the steelseries library reads all three only while constructing a gauge. Editing any of them in widget options produced no visible effect, and then applied out of nowhere later when a window resize or the server's unit metadata happened to rebuild the face.What
All three join the structural-rebuild condition.
buildOptions/startGaugealready re-read every input, so no new state was needed.The batch now runs one rebuild instead of up to three. Previously
zones,radialSizeandunits/min/maxeach calledstartGauge(true)in sequence, and thetitle/backgroundColor/frameColorsetters ran in between — targeting whichever gauge object existed at that point, which a later rebuild in the same batch then discarded. SincebuildOptionsre-reads the title, background and frame from the inputs, the rebuild carries them; the setters now run only on a batch with no structural change in it.Tests
Four added to
gauge-steel.component.spec.ts— one per newly-honoured input (asserting the replacement is constructed asLinear, asLinearBargraph, and with the newlcdDecimals), plus one locking the batched-title behaviour above. The three input tests fail onmain.Fixes #558