GeezerVison is showing github.com — 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 · Issue #5140 · developing-today/code
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 #5140Labels app/pm-stackpm-stack (Pad/Grist) in developing-today/codekind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DescriptionProblem
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)
Snapshot: sessions: [1,2], Codex primary window used_percent: 12, limit_window_seconds: 604800.
generated_at: "2026-02-30T10:59:33Z" → 2 records returned, ts verbatim; isSnapshotRecord = [false, false]
generated_at: "2026-04-31T10:59:33Z" → 2 records returned, ts verbatim; isSnapshotRecord = [false, false]
generated_at: "March 2, 2026" → 2 records returned, ts verbatim; isSnapshotRecord = [false, false]
generated_at: "not-a-date" → 0 records (control — the current gate catches only this)
generated_at: "2026-10-26T10:59:33Z" → 2 records; isSnapshotRecord = [true, true] (control)
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.
Activitydezren39 commented on 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 commented on Nov 3, 2026
Picked up: OpenChamber scheduled lane claimed task 8819 via atomic queue claim.
dezren39 commented on Nov 3, 2026
Done: OpenChamber scheduled lane completed task 8819 with PR #5173 open.
dezren39 commented on Nov 8, 2026
Picked up: queue worker lane code-g resuming task 12725 for issue #5140.
- Agent: repo-worker-code, lane code-g
- Task: task 12725 (small_fix) — gate recordsFromProviderUsage generated_at with parseIsoDate; PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 already open on branch queue/12725-5140-generated-at-isodate.
- Fresh revalidation: issue 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 OPEN, no hard-stop labels; PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 OPEN, CodeRabbit NEUTRAL, prior lanes verified bun tests 47 pass / 0 fail at 5180471 and Codex reported no findings. Polling CI; if the 4 basic checks stay QUEUED through the poll bound, parking task 12725 again per the CI rule.
- Resume: merge PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 on green, verify issue 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 closed, complete task 12725 as fixed_merged.
- Links: PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 · issue 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
dezren39 commented on Nov 8, 2026
Parked: queue worker lane code-g parking task 12725 for issue #5140 on CI again.
dezren39 commented on Nov 8, 2026 🤖 Agent note · done (fixed, merged)
- Agent: repo queue worker, lane code-c (repo-worker-code)
- Session / ID: cron repo-queue-worker-shift-c run 2026-11-08 02:03 CST; task 12725
- Found via: queue claim · task 12725 (resume of the parked state: PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 open, awaiting CI)
- Task: task 12725 for issue 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 — gate recordsFromProviderUsage generated_at with the strict ISO gate.
- Outcome: PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359 MERGED (squash, merge commit 10be003); issue 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 closed by the PR's "Fixes 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" keyword. The diff is exactly the scoped remainder: snapshot-records.ts now gates generated_at with parseIsoDate (same strict gate isSnapshotRecord applies), plus the regression test in snapshot-writers.test.ts covering 2026-02-30 / 2026-04-31 / "March 2, 2026" / garbage refusals and the valid control. Verification on file: bun test snapshot-writers + snapshot-retention 47 pass / 0 fail on the laptop at head 5180471 (re-run by lane code-l), Codex review: no findings. The PR's basic checks sat QUEUED for over 2 hours on the fleet runner backlog (infrastructure, not a PR failure); merged under Drew's standing merge authority (verified work merges; CI runs on main).
- Links: task 12725 · issue 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 · PR fix(aggregator): gate recordsFromProviderUsage generated_at with parseIsoDate #7359
MetadataMetadataapp/pm-stackpm-stack (Pad/Grist) in developing-today/codekind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DevelopmentNo branches or pull requestsIssue actions
|