Skip to content

fix(test): de-flake the KEV inline-due-date test (date time bomb)#479

Merged
haksungjang merged 1 commit into
mainfrom
fix/kev-due-date-test-timebomb
Jul 8, 2026
Merged

fix(test): de-flake the KEV inline-due-date test (date time bomb)#479
haksungjang merged 1 commit into
mainfrom
fix/kev-due-date-test-timebomb

Conversation

@haksungjang

Copy link
Copy Markdown
Contributor

Symptom

test (frontend) is failing on mainVulnerabilityDetailBody.test.tsx:170:

AssertionError: expected 'Due in 7 days' to contain '2026-07-15'

This blocks every PR (it surfaced on the pytest-9 PR, which touches no frontend code).

Cause

The test asserts the inline kev-badge-due-date renders the absolute string 2026-07-15. But VulnerabilityDetailBody does not inject a now into KevBadge, so the inline text is computed against the real clock. dueDateStatus flips to the relative "Due in n days" format inside a 7-day imminent window (IMMINENT_WINDOW_DAYS = 7), so from 2026-07-08 through 2026-07-15 the element renders "Due in 7 days" and the assertion fails. A hardcoded near-future date is a time bomb.

Fix

Use a far-future due date (2099-12-31) so this surface's real-clock computation always lands in the "ok" (absolute-date) branch regardless of run date. The state-aware relative/absolute formatting is already covered deterministically in KevBadge.test.tsx via its injected now, so coverage is unchanged.

Verified by CI (test (frontend)) — the suite does not run in the local sandbox.

VulnerabilityDetailBody.test.tsx asserted the inline kev-badge-due-date renders
"2026-07-15", but VulnerabilityDetailBody does not inject a `now` into KevBadge,
so the inline text is computed against the REAL clock. dueDateStatus flips to the
relative "Due in n days" format inside a 7-day imminent window, so from
2026-07-08 through 2026-07-15 the element renders "Due in 7 days" and the test
fails — on main, blocking every PR for that week (it first bit the pytest-9 PR).

Use a far-future due date (2099-12-31) so this surface's real-clock computation
always lands in the "ok" (absolute-date) branch regardless of run date. The
state-aware relative/absolute formatting is already covered deterministically in
KevBadge.test.tsx via its injected `now`, so nothing is lost here.
@haksungjang haksungjang merged commit 61ae8a4 into main Jul 8, 2026
20 checks passed
@haksungjang haksungjang deleted the fix/kev-due-date-test-timebomb branch July 8, 2026 12:14
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