Repository navigation
Description
Summary
freshness() in pm-stack/aggregator/src/derive.ts:852-868 ages date-only stamps by the UTC calendar day, while the same file's calendar helpers define "today" in America/Chicago (chicagoYmd, derive.ts:462-470, under the header "Calendar helpers (America/Chicago — Drew's timezone)"). The date-only branch (derive.ts:858-862) computes:
const startOfToday = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
const ageDays = Math.max(0, Math.round((startOfToday - t) / 86_400_000));
return { stale: ageDays > cadenceDays, ageDays };Its own comment states the intended semantics: "a read dated yesterday is 1 day old all day today". But with the UTC day boundary, "today" flips at 19:00 Chicago (CDT) / 18:00 (CST) — so for the last 5–6 hours of every Chicago day, a read dated today (Chicago) already reports ageDays: 1, and a service whose cadence is tight flips to stale on the very day it was read. The rendered surfaces inherit it: freshnessStamp (render.ts:1651-1659, prints "· 1d ago" / the stale badge) and the SaaS service cards/detail (render.ts:1704, render.ts:1889).
Verified (this run, on main be7cf62)
Probe ON THE LAPTOP (Bun 1.4.2, driving the real derive.ts — sha256 312ac0fb… identical in both clones; probe + log in the goal's hidden_files/probe-2026-10-28-laneB-horizondate/probe3.ts + out3.log, output identical across runs):
now = 2026-10-28T01:30:00Z (= 2026-10-27 20:30 Chicago)
chicagoYmd(now) = 2026-10-27 (the file's own "today")
freshness('2026-10-27', 7, now) = { stale: false, ageDays: 1 }
<- a read dated TODAY (Chicago) is already "1 day old"
freshness('2026-10-27', 0, now) = { stale: true, ageDays: 1 }
<- at cadence 0 it is STALE on the day it was read
now = 2026-10-28T06:30:00Z (= 2026-10-28 01:30 Chicago)
chicagoYmd(now) = 2026-10-28
freshness('2026-10-27', 7, now) = { stale: false, ageDays: 1 } (correct: yesterday)
So the same measuredAt is aged 0 for the first ~19 hours of its Chicago day and 1 for the remaining ~5 — the age (and any stale verdict at the boundary) depends on the time of day in a way neither the comment nor the file's Chicago convention intends. The datetime branch below it (derive.ts:864-867) ages by elapsed whole days and is unaffected; only date-only stamps (the hub's dated reads — quota-view / SaaS measuredAt dates) take the UTC-calendar branch.
Why it matters
Every hub card's freshness stamp and stale badge derives from this function. Date-only reads are the common case for the manually-read SaaS/quota services, and their cadences are in days: being aged a day early for a quarter of every day makes cards flicker to "1d ago"/stale each evening and back — noise on exactly the honesty surface (#1139/#1140 family) whose job is to state data age truthfully, and a false stale can mask (or train Drew to ignore) a genuinely stale source. It is also an internal inconsistency: two functions in one file disagree about what day it is.
Distinct from #1568/#1541/#1564 (future/garbage timestamps pinning freshness forever in freshness callers / quota-current / feed gates — those are missing upper-bound/parse checks; this one is a wrong day-boundary for perfectly valid, past, date-only stamps) and from #1587 (julesSummary HHMM key rollover).
Acceptance criteria
- For a date-only
measuredAt,ageDaysis the number of whole America/Chicago calendar days between the stamp's date and today-in-Chicago: a stamp dated today (Chicago) reportsageDays: 0at every hour of that day, and yesterday's stamp reports1all day. - A date-only read cannot flip to
stalebefore its Chicago calendar age actually exceedscadenceDays(boundary case pinned by a test at e.g. 20:30 Chicago on the stamp's own date, cadence 0). - Regression tests cover the evening-Chicago case (UTC date = Chicago date + 1) and the early-morning control, for both the age value and the stale verdict; the datetime branch's behaviour is unchanged.
- Existing aggregator test suites still pass.
Activity
developing-today commentedon Oct 28, 2026
CODE-650
dezren39 commentedon Oct 28, 2026
🤖 Agent note · filed
3 remaining items
dezren39 commentedon Oct 31, 2026
🤖 Agent note · picked up
repo-worker-code, lane E shiftMerge pull request #3030 from developing-today/queue/4064-1629-freshn…
dezren39 commentedon Oct 31, 2026
🤖 Agent note · fixed and merged
92979e4bb1010b894161725a3583d96a59fd51ec; this issue is closed by the merge.freshness()'s date-only branch now takes "today" from the existingchicagoYmd(now)(America/Chicago) instead of the UTC date; datetime stamps and the aggregator: a future-dated read is 'today' forever until its date passes — derive freshness() has no upper bound, so one skewed measuredAt pins a hub card fresh for weeks #1568 future-tolerance shape are unchanged.bun test test/usage.test.ts32/32; full aggregator suite 557 pass with only the 7 pre-existing page-manifest/render failures also present on clean main; Codex review of the PR head completed with no findings. No PR-triggered CI workflow covers pm-stack/aggregator.