Skip to content

fix(execute): stop the status detail repeating the headline state - #4556

Merged
springfall2008 merged 1 commit into
mainfrom
fix/status-extra-duplicate-label
Aug 17, 2026
Merged

springfall2008 merged 1 commit into
mainfrom
fix/status-extra-duplicate-label

Conversation

@springfall2008

@springfall2008 springfall2008 commented Aug 17, 2026 •

Copy link
Copy Markdown
Owner

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 as status + status_extra. In v8.48.4, #4466 changed each per-inverter detail segment from

status_extra += " {}%-{}%".format(inverter.soc_percent, int(target))

to

status_extra += " {} {}%-{}%".format(status, inverter.soc_percent, int(target))

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_extra can'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 new build_status_extra() once the loop finishes. The per-segment label is emitted only when the segments' labels actually differ:

fleet v8.48.4/5 this PR
single inverter exporting Exporting target Exporting 19%-5% Exporting target 19%-5%
two inverters, both exporting Exporting target Exporting 100%-0% / Exporting 100%-0% Exporting target 100%-0% / 100%-0%
two inverters, mixed Charging target Charging 90%-100.0% / Hold charging 100%-100.0% unchanged
cross-charging Cross-charging target Charging 50%-80% / Exporting 50%-5% unchanged

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_extra expectations 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.py runs 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:

  • direct build_status_extra() tests in test_execute_multi_inverter_status.py — empty, single inverter, both lead words, unison fleet, mixed fleet, cross-charging, and a non-zero-id-only segment
  • single_inverter_export_status, the first end-to-end case in the module to run a single inverter

Both were confirmed to fail against the pre-fix behaviour, reproducing the reported string exactly:

ERROR: expected ' target 19%-5%', got ' target Exporting 19%-5%'
ERROR: status_extra should be ' target 100%-0% / 100%-0%' got ' target Exporting 100%-0% / Exporting 100%-0%'

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 pass

Version bumped v8.48.5 → v8.48.6.

🤖 Generated with Claude Code

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>
Copilot AI lite review requested due to automatic review settings August 17, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 final status_extra once 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.

@springfall2008
springfall2008 merged commit 4139784 into main Aug 17, 2026
3 checks passed
@chalfontchubby
chalfontchubby deleted the fix/status-extra-duplicate-label branch August 21, 2026 09:43
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.

2 participants