Skip to content

test(project-data): ticket-lifetime test bounds from the clock, not an assumed 2 s - #494

Merged
anandtopu merged 1 commit into
mainfrom
fix/export-ticket-ttl-test-race
Nov 27, 2026
Merged

anandtopu merged 1 commit into
mainfrom
fix/export-ticket-ttl-test-race

Conversation

@anandtopu

Copy link
Copy Markdown
Contributor

Summary

Backend — Test & Lint failed on main at bc71694c (run 45937142204) on one test of 25,524: tests/test_project_data_download.py::test_the_ticket_lives_no_longer_than_the_export.

The test sets an export to expire in 30 s and required the download ticket's lifetime to be 28 to 30 s, assuming minting takes under 2 s. On a loaded runner it took over 3 s; the ticket correctly got 26 s (min(60, whole seconds left)) and the test failed:

assert (26 == 26 and 28 <= 26)

The product is right. The test now reads its lower bound from the clock just after minting, which brackets the product's formula at any runner speed. The upper bound (30 s, under the 60 s cap) is unchanged. The next main run (955292f0) passed, which confirms it is timing.

Verification

  • tests/test_project_data_download.py: 59 passed.
  • Simulated 3.5 s slow mint: passes (the old bound fails, as on CI).
  • Mutants: a ticket ignoring the export's expiry (60 s) fails; one 5 s short fails.

Checklist

  • Test and CHANGELOG only; no product code
  • Pushed with SKIP_PUSH_CHECK=1 at the owner's request (the local gate failed twice this week on unrelated timing tests under machine load); CI runs the full suite

🤖 Generated with Claude Code

…n assumed 2 s

test_the_ticket_lives_no_longer_than_the_export set the export to expire
in 30 s and required the ticket's lifetime to be 28 to 30 s. On a loaded
CI runner (main bc71694, Backend - Test & Lint) minting took over 3 s, the
ticket correctly got 26 s, and the test failed. The lower bound is now the
whole seconds left on the export read just after minting, which brackets
the product's min(60, seconds left) exactly at any runner speed.

Mutation-checked: a ticket ignoring the export's expiry (60 s) and one
5 s short both fail; a simulated 3.5 s slow mint passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anand Topu <anand.goud.2020@gmail.com>
@anandtopu
anandtopu merged commit 7ad126f into main Nov 27, 2026
42 checks passed
@anandtopu
anandtopu deleted the fix/export-ticket-ttl-test-race branch November 27, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant