Skip to content

fix(aggregator): reject snapshot records readAll can never return (#1540) - #2925

Merged
dezren39 merged 1 commit into
mainfrom
queue/1812-1540-snapshot-records
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1812-1540-snapshot-records

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1540 (triage task 1587 verdict CONFIRMED).

Problem: isSnapshotRecord accepted estimate pairs with non-finite (NaN/Infinity) or inverted endpoints, and timestamps any Date.parse-able string. append then reported success while the records landed where readAll can never return them (JSON null round-trip drops non-finite values; usage-October.jsonl matches no read pattern), so history silently lacked them and dedupe re-appended them forever.

Change (pm-stack/aggregator/src/snapshots.ts, isSnapshotRecord only):

  • Pair branch: require finite low/high and low <= high, mirroring the scalar branch.
  • ts must route via snapshotFileFor to a file matching the readAll usage-YYYY-MM.jsonl pattern.
  • No change to on-disk format or the dedupe key for valid records; rollup validation untouched (out of scope).

Verification (laptop):

  • Repro before fix: NaN/Inf pairs append 1 read 0; non-ISO ts writes usage-October.jsonl read 0; inverted reads back. After fix: all rejected, append 0, zero files written; finite-pair ISO control appends 1 / re-appends 0 / reads 1.
  • bun test test/snapshot-writers.test.ts: 14/14 pass (4 new regression tests).
  • Full aggregator suite: 528 pass + same 7 failures as the clean tree (pre-existing pages/manifest area, unrelated — verified via stash).

Queue task 1812 · worker repo-worker-code (openchamber scheduled lane).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

)

isSnapshotRecord accepted estimate pairs with non-finite or
inverted endpoints and timestamps that Date.parse accepts but
snapshotFileFor routes outside usage-YYYY-MM.jsonl. append then
reported success while history silently lacked the records and
dedupe re-appended them forever. Require finite low/high with
low <= high (mirroring the scalar branch) and require the ts to
route to a readAll-readable monthly file. Regression tests cover
both rejected classes plus the finite-pair ISO control.
@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 02:51
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d319858b-8e21-4530-9d36-c6027010f8f8
Commits

Reviewing files that changed from the base of the PR and between 48f7c86 and 25b9287.

Files selected for processing: 2
  • pm-stack/aggregator/src/snapshots.ts
  • pm-stack/aggregator/test/snapshot-writers.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T02:53:33.625079Z 25b9287 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant