fix: Prevent microsecond drift when offsets are equal in e2e test#504
fix: Prevent microsecond drift when offsets are equal in e2e test#504nahua-aignx merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky E2E test failure caused by capturing datetime.now() twice when due_date_seconds and deadline_seconds are configured to the same offset, which could yield a due_date slightly after deadline and trigger a 422 from SAMIA validation.
Changes:
- Capture a single
now = datetime.now(tz=UTC)timestamp in_submit_and_validate. - Derive both
due_dateanddeadlinefrom the samenowto avoid microsecond drift.
|
Claude finished @nahua-aignx's task in 4m 45s —— View job Code Review Complete ✅I've thoroughly reviewed PR #504. The fix correctly addresses the microsecond drift issue, but there's a critical concern that needs clarification. SummaryChange: Prevents microsecond drift by capturing Files Changed: ✅ Strengths
|
e829d1e to
c5b1811
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. |
c5b1811 to
3140b42
Compare
|



Addressing this production issue. The cause is from
e2e_test.py. When test constants use identical values for due_date_seconds and deadline_seconds (e.g.TEST_APPLICATION_SUBMIT_AND_FIND_*both set to 1 hour,HETA_APPLICATION_SUBMIT_AND_FIND_*both set to 24 hours), the secondnow()call executes a few hundred microseconds later, producing adue_datethat's fractionally after thedeadline. SAMIA'sSchedulingRequestvalidator enforcesdue_date < deadlineand correctly rejects this with a422. The fix capturesnow = datetime.now(tz=UTC)once and derives bothdue_dateanddeadlinefrom that single timestamp, guaranteeing their relative ordering is determined solely by the configured offsets.