Skip to content

inbox tests read the wall clock: the fixture ages out of the 7-day window and main goes red (2026-10-27T00:55Z) #1305

Closed

Description

@Birfy

Written-by: Dev4

core/test/inbox.test.js builds its fixtures around a fixed NOW = Date.UTC(2026, 9, 20, 1, 0, 0) and passes now: NOW into inboxModel, but two assertions compare against needsCount(roster, work, tasks) — which is inboxModel({ roster, work, tasks }).needs.length, no now, so it reads the wall clock and its 7-day window (KEEP_MS) slides forward. From 2026-10-27T00:55Z the fixture's own failed turns fall out of that window, so inbox.test.js goes red on main and on every branch, with nobody touching inbox code. main's last green Test run was 59df1580 at 00:49Z, just before the edge.

Reproduce

$ git worktree add /tmp/base1299 3319753   # e37f1f83, parent of the release commit 59df1580
$ cd /tmp/base1299/core
$ DSH_HARNESS=<harness> TZ=UTC node --import ./test/harness-resolve.mjs --test --test-concurrency=1 test/inbox.test.js
not ok 2 - Needs you: my own Bots' approvals, held messages, and tasks that wait for me or failed in the last 7 days
  error: Expected values to be strictly equal: 6 !== 7
not ok 16 - a failed turn of my own Bot needs me while it is the latest turn in its chat and the Bot is not back at work there
  error: Expected values to be strictly equal: 6 !== 8
# fail 2

That tree is live main for these files: compare/e37f1f83...59df1580 touches only CHANGELOG.md, the removed changelog.d/ fragments, core/package.json, core/package-lock.json and patches/ds-bot/0007-version-and-tooling.patch, so core/test/inbox.test.js and core/src/client/inbox.js are byte-identical on main. It also reproduces on a branch with no inbox change: #1304 (8c256fbe) failed the same Node 24 job at 00:56:45Z (job 121943086386) while the rest of the suite was green.

Cause

test/inbox.test.js:122 and test/inbox.test.js:297 assert needsCount(...) equals model.needs.length, where model was built with now: NOW and needsCount was not. The two sides agree only while Date.now() - NOW < 7 days; after that the wall-clock window drops the fixture's cards one by one (first 6 !== 7, later 6 !== 8).

Expected

The two assertions compare the same two models, so the count must not depend on when the suite runs.

Scope

Test-only, one line each at core/test/inbox.test.js:122 and :297 — needsCount takes no clock today, so either give it an optional now (src/client/inbox.js:274) and pass NOW, or compare inboxModel({ roster, work, tasks, now: NOW }).needs.length. No shipping behaviour change.

Filed from #1299's CI red (#1304 at 8c256fbe): two other failures in that same job were mine and are fixed on the branch; this one is not.

Activity

  1. Birfy commented on Oct 27, 2026

    @Birfy
    CollaboratorAuthor

    Claiming this: branch dev/1305-inbox-badge-clock from main 59df1580de392b2157e254e16c900ec98af8450b.

    Fix shape (same as the interim 206fbadb on #1304, so the two branches merge cleanly): needsCount gains an optional now — export const needsCount = (roster, work, tasks, now) => inboxModel({ roster, work, tasks, now }).needs.length — and core/test/inbox.test.js:122 and :297 pass NOW. The expected values 7 and 8 stay exactly as they are; the assertion stops reading the wall clock, the numbers are not adjusted.

    Red first (test change only, source untouched): inbox.test.js 26 tests / 24 pass / 2 fail, 6 !== 7 at :122, 6 !== 8 at :297 — the same two cases main is red on. After the source line: 26/26.

    No behaviour change: the badge's own callers pass three arguments, so the default stays Date.now().

    Written-by: Dev

  2. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 27, 2026
  3. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 27, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions