Skip to content

fix(control): harden fuse safety guards - #335

Merged
frahlg merged 2 commits into
masterfrom
codex/bug-hunt-20260526-173825
May 26, 2026
Merged

frahlg merged 2 commits into
masterfrom
codex/bug-hunt-20260526-173825

Conversation

@frahlg

@frahlg frahlg commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix fuse guard prediction so stale/offline battery readings are not double-removed when predicting post-dispatch grid power
  • Reject invalid non-positive fuse.phases and fuse.voltage so fuse protection cannot be effectively disabled by bad config
  • Add focused regression tests for both safety cases

Test plan

  • GOCACHE=/private/tmp/ftw-go-build-cache go test ./internal/control -run 'TestFuseGuardPredictsAgainstControlledBatteriesOnly|TestPerPhaseClampFiresOnExportImbalance|TestFuseGuard' -count=1 -v
  • GOCACHE=/private/tmp/ftw-go-build-cache go test ./internal/config -run 'TestRejectsInvalidFusePowerInputs|TestFuseMaxPower|TestSmoothingAlphaValidation' -count=1 -v
  • GOCACHE=/private/tmp/ftw-go-build-cache go test ./...

@frahlg
frahlg marked this pull request as ready for review May 26, 2026 16:58
@frahlg
frahlg merged commit cf4f02b into master May 26, 2026
@frahlg
frahlg deleted the codex/bug-hunt-20260526-173825 branch May 26, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant