Repository navigation
Description
Follow-up to #2568.
recordsFromProviderUsage in pm-stack/aggregator/src/snapshot-records.ts:296-313 checks only typeof used_percent === "number" before emitting a pct record. The append CLI filters records through isSnapshotRecord (append-usage-snapshots.ts:71), whose current guard rejects negative pct values (snapshots.ts:317-323) but accepts finite values above 100. A real-module probe on main 199d9f2e222c17826533dc3d9320aebd88aab533 confirmed: -20 is emitted but rejected by the store; 150 and 1e9 are emitted and accepted; 42 is emitted and accepted. The original #2568 report that negative values pass the current store gate is stale, but the upper-bound defect remains.
Goal
Skip an invalid Codex window rather than clamp or invent a value, while continuing to derive the session record and any other valid window.
Acceptance
recordsFromProviderUsageemits a Codex window only whenused_percentis finite and in the inclusive range [0,100].snapshot-writers.test.tscovers negative and >100 values, plus valid boundary/control values; an invalid window does not suppress the other valid window or the sessions record.- Existing
bun test test/snapshot-writers.test.tspasses.
Scope
Writer-side recordsFromProviderUsage and its focused tests only. Do not change the general store gate, other snapshot writers, or rollup validation (#3365). No clamping.
Acceptance criteria
- Snapshot records whose Codex
used_percentis NaN, infinite, or outside [0,100] are skipped (with the existing drop accounting, if any) instead of being recorded. - In-range values, including exactly 0 and exactly 100, are recorded unchanged.
- Tests cover below-range, above-range, and non-finite inputs alongside an in-range control.
Activity
developing-today commentedon Nov 1, 2026
CODE-1325
dezren39 commentedon Nov 1, 2026
🤖 Agent note · queued
used_percentinrecordsFromProviderUsage, with focused tests.dezren39 commentedon Nov 1, 2026
Intake review
Related: same drop-gate family as #2582 (shared [0,100] drop-gate pin, triage task 3837) and the charge-row gates in #3458 — worth the worker checking whether one shared guard now covers all three. No merged PR references this issue as of this run.
Notes: the sibling triages pinned that out-of-shape rows must fail closed at the boundary rather than clamp — clamping a >100 reading to 100 would silently fabricate a full-quota signal. Risk: low.
Suggested approach: apply the established finite-range guard at the snapshot-record boundary and mirror the sibling fix's test shape.
🤖 Agent note · done
dezren39 commentedon Nov 2, 2026
Picked up: OpenChamber scheduled lane claimed queue task 5391 via atomic claim.
used_percentbounds inrecordsFromProviderUsageand focused snapshot-writer tests.3 remaining items
dezren39 commentedon Nov 2, 2026
Parked: Queue task 5391 is parked for 20 minutes while PR checks run.
pm-aggregator testscheck is still QUEUED.bun test test/snapshot-writers.test.tspasses (20 tests, 59 assertions);git diff --checkpasses.bun run typecheckis blocked because@types/bunis missing in this worktree.