Description
Between ~23:45 and 00:00, the Battery SOC and Energy Flow chart shows doubled/overlapping data right at the today/tomorrow divider, instead of a clean split.
Root cause (identified via debug bundle analysis)
Once per evening, BESS Manager runs a standalone "prepare next day" optimization that stores a schedule anchored at tomorrow 00:00 with optimization_period = 0. Until midnight actually rolls over, core/bess/daily_view_builder.py (build_daily_view, ~lines 109-130) uses this schedule to fill in the remaining future periods of today:
predicted_index = i - optimization_period # daily_view_builder.py:128
This assumes optimization_period always anchors the stored predicted_periods to today. That's false for the standalone next-day schedule — its period_data[0] is tomorrow 00:00, not today 00:00. So today's tail periods (e.g. period 95 / 23:45) get filled with tomorrow's period 95 (tomorrow 23:45) data instead of today's actual forecast for that slot.
backend/api.py (~lines 702-711) already has an is_next_day_only guard for exactly this case, applied when building tomorrow_data (from commit 9ca5b8b, issue #173/#287 fix). That guard was never applied to daily_view_builder.build_daily_view, which has no equivalent check when computing predicted_index for today's remaining periods.
Evidence
Debug bundle docs/bess-debug-2026-07-23-235706.md (export 2026-07-23 23:57:02, during the nightly "prepare next day" window):
- The stored schedule has
optimization_period: 0 and period_data[0].timestamp = "2026-07-24 00:00:00+02:00" — confirmed tomorrow-anchored schedule.
period_data[95] (timestamp 2026-07-24 23:45:00+02:00) has battery_action=-0.4875, battery_soe_start=3.5131578947368434, battery_soe_end=3.0000000000000013, shadow_price=2.1071249999999924.
- Today's rendered period at 23:45 (period index 95) shows the identical values to 13 decimal places — i.e. tomorrow's 23:45 data is being rendered as today's 23:45 data, while tomorrow's actual data for that same slot is also rendered correctly elsewhere — hence the visual doubling.
Fix location
core/bess/daily_view_builder.py:109-130 needs the same next-day-anchor detection/correction that backend/api.py:702-711 already implements for tomorrow_data, applied when computing predicted_index for today's remaining periods.
Attachments
Debug bundle available locally at docs/bess-debug-2026-07-23-235706.md (not attached here — contains system data).
Description
Between ~23:45 and 00:00, the Battery SOC and Energy Flow chart shows doubled/overlapping data right at the today/tomorrow divider, instead of a clean split.
Root cause (identified via debug bundle analysis)
Once per evening, BESS Manager runs a standalone "prepare next day" optimization that stores a schedule anchored at tomorrow 00:00 with
optimization_period = 0. Until midnight actually rolls over,core/bess/daily_view_builder.py(build_daily_view, ~lines 109-130) uses this schedule to fill in the remaining future periods of today:This assumes
optimization_periodalways anchors the storedpredicted_periodsto today. That's false for the standalone next-day schedule — itsperiod_data[0]is tomorrow 00:00, not today 00:00. So today's tail periods (e.g. period 95 / 23:45) get filled with tomorrow's period 95 (tomorrow 23:45) data instead of today's actual forecast for that slot.backend/api.py(~lines 702-711) already has anis_next_day_onlyguard for exactly this case, applied when buildingtomorrow_data(from commit 9ca5b8b, issue #173/#287 fix). That guard was never applied todaily_view_builder.build_daily_view, which has no equivalent check when computingpredicted_indexfor today's remaining periods.Evidence
Debug bundle
docs/bess-debug-2026-07-23-235706.md(export 2026-07-23 23:57:02, during the nightly "prepare next day" window):optimization_period: 0andperiod_data[0].timestamp = "2026-07-24 00:00:00+02:00"— confirmed tomorrow-anchored schedule.period_data[95](timestamp2026-07-24 23:45:00+02:00) hasbattery_action=-0.4875,battery_soe_start=3.5131578947368434,battery_soe_end=3.0000000000000013,shadow_price=2.1071249999999924.Fix location
core/bess/daily_view_builder.py:109-130needs the same next-day-anchor detection/correction thatbackend/api.py:702-711already implements fortomorrow_data, applied when computingpredicted_indexfor today's remaining periods.Attachments
Debug bundle available locally at
docs/bess-debug-2026-07-23-235706.md(not attached here — contains system data).