Show the dominant state in a mixed history slot, not the last one seen - #4872
Open
chalfontchubby wants to merge 1 commit into
Open
Show the dominant state in a mixed history slot, not the last one seen#4872chalfontchubby wants to merge 1 commit into
chalfontchubby wants to merge 1 commit into
Conversation
#4843) calculate_yesterday() rebuilds each 30-minute History slot from Predbat's per-minute status, but a slot can genuinely hold more than one state - a force export that hits its target part way through drops to freeze export, a manual override can land on any minute. The reconstruction used to assign unconditionally as it scanned each slot, so whichever state it visited last won and an earlier, more significant state silently vanished (#4840's force export erased by the freeze export that followed it). The scan also read each minute's status from the wrong offset within the slot, mirrored around the midpoint, which changed which state "won" depending on where in the slot a transition happened to land. A slot's cell now shows whichever state actually held the most of its trusted minutes - the genuinely dominant one, not just whichever the old last-wins scan reached last or ranked highest in the abstract - marked with an asterisk when the slot held more than one, with every state it passed through listed in the cell's tooltip so nothing is silently lost. A slot's first/last 5 minutes are only trusted when they hold one state throughout: that guards against Predbat's reported status lagging a slot boundary by a minute or two while it catches up to a replan, without discarding a state that genuinely occupies the full edge window. 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.
Summary
calculate_yesterday()'s History-view slot reconstruction now shows whichever state actually held the most of a 30-minute slot's trusted minutes (the genuinely dominant one), rather than whichever state a scan happened to visit last or ranked highest by an abstract "most active" precedence.Addresses #4843.
Test plan
./run_all --test calculate_yesterday- full suite including new edge-window regression tests./run_all --quick- full quick suite./run_pre_commit🤖 Generated with Claude Code