fix(test): de-flake the KEV inline-due-date test (date time bomb)#479
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
test (frontend)is failing on main —VulnerabilityDetailBody.test.tsx:170: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-daterenders the absolute string2026-07-15. ButVulnerabilityDetailBodydoes not inject anowintoKevBadge, so the inline text is computed against the real clock.dueDateStatusflips 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 inKevBadge.test.tsxvia its injectednow, so coverage is unchanged.Verified by CI (
test (frontend)) — the suite does not run in the local sandbox.