Repository navigation
feat(pm-aggregator): C4.2 reset-duration prediction records (#13258 builder slice) - #13352
Conversation
|
Warning Review limit reachedYou'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 50 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2741f3cb14
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!Number.isFinite(o.resetsAt)) { | ||
| // A reading that reports no reset still observes the open | ||
| // period; it delimits nothing. | ||
| if (current !== null) current.lastTs = o.ts; |
There was a problem hiding this comment.
Avoid extending reset periods with post-reset null readings
When resetsAt disappears across a rollover, null readings after the old published reset unconditionally advance current.lastTs. When the next reset is eventually published, the midpoint calculation treats that publication delay as positive reset jitter, shifting subsequent reopening predictions late even if resets occurred exactly on schedule. The referenced accuracy harness handles this distinction in quota-forecast-accuracy.ts:259–267, where null readings at or beyond the prior reset start an unknown-reset period. Preserve that distinction here and avoid claiming measured jitter when the rollover cannot be bounded reliably.
Useful? React with 👍 / 👎.
New pure module pm-stack/aggregator/src/quota-reset-duration.ts implementing the builder slice of the C4.2 reset-duration kind, per the C4 design (PR #13268, sections 1/4/7) and the prepared scope recorded on the issue by Lane WC. - ResetDurationRecord in the design's section-1 shape: kind reset_duration, subject pool+window, singular basis reset_cadence, methodology c4-meth:1, supersedes link. - Reopening range: anchored on the published resetsAt when one exists, ranged by the reset jitter observed over completed reset periods (realized resets estimated at the midpoint of the bracketing readings); with no published reset, projected one observed cadence interval past the last published reset. - earliest == latest refused: a degenerate spread widens to the observation resolution (half the median reading gap). - Honesty states with named reasons: no_basis (no snapshot history) and insufficient_history (no completed period, or the ranged reopening already in the past — stale inputs). - Rendered strings from the one shared section-4 formatter (renderPredictionRange in quota-downtime.ts), stored at issuance; ledger mirror rows under source quota-prediction. Tests: quota-reset-duration.test.ts, 13 tests — jitter-spread range construction from synthetic snapshot history, degenerate spread widening, subject selection (walled + near-wall only), both honesty states, stale-input guards, cadence projection, the section-4 duration and calendar rendering forms, and the ledger mirror.
2741f3c to
a0953e6
Compare
|
Fix-forward for the Codex P2 finding (null readings across a rollover), head now
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0953e6ef4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Four completed periods (5h cadence), jitter +15/-15/+15/-15 | ||
| // minutes, current period published at +6h. | ||
| const JITTERED = history([-20, -15, -10, -5, 6], [15, -15, 15, -15], -22, -0.5); |
There was a problem hiding this comment.
Add generated invariant/model coverage for cadence predictions
The added tests use only fixed histories and hand-written expectations, although the new cadence segmentation and range construction have meaningful invariants and an explicit C4 specification. This violates the testing doctrine in AGENTS.md, which requires property-based coverage for invariants and model-based tests where a specification exists; naming the oracle does not satisfy those separate requirements. Add generated reset histories checked against an independent model, including observation-order independence, strictly ordered prediction bounds, and honesty states when no completed period is available.
AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.
Refs #13258 — C4.2 builder slice, landed under Drew's 2026-11-23 batch approval of the flag holds, adopting Lane WC's prepared scope (its hold record on the issue) after WC's lane ended on the platform flag.
What this lands
pm-stack/aggregator/src/quota-reset-duration.ts(pure, no I/O) +quota-reset-duration.test.ts:reset_durationprediction record in the C4 design's §1 shape (c4-forecasting-design.md, PR doc(#9572): C4 quota forecasting design — prediction record, scoring, methodology log #13268): subject pool+window, singular basisreset_cadence(§7), methodologyc4-meth:1, supersedes link, inputs naming the rename-joined series (forecastSeriesKey).resetsAtwhen one exists, ranged by the reset jitter observed over completed reset periods (realized resets estimated at the midpoint of the bracketing readings — the finest estimate the sampling supports); with no published reset, projected one observed cadence interval past the last published reset, ranged by cadence spread + jitter.earliest == latestis refused per §1: a degenerate spread widens to the observation resolution (half the median reading gap).renderedstring comes from the one shared §4 formatter (renderPredictionRangeinquota-downtime.ts) at issuance — duration form and the natural-language calendar form (America/Chicago day names/dayparts) covered by tests.no_basis(no snapshot history for the pool/window) andinsufficient_history(no completed reset period measured, or the ranged reopening already lies in the past — stale inputs). Windows neither walled nor projected to wall before reset publish no record.quota-prediction(design §1), payload verbatim.What remains on #13258 (issue stays open)
Verification
bun test src/quota-reset-duration.test.tson the laptop: 13/13 pass (jitter-spread construction, degenerate widening, subject selection, both honesty states, stale guards, cadence projection, both rendering forms, ledger mirror).Two design-vs-implementation notes are recorded on the issue (the §4 compound example form and the §4 day form's reachability in the shared formatter) — neither blocks this slice; the shared formatter is the shipped §4 interpretation and this module reuses it rather than forking a second one.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T14:08:48Z", "session_id": null, "lane": null, "host": "amd", "worktree": "/home/user/wt-lane-yb-13258", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/wt-lane-yb-13258", "repo": "developing-today/code", "branch": "lane-yb-13258", "sha": "2741f3cb149057756dacfca6bfee8ee46c449e55" }, "auth_subject": "agent-next-20-local", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.