You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pm-stack(aggregator): recordsFromProviderUsage accepts impossible/non-ISO generated_at — Date.parse-only gate yields records isSnapshotRecord refuses, so the append CLI silently drops the whole provider-usage snapshot #5140
recordsFromProviderUsage (pm-stack/aggregator/src/snapshot-records.ts:274) gates the provider-usage snapshot's generated_at with a NaN-only Date.parse check at :282:
if(!ts||Number.isNaN(Date.parse(ts)))return[];
Date.parse rolls impossible calendar dates (2026-02-30 → Mar 2, 2026-04-31 → May 1) and accepts non-ISO strings ("March 2, 2026"), so such a stamp passes this gate and is copied verbatim onto every derived record — the sessions count and both Codex windows.
Why it matters
The store's own validator refuses exactly these stamps: isSnapshotRecord (pm-stack/aggregator/src/snapshots.ts:330) requires isIsoDate(r.ts) — "Real calendar dates only (#2264/#2483)". The only live caller, scripts/append-usage-snapshots.ts:88 (--from-provider-usage mode), silently filters derived records through isSnapshotRecord. Net effect: one impossible or non-ISO generated_at silently discards the entire provider-usage snapshot (sessions observation + Codex pct history) with no legible reason — the run just reports fewer/no records appended. The derivation boundary is the right place to refuse, legibly, exactly as this file's sibling derivations already produce only real-calendar stamps (snapshot-records.ts already imports parseIsoDate from validate.ts).
Evidence (verified this run, origin/main d94b895, laptop bun probe)
Dedup: no open or closed issue covers this function/field — #3460/#2568 (closed) are the used_percent range in the same function; #3379 (closed) is the sibling recordsFromDeepseekBalance date-shadow bug, a different function.
Acceptance criteria
recordsFromProviderUsage returns [] for generated_at values "2026-02-30T10:59:33Z", "2026-04-31T10:59:33Z", and "March 2, 2026" (gate with isIsoDate/parseIsoDate from validate.ts, the same strict primitive isSnapshotRecord uses).
Valid control unchanged: "2026-10-26T10:59:33Z" still yields the sessions record plus the Codex window records, all passing isSnapshotRecord.
Garbage ("not-a-date") and missing generated_at still yield [].
New tests in pm-stack/aggregator/test/snapshot-writers.test.ts cover the impossible/non-ISO refusals and the valid control; bun test in pm-stack/aggregator passes.
agent-note:v1
state: filed
agent: new-issue-creator-code-a
Found via: filed this run — read snapshot-records.ts recordsFromProviderUsage (:274-282, NaN-only Date.parse gate on generated_at) against isSnapshotRecord's isIsoDate gate (snapshots.ts:330) and its only caller append-usage-snapshots.ts:88; verified with a laptop bun probe at origin/main d94b895: impossible 2026-02-30 / 2026-04-31 and non-ISO 'March 2, 2026' generated_at each yield 2 records stamped verbatim that all fail isSnapshotRecord (whole snapshot silently dropped by the CLI filter), garbage yields [], valid ISO control passes both gates. Dedup clean (#3460/#2568 closed = used_percent range in same function; #3379 closed = sibling recordsFromDeepseekBalance). Filed-only; fix packet enqueued to repo-health-code-pilot.
Activity
dezren39 commentedon Nov 3, 2026
agent-note:v1
state: filed
agent: new-issue-creator-code-a
Found via: filed this run — read snapshot-records.ts recordsFromProviderUsage (:274-282, NaN-only Date.parse gate on generated_at) against isSnapshotRecord's isIsoDate gate (snapshots.ts:330) and its only caller append-usage-snapshots.ts:88; verified with a laptop bun probe at origin/main d94b895: impossible 2026-02-30 / 2026-04-31 and non-ISO 'March 2, 2026' generated_at each yield 2 records stamped verbatim that all fail isSnapshotRecord (whole snapshot silently dropped by the CLI filter), garbage yields [], valid ISO control passes both gates. Dedup clean (#3460/#2568 closed = used_percent range in same function; #3379 closed = sibling recordsFromDeepseekBalance). Filed-only; fix packet enqueued to repo-health-code-pilot.
dezren39 commentedon Nov 3, 2026
Picked up: OpenChamber scheduled lane claimed task 8819 via atomic queue claim.
dezren39 commentedon Nov 3, 2026
Done: OpenChamber scheduled lane completed task 8819 with PR #5173 open.
recordsFromProviderUsagenow rejects impossible and non-ISOgenerated_atstamps throughparseIsoDate; valid records remain accepted.git diff --checkclean.pr_opened; CI pending.