Repository navigation
Conversation
Signed-off-by: Segran <goran@andersson-stehag.se>
…ted copies Signed-off-by: Segran <goran@andersson-stehag.se>
This was referenced Oct 19, 2026
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
…tail Signed-off-by: Segran <goran@andersson-stehag.se>
segran2
marked this pull request as ready for review
October 19, 2026 21:34
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.
Missing or rejected source readings and recording gaps can make an entire day's Home use or Solar unknown. This adds explicitly requested, audited historical estimates while preserving the underlying observations and their quality. Fixes #1750; related earlier work: #1667 and #1668.
The API/UI retains a covered Home use subtotal when a complete total remains unknown. Two offline repair methods are available: reconstruction from explicitly selected retained AC source-power series, and an endpoint-mean method for both Home use and Solar. The endpoint helper computes
(power before + power after) / 2 × gap hoursfor incomplete minutes only. It uses valid retained minute source-energy means for Home use and retained ten-second means for Solar, requires both bounds and an explicit maximum endpoint distance, and never assumes zero for missing data. Two observed night-time zeros produce 0 Wh.The endpoint workflow keeps Core collecting throughout backup, preparation and application. After an independent checked SQLite online backup, an operator reviews the hashed plan. Applying it briefly reserves the SQLite writer, rechecks the evidence and atomically publishes the audit metadata plus daily-cache invalidation. No live database is replaced. Original samples, source energy, quality, configuration and newer unrelated measurements remain intact. Repeating a matching plan is idempotent; stale, conflicting or tampered evidence fails closed. Endpoint corrections supersede earlier source-power corrections only in the derived read view; both audits remain available.
Corrections participate in daily totals, system energy-ledger buckets and aggregate charts, remain estimated, and survive portable backup/restore and retention. Estimated Solar is excluded from
measured.pv_wh. Current totals expose completed-through timestamps and do not extrapolate an unfinished writer tail. Raw history and training/control inputs are unchanged. Valid SemVer build metadata retains native update support for the installed current slot; published trial binaries still require an exact release identity.Validation:
make verifypasses (Docker-context check skipped because no Docker daemon), 869 web tests pass, targeted state/API race tests pass. End-to-end state tests cover daytime means, night-time zero endpoints, bounded/unbounded gaps, both flow totals, ledger/chart estimate provenance, live writer-tail bounds, unchanged originals, preservation of later receipts, retry idempotence, atomic rollback, stale/tampered plans, independent backups, retention and portable restore. Existing native update tests cover valid/invalid metadata, incorrect base versions and strict trial identity.This is separate from the forward-looking source-hold and dark-PV policies in #1753/#1755; it does not import or rewrite those policies. Operator workflow:
docs/history-endpoint-repair.mdanddocs/history-repair.md. Independent human UI review remains outstanding; this PR remains a draft.