Fix backup islanding arrow - #25
Merged
Merged
Conversation
…erlap The bus edge (Inverter->Junction) and the inverter-fed Backup edge both leave Inverter's bottom border at the same point, and the islanding edge then runs straight down through Junction's own position before bending into Backup - so with no offset between them, the two draw on exactly the same pixels. During islanding this made Backup's flow visually indistinguishable from (and drawn right on top of) a grid-bypassed feed, even overlapping the "grid disconnected" crossed-X mark on the bus edge, making it look like power was flowing straight through it. Confirmed against a real Pi sample (2026-09-13 19:57:52, grid_mode Fault/work_mode Off-Grid: load 725W, backup 726W, battery discharging 700W, meter/pgrid ~0W) and visually verified with a standalone harness loading the real static assets in headless Chrome, before/after. The v5 mockup (docs/superpowers/mockups/live-power-flow-dashboard- mockup-v5.html) already solved this with BACKUP_ISLANDING_SHIFT - offset the bus's exit point right and the islanding edge's own exit point left by the same amount, and shift Junction/Load right by it too, so the two lines run alongside each other instead of on top of each other - but its own comment flagged it as "pending a production port" that never happened, across the original port (#15) and four follow-up fixup PRs (#19, #21, #22, #23). Those fixups all hardened diagram-calc.js's *arithmetic* (Kirchhoff's law, source-mix stripes), which is unit-tested - diagram-render.js's SVG *geometry* has no DOM harness, so nothing ever regression-tested it, and manual verification only ever happened to see the far-more-common grid-connected state. Ported the shift amount as a pure, testable function (backupIslandingShiftPx in diagram-calc.js, covered by node --test) alongside the constant; diagram-render.js applies the actual DOM transform/geometry offset, which still has no automated coverage - the same gap that let this slip through five previous PRs. Also audited the rest of the mockup's own "pending production port" comments: the other two (sqrt-scale arrow thickness, dischargeLimit===0 battery check) were already ported in later commits despite the mockup's stale comments; the adaptive backup-threshold formula remains deliberately deferred, already tracked by its own comment in diagram-calc.js. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
The bus edge (Inverter->Junction) and the inverter-fed Backup edge both leave Inverter's bottom border at the same point, and the islanding edge then runs straight down through Junction's own position before bending into Backup - so with no offset between them, the two draw on exactly the same pixels. During islanding this made Backup's flow visually indistinguishable from (and drawn right on top of) a grid-bypassed feed, even overlapping the "grid disconnected" crossed-X mark on the bus edge, making it look like power was flowing straight through it.
Confirmed against a real Pi sample (2026-09-13 19:57:52, grid_mode Fault/work_mode Off-Grid: load 725W, backup 726W, battery discharging 700W, meter/pgrid ~0W) and visually verified with a standalone harness loading the real static assets in headless Chrome, before/after.
The v5 mockup (docs/superpowers/mockups/live-power-flow-dashboard- mockup-v5.html) already solved this with BACKUP_ISLANDING_SHIFT - offset the bus's exit point right and the islanding edge's own exit point left by the same amount, and shift Junction/Load right by it too, so the two lines run alongside each other instead of on top of each other - but its own comment flagged it as "pending a production port" that never happened, across the original port (#15) and four follow-up fixup PRs (#19, #21, #22, #23). Those fixups all hardened diagram-calc.js's arithmetic (Kirchhoff's law, source-mix stripes), which is unit-tested
Ported the shift amount as a pure, testable function (backupIslandingShiftPx in diagram-calc.js, covered by node --test) alongside the constant; diagram-render.js applies the actual DOM transform/geometry offset, which still has no automated coverage - the same gap that let this slip through five previous PRs. Also audited the rest of the mockup's own "pending production port" comments: the other two (sqrt-scale arrow thickness, dischargeLimit===0 battery check) were already ported in later commits despite the mockup's stale comments; the adaptive backup-threshold formula remains deliberately deferred, already tracked by its own comment in diagram-calc.js.