Repository navigation
fix(execute): stop the status detail repeating the headline state - #4556
Merged
Merged
Conversation
The dashboard showed "Exporting target Exporting 19%-5%" - the status label twice. #4466 began prefixing each per-inverter detail segment with that inverter's own state so a mixed fleet could be read, but the detail text is appended directly to the headline status, so on any system whose inverters agree the label is simply repeated. A single-inverter install saw it on every Charging/Exporting/Freeze/Hold status. Defer assembly of the detail text until after the headline status is resolved and emit the per-segment label only when the segments actually differ. A fleet acting in unison, and every single-inverter install, gets the pre-#4466 text back; a mixed fleet keeps the labels that made #4466 worth doing - all three existing mixed-fleet assertions are unchanged. Every end-to-end case in test_execute.py runs two inverters, which is why the single-inverter rendering shipped broken with no test failing. Add direct build_status_extra() coverage plus a single-inverter export case; both were confirmed to fail against the pre-fix behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in Execute.execute_plan()’s status tooltip rendering where the per-inverter detail string (status_extra) repeated the already-shown headline status (e.g., Exporting target Exporting 19%-5%). It does this by deferring assembly of the detail text until after the headline status is resolved, and only emitting per-segment labels when inverters actually disagree (mixed fleets).
Changes:
- Added
build_status_extra()to assemble per-inverter status detail segments and omit redundant labels when all inverters share the same label. - Updated
execute_plan()to record(inverter_id, lead, label, detail)parts and build the finalstatus_extraonce the headline status is resolved. - Expanded test coverage for single-inverter and “unison fleet” status rendering, and added direct unit tests for
build_status_extra().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/predbat/execute.py | Records per-inverter status detail parts and assembles them after resolving headline status; avoids repeating labels when fleet agrees. |
| apps/predbat/tests/test_execute.py | Adds an end-to-end assertion for unison-fleet status_extra and introduces a single-inverter export scenario to cover the regression. |
| apps/predbat/tests/test_execute_multi_inverter_status.py | Adds direct unit tests for build_status_extra() while keeping existing mixed-fleet expectations unchanged. |
| apps/predbat/predbat.py | Bumps version from v8.48.5 to v8.48.6. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
The dashboard status reads "Exporting target Exporting 19%-5%" — the state is printed twice.
Same on the charge side: "Charging target Charging 50%-80%", "Freeze charging target Freeze charging 40%", and so on.
Root cause
record_status()builds the displayed string asstatus + status_extra. In v8.48.4, #4466 changed each per-inverter detail segment fromto
That label makes a mixed fleet readable — you can see which inverter is charging and which is holding. But it was emitted unconditionally, so whenever the inverters agree (always, on a single-inverter system) the headline status is repeated verbatim in its own detail text.
Fix
status_extracan't decide this inline, because the headline status isn't resolved until after the per-inverter loop. So the segments are now recorded as(inverter_id, lead, label, detail)and assembled by a newbuild_status_extra()once the loop finishes. The per-segment label is emitted only when the segments' labels actually differ:Exporting target Exporting 19%-5%Exporting target 19%-5%Exporting target Exporting 100%-0% / Exporting 100%-0%Exporting target 100%-0% / 100%-0%Charging target Charging 90%-100.0% / Hold charging 100%-100.0%Cross-charging target Charging 50%-80% / Exporting 50%-5%So single-inverter and unison fleets get the pre-#4466 text back, and mixed fleets keep exactly what #4466 added. All three existing mixed-fleet
assert_status_extraexpectations are unchanged, which is the clearest evidence the labels were only ever wanted for disagreement.Why no test caught it
Every end-to-end case in
test_execute.pyruns two inverters, and all three status_extra assertions happen to be mixed-state fleets — so the single-inverter and unison-fleet renderings had no coverage at all.Added:
build_status_extra()tests intest_execute_multi_inverter_status.py— empty, single inverter, both lead words, unison fleet, mixed fleet, cross-charging, and a non-zero-id-only segmentsingle_inverter_export_status, the first end-to-end case in the module to run a single inverterBoth were confirmed to fail against the pre-fix behaviour, reproducing the reported string exactly:
Verification
./run_all --test execute --test multi_inverter_status— passes./run_all --quick— all tests pass, 20/20 random scenarios match baseline across 320 compared fields./run_pre_commit— all hooks passVersion bumped
v8.48.5→v8.48.6.🤖 Generated with Claude Code