Repository navigation
Description
pm-stack(aggregator): isSessionRecord accepts impossible and non-ISO lastSeenAt/startedAt — a non-ISO stamp wins merge recency forever, and impossible dates roll in registryActivityMs
Evidence
isSessionRecord (pm-stack/aggregator/src/registry.ts:166) gates the two
timestamps only on type: (r.lastSeenAt === undefined || typeof r.lastSeenAt === "string")
and the same for startedAt. That type check is the #2376 fix — it stops the
mergeRecords sort crash on non-string values — but it never checks that a
string timestamp is a real ISO calendar date. Every sibling store validator in
the aggregator gates timestamps with isIsoDate
(pm-stack/aggregator/src/validate.ts:116): snapshots (isSnapshotRecord),
quota rows (isSubscriptionRow, isChargeRow, isBurnSegment), saved views,
events, saas overlays. The registry record is the one boundary left on
string-only.
Verified on the laptop at origin/main 6a69ab52d (bun probe importing the
real modules):
isSessionRecordreturnstrueforlastSeenAt/startedAtof
2026-02-30T10:00:00Z,2026-04-31T10:00:00Z,March 2, 2026, and
not-a-date.registryActivityMs(pm-stack/aggregator/src/registry-view.ts:62,
Date.parse) then reports the impossible stamps as different instants than
the strings claim:2026-02-30→ 2026-03-02,2026-04-31→ 2026-05-01,
March 2, 2026→ 2026-03-02T06:00:00Z.mergeRecords(pm-stack/aggregator/src/registry.ts:136, lastSeenAt pick
at :158) compares the stamps as strings. Probe: merging a record stamped
2026-06-01T00:00:00Zwith one stampedMarch 2, 2026keeps
March 2, 2026as lastSeenAt in both merge orders — lexicographic
M>2, so a non-ISO stamp permanently wins recency and no later ISO
record can ever displace it. The merged record is also what the final sort
((b.lastSeenAt ?? "").localeCompare(...)) orders by, so the poisoned
stamp pins the session to the top of the registry ordering.
Consumers reached through the two load paths that filter on this validator
(sources/live.ts:795 registry store load, :1380 feed registry merge):
the sessions registry, registryActivityMs-based recency windows, and every
render that shows lastSeenAt/startedAt verbatim.
Control: 2026-03-02T10:00:00Z validates and parses to itself.
Why it matters
The registry is the fleet's session record of truth for the dashboard. One
malformed writer (or one hand-edited/corrupted store row) with a non-ISO
lastSeenAt becomes permanently "most recent" — it survives every later
merge, distorts recency windows and ordering, and displays a stamp that does
not mean what it says. Impossible dates silently shift a session's activity
by days. The fix is the house pattern already applied at every sibling
boundary.
Acceptance criteria
isSessionRecordrefuses a record whoselastSeenAtorstartedAtis
present and not a real ISO calendar date (isIsoDate), e.g.2026-02-30,
2026-04-31,March 2, 2026,not-a-date; absent timestamps stay allowed.- Valid ISO timestamps (incl. offsets/fractional seconds) still validate.
- Tests cover the refused and control cases for both fields;
bun testin
pm-stack/aggregatorpasses. - Out of scope: changing mergeRecords' comparison or the SessionRecord shape
(both are correct once inputs are real ISO).
Filed by new-issue-creator-code-a (lane A). Dedup: searches for
isSessionRecord, registry lastSeenAt (2026-11-03) — #3414/#2376 cover
non-string types only, #3525 covers status/agentLabel/tokensTotal, #4890
covers taskRefs; none covers timestamp validity.
Activity
dezren39 commentedon Nov 3, 2026
agent-note:v1
state: filed
Found via: filed this run (new-issue-creator-code-a, lane A) — verified by laptop bun probes at origin/main 6a69ab52d importing the real registry.ts/registry-view.ts modules: isSessionRecord accepts 2026-02-30, 2026-04-31, 'March 2, 2026' and 'not-a-date' as lastSeenAt/startedAt; registryActivityMs rolls Feb-30 to Mar 2 and Apr-31 to May 1; mergeRecords keeps 'March 2, 2026' over a June ISO stamp in both merge orders. Fix packet enqueued to repo-health-code-pilot (small_fix).
dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
isSessionRecord'slastSeenAt/startedAtwith the existingisIsoDatehelper when present (issue pm-stack(aggregator): isSessionRecord accepts impossible and non-ISO lastSeenAt/startedAt — a non-ISO stamp wins merge recency forever, and impossible dates roll in registryActivityMs #5078), with tests for impossible/non-ISO cases on both fields plus valid ISO controls.bun testgreen in pm-stack/aggregator, merged under the standing criteria.dezren39 commentedon Nov 3, 2026
🤖 Agent note · parked
bun teston the laptop: 1392 pass, 0 fail.queue/8711-5078-sessionrecord-isodatedezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
queue/8711-5078-sessionrecord-isodate) already implements the isIsoDate gate for issue pm-stack(aggregator): isSessionRecord accepts impossible and non-ISO lastSeenAt/startedAt — a non-ISO stamp wins merge recency forever, and impossible dates roll in registryActivityMs #5078 with the aggregator suite recorded passing (1392 pass, 0 fail on laptop). Revalidating PR fix(aggregator): gate isSessionRecord timestamps with isIsoDate (#5078) #5083 fresh — checks, Codex findings, diff vs intent — then merging under the standing criteria or parking on CI.Merge pull request #5083 from developing-today/queue/8711-5078-sessio…
dezren39 commentedon Nov 3, 2026
🤖 Agent note · done
queue/8711-5078-sessionrecord-isodate