Repository navigation
Commit 4e5268c
test: make the plan expiry tests fail when the clock is wrong (#5079)
Copilot review on #5100: the two fixes made the tests pass, but not fail
when the bug returns. Both clocks normally read close to the same value, and
an expiry of now_utc + 8h is only wrong once they have drifted more than 8
hours apart - so between roughly 11:00 and 20:00 the buggy implementations
passed as well, and a revert would go unnoticed for most of the working day.
Confirmed by mutation test rather than assumed: reinstating the old
save_plan() left plan_persistence passing.
Each test now pins now_utc a year away from real time, in the direction that
exposes its own mistake - back for the round trip (a now_utc-derived expiry is
then already past, so the plan fails to load) and forward for the stale-plan
check (a now_utc-derived "past" expiry is then still ahead of real time, so the
plan loads when it should not). Both mutations are now caught at any hour.
now_utc needs no restoring here: each test gets a fresh PredBat (#5102).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 59e0e5a commit 4e5268c
1 file changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
| |||
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
168 | 182 | | |
169 | 183 | | |
170 | 184 | | |
| |||
174 | 188 | | |
175 | 189 | | |
176 | 190 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 191 | + | |
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
| |||
0 commit comments