Repository navigation
fix(loadpoint): Charge now on a solar-only charger gets a fuse share - #1885
Merged
Merged
Conversation
A manual hold on a SurplusOnly loadpoint was never a goal, so an idle solar-only charger sorted ahead of it and reserved the EV fuse cap. Treat every positive hold as a goal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Item D2 of the stable plan.
Problem
A manual hold (Charge now) on a solar-only loadpoint was never a goal (
controller_fuse_budget.go:55:goal = wantW > 0 && !cfg.SurplusOnly). An idle solar-only charger with no hold asks for its MaxChargeW, so the fuse budget sorts the two by ID.Scenario: two solar-only chargers, 3p, steps 4140..11040 W, no PV surplus, EV fuse cap 8000 W, Charge now on
b. Chargerasorts first and takes 6900 W of the cap, leaving 1100 W. That is belowb's 4140 W minimum, sobgets 0 W with the reasonfuse_limiton every tick. Chargeraalso orders 0 W, as it has no surplus, so nobody uses the cap.Change
Treat every positive hold as a goal:
goal = wantW > 0 && (held || !cfg.SurplusOnly). The hold lookup now runs once per loadpoint instead of twice. Only the sort order changes. The total cap, the per-phase room andapplyFuseClampstill bound every order.Tests
surplus_hold_fuse_test.go, the repro test from the audit (caa-23). On master:orders map[charger-a:0 charger-b:0], FAIL. With the fix:orders map[charger-a:0 charger-b:6900], PASS.cd go && go test -race ./internal/loadpoint/... -count=1: okgo vet ./...andgo build ./...: okRisk
Low. The fix can only lower other chargers' shares in favour of a held one, and every order stays inside the same fuse bounds. A solar-only hold with no deadline still ranks behind goals that have deadlines.
🤖 Generated with Claude Code