Repository navigation
fix(history): derive household Load from interval source energy - #1741
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01cc8e3d02
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if sourceTables != 0 && sourceTables != 3 { | ||
| return errors.New("incomplete history source tables; restore a verified full backup") |
There was a problem hiding this comment.
Allow interrupted source-schema creation to resume
If the process or host stops during the first upgrade after one or two of the three new source tables have been created, ensureHistorySchema has committed those CREATE TABLE statements separately. On every subsequent startup this pre-schema check sees a partial set and aborts before the remaining CREATE TABLE IF NOT EXISTS statements can run, unnecessarily making Core unrecoverable without restoring a backup. Create the related tables transactionally or distinguish an interrupted additive migration from a genuinely incomplete restored dataset.
AGENTS.md reference: AGENTS.md:L24-L25
Useful? React with 👍 / 👎.
Recorded household Load depended on a valid instantaneous balance, so different meter and charger reporting times could erase otherwise usable history. The app's consumer ledger and the web/day readers also followed different paths.
Core now stores independently qualified source energy in common UTC minutes and balances signed energy over the requested chart, day or price interval. App and web use the same historical Load. Live display, forecast qualification and hardware control keep their current behavior.
Validation: the original reporting-cadence regression failed before the change. Targeted SQLite, native-history and same-server API regressions pass, including negative-minute cancellation, zero/missing, restart, timestamp origin, method transitions, V2X, query truncation, tariffs, midnight cache, retention and full backup/restore. Full
make verifyand targeted race checks pass on exact head01cc8e3d02b5b39c331d016a8db5125579ad38c6, including the merged MCP base. A local OCPP listener timed out while full and race suites overlapped; the unchanged test passed three isolated runs and the full suite then passed alone. GitHub CI is green on the same exact head: 19 successful checks and four intentional skips. No formal GitHub review is claimed; the owner authorized beta fast-track after green CI.This is receipt-integrated source energy, not an exact correction of device clocks. Normal rollback keeps the source tables in the database, but an older Core's portable backup does not know these new tables; use the matching new helper for exports. No general migration or stable qualification is claimed.