Commit 7597547
Expire a claim by the test's clock, not the database's (#166)
AnExpiredTokenDoesNotCompleteAClaim has been failing on main since some
time on 2026-08-31, with nothing changed to cause it. The date caused it.
ExpireAsync wrote `expires_at = now() - interval '1 day'` -- the database's
wall clock -- while the query it is setting up compares expires_at against
the injected clock. The two agreed only while real time stayed behind the
seeded clock plus the lifetime under test, and that window closed on its
own:
Seed.Now 2026-07-30 12:00Z
+ PendingLifetime + 1 day 2026-08-30 12:00Z <- what the query compares
now() - 1 day 2026-08-30 15:25Z <- what the row said
Once the real calendar passed 2026-08-31 12:00Z the row stopped being in
the past as far as the query was concerned, so an expired token began
reading as Verified. The last green run on main was 2026-08-29.
The clock is injected precisely so that "later" is a fact rather than a
sleep; reaching for now() in the middle of that gave the test a dependency
on the day it happened to run. It now expires relative to the clock the
query uses, which is deterministic by construction.
Found while opening #165, whose CI this was failing. Unrelated to that
change -- it reproduces on unmodified main.
641 MUI.Catalog.Tests green.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent f04b833 commit 7597547
1 file changed
Lines changed: 20 additions & 4 deletions
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
446 | 462 | | |
447 | 463 | | |
448 | 464 | | |
449 | 465 | | |
450 | | - | |
451 | | - | |
| 466 | + | |
| 467 | + | |
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
| |||
0 commit comments