Skip to content

test(members): pin the clock in the retained-document age test - #14387

Closed
Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/crew-webview-pinned-clock
Closed

Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/crew-webview-pinned-clock

Conversation

@Pearcekieser

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The retained-document age test in CrewWebviewContainment.test.tsx passes on any date.

The test read the real clock. Its fixture was published at the fixed instant 2026-09-04T05:16:00, and the republish it compares against is dated three days before Date.now(). On the fixture's 23rd day the banner reads "Showing the version from 23d ago", and expect(text).not.toContain("3d ago") fails because "23d ago" contains "3d ago". It fails on main now, and it fails on every PR whose frontend shards run.

Why it matters

Frontend Tests (1) is red for every open PR until the clock moves past the window, about 2026-09-28 05:16 local time. The same collision comes back at any later pair of ages where one is a substring of the other.

Not a goal

  • Changing the component or how fmtRelative formats ages.
  • Auditing other tests for real-clock reads.

What changed (motivation → approach → change)

The two ages the test compares both moved with the real clock, so which strings they rendered depended on the day the suite ran. The test now pins "now" a week after the fixture instant with vi.useFakeTimers({ toFake: ["Date"] }) and vi.setSystemTime(...). The fixture then always reads "7d ago" and the republish "3d ago". Only Date is faked, so waitFor and react-query keep their real timers. afterEach calls vi.useRealTimers().

The age checks on the banner and on the bar chip match whole words, so one age can no longer pass or fail as a substring of the other.

Backwards compatibility

Compatible: test-only change in website/src/test/.

Tests

website/src/test/CrewWebviewContainment.test.tsx: all 44 tests pass locally on 2026-09-27, the day the unpinned test fails on main.

Manual verification

N/A. The change is test-only and the test file is the verification.

Screenshots / video

Why no screenshot: test-only change, nothing renders differently.

Related Issues

Fixes #14386

Pattern harvest

Rule candidate: review-prompt
Pattern: a test that renders a relative age from a fixed fixture date while reading the real clock, and asserts on the rendered string.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: Make the retained-document age test in CrewWebviewContainment.test.tsx independent of the day it runs, so it stops failing on main.
Not a goal: Changing the component, fmtRelative, or any other test.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

UX-level review of 97c923b47f188b869f374d76381fb53a53c5a03e via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] 97c923b

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 97c923b47f188b869f374d76381fb53a53c5a03e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 97c923b

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 97c923b47f188b869f374d76381fb53a53c5a03e via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 97c923b

The test read the real clock, so on the fixture's 23rd day the banner read "23d ago" and the not.toContain("3d ago") check failed on main. Only Date is faked; ages are matched as whole words.

Fixes kirodotdev#14386
@Pearcekieser
Pearcekieser force-pushed the fix/crew-webview-pinned-clock branch from 6790374 to 97c923b Compare September 27, 2026 06:54
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Head 97c923b47f is an identical-tree push, only the commit date changed, so there is no code change from 67903747c5. It reruns Opus 5 Review, which ended incomplete when the CI app hit its installation API rate limit, and Backend Tests (3.12, 2). Shard 2 failed test_ai_review_workflows.py::TestReviewLanesPublishOnlyTheReview::test_the_trim_and_count_execute_as_written, which passes locally on this tree and on main's latest run.

Backend Tests (3.12, 3), Backend Tests (Windows) (3) and Coverage Gate fail the same way on main. Shards 3 hit test_review_repair_routing_skill.py (prepare-pr skill 68015 > 68000 bytes). This PR touches neither.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 97c923b47f188b869f374d76381fb53a53c5a03e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 97c923b

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Superseded by #14398, which fixed the same main-red by asserting on the whole interpolated sentence. Closing.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: CrewWebviewContainment age assertion fails on main while the fixture is 23 days old

1 participant