Skip to content

Frontend heat test's fixed date makes fresh-file assertion expire #332

Closed

Description

@isac322

npm test has a date-dependent failure in the heat test. The runtime correctly uses the current clock, while the test labels a fixed date as “yesterday.” This is present in v0.18.1 and unchanged in the release candidate.

On 2026-11-03, the unmodified suite reports 204 passes and one failure. The same heat test fails on baseline 64b6af4609c70b3da886b6659ff10ed93c1a2475 and candidate 844e708096d400501f9da5e7f2869d9cfb1a705c.

Reproduce with Node 23 or newer:

cd internal/webapp/frontend
npm test

src/lib/heat.test.ts:250-258 sets now to 2026-08-18T00:00:00Z, derives yesterday from it, then calls staleNote(hot, yesterday) without passing that clock. staleNote uses daysSince(time), whose default clock is Date.now(). In November, that input is several months old and correctly produces a stale label instead of an empty string.

The runtime and test blobs are identical on both commits. An isolated measurement copy changing only this test's local fixture to const now = Date.now() passes all 205 tests with the same assertions. No runtime logic, timeout, or skip needs to change.

Suggested repair: derive this case's dates from the live clock, keeping the separate daysSince test's explicitly injected clock. The release candidate has not changed the repository test file.

Activity

  1. isac322 commented on Nov 12, 2026

    @isac322
    ContributorAuthor

    Fixed in #359 (merged to main as 6fa608a2e174bc7650dd29f968e2252447eda950, unreleased).

    staleNote (internal/webapp/frontend/src/lib/heat.ts) and buildExitSaveRequest (internal/webapp/frontend/src/lib/editbeacon.ts) now accept an optional now = Date.now() parameter like the rest of src/lib/, and heat.test.ts passes its pinned clock explicitly. Verified with npm test (305/305), Playwright dashboard.spec.ts and browse.spec.ts (90/90), and CI run 43221752564.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions