You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
web_pv_calibration_chart test fails since 17 Nov: it reads the real clock against fixed dates #6244
Summary: the web_pv_calibration_chart unit test has failed since 2026-11-17 00:00 UTC, on main and in the quick suite every PR runs. It reads the real clock, and its fixed dates are now in the past.
What fails
Test 10: next scan shows the after-midnight scan, and the spread is a percentage of the factor
ERROR: t10 next scan failed ["Next scan</th><td ...>2026-11-17 03:00</td></tr>"]
**** web_pv_calibration_chart: FAILED ****
Cause
StubSolar in apps/predbat/tests/test_web_pv_calibration_chart.py uses fixed dates: last scan and last success at 2026-11-16 03:00 UTC, next scan at 2026-11-17 03:00 UTC. The PV Calibration page in web.py shows the earlier of the next scan and the next local midnight after the last success, but only while that midnight is still ahead, through the if next_midnight > self.now_utc guard added in #6233. The test doesn't pin now_utc, so the guard compares against the real time:
before 2026-11-17 00:00 UTC, midnight is in the future, so the page shows 2026-11-17 00:00 and test 10 passes;
from 2026-11-17 00:00 UTC, midnight is in the past, so the page shows the stub's 03:00 and test 10 fails, permanently.
The page itself behaves correctly. Only the test is clock-dependent.
Suggested fix
Pin the clock the page reads in the test, e.g. set now_utc to 2026-11-16 12:00 UTC on the instance the page uses, before tests 10 and 12. Test 12 already uses a 2099 date for the same reason. Alternatively, build the stub's dates relative to now_utc.
Found while running the quick suite for #6243, which doesn't touch this test.
This is an automated first-pass triage; a maintainer will review it before any action is taken.
Classification: bug. Priority: medium.
Bug: The PV Calibration page test pins the solar stub's scan times to 16–17 Nov 2026 but leaves the page's clock on the fixture's real date, so once the real clock passes the midnight implied by the stub's last success, the page's next_midnight > self.now_utc guard suppresses that midnight and test 10's assertion fails - permanently, because the stub dates never move.
What I verified on current main
1. Reproduced exactly as reported. On main (da2b0a5b, v9.9.0) web_pv_calibration_chart exits 1 with the same line:
Test 10: next scan shows the after-midnight scan, ...
ERROR: t10 next scan failed ["Next scan</th><td ...>2026-11-17 03:00</td></tr>"]
2. Both sides of it came from #6233, so this is a fresh regression, not an old test drifting.git blame puts the midnight guard in web.py and test 10 (the 2026-11-17 00:00 assertion) on the same commit, da2b0a5b, which is in v9.9.0. The stub's last success (2026-11-16 03:00 UTC) was therefore already only hours ahead when the test landed.
3. The clock really is the fixture's real date.WebInterface.now_utc is ComponentBase.now_utc, which returns base.now_utc; create_predbat() pins that from FIXTURE_MINUTES_NOW (noon of the real day), so the page compares the stub's midnight against today. local_tz is Europe/London and 16 Nov is GMT, so the midnight arithmetic itself is offset-free - the test is sound apart from the clock.
4. The page is not at fault. It does what the guard says, and test 12 already covers the other side of it (a midnight in the past, using a 2099 date). Only test 10 is clock-dependent.
5. I confirmed your suggested fix works, and it is a one-line change. Pinning the instance the page reads to 2026-11-16 12:00 UTC (restored in the test's finally) makes the whole test pass, with test 10 showing 2026-11-17 00:00 and test 12 still showing the 2099 retry. Pinned against fixed stub dates it stays deterministic permanently, so it can't expire again.
6. It is in the quick suite. It is registered in TEST_REGISTRY with the slow flag off, so every PR's CI is red until it is fixed - which is how this was found while running #6243.
No duplicates found. Related: #6233 introduced the guard and the test; #6243 is where the failure surfaced. The debug journal already carries a row for this class of problem (the quick suite going red on a clock boundary), so nothing new there.
Suggested shape for the fix: pin now_utc at the top of the test and restore it in finally, e.g. to 2026-11-16 12:00 UTC. Building the stub's dates relative to now_utc would work too, but keeps the assertion less readable, since the whole point of test 10 is the midnight just after the last scan.
Activity
springfall2008 commentedon Nov 17, 2026
This is an automated first-pass triage; a maintainer will review it before any action is taken.
Classification: bug. Priority: medium.
Bug: The PV Calibration page test pins the solar stub's scan times to 16–17 Nov 2026 but leaves the page's clock on the fixture's real date, so once the real clock passes the midnight implied by the stub's last success, the page's
next_midnight > self.now_utcguard suppresses that midnight and test 10's assertion fails - permanently, because the stub dates never move.What I verified on current main
1. Reproduced exactly as reported. On main (
da2b0a5b, v9.9.0)web_pv_calibration_chartexits 1 with the same line:2. Both sides of it came from #6233, so this is a fresh regression, not an old test drifting.
git blameputs the midnight guard inweb.pyand test 10 (the2026-11-17 00:00assertion) on the same commit,da2b0a5b, which is in v9.9.0. The stub's last success (2026-11-16 03:00 UTC) was therefore already only hours ahead when the test landed.3. The clock really is the fixture's real date.
WebInterface.now_utcisComponentBase.now_utc, which returnsbase.now_utc;create_predbat()pins that fromFIXTURE_MINUTES_NOW(noon of the real day), so the page compares the stub's midnight against today.local_tzis Europe/London and 16 Nov is GMT, so the midnight arithmetic itself is offset-free - the test is sound apart from the clock.4. The page is not at fault. It does what the guard says, and test 12 already covers the other side of it (a midnight in the past, using a 2099 date). Only test 10 is clock-dependent.
5. I confirmed your suggested fix works, and it is a one-line change. Pinning the instance the page reads to
2026-11-16 12:00 UTC(restored in the test'sfinally) makes the whole test pass, with test 10 showing2026-11-17 00:00and test 12 still showing the 2099 retry. Pinned against fixed stub dates it stays deterministic permanently, so it can't expire again.6. It is in the quick suite. It is registered in
TEST_REGISTRYwith the slow flag off, so every PR's CI is red until it is fixed - which is how this was found while running #6243.No duplicates found. Related: #6233 introduced the guard and the test; #6243 is where the failure surfaced. The debug journal already carries a row for this class of problem (the quick suite going red on a clock boundary), so nothing new there.
Suggested shape for the fix: pin
now_utcat the top of the test and restore it infinally, e.g. to 2026-11-16 12:00 UTC. Building the stub's dates relative tonow_utcwould work too, but keeps the assertion less readable, since the whole point of test 10 is the midnight just after the last scan.test(web): pin the clock in the PV Calibration page test (#6244) (#6245)