Skip to content

doc(#9572): C4 quota forecasting design — prediction record, scoring, methodology log - #13268

Merged
dezren39 merged 1 commit into
mainfrom
felix/9572-c4-design
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
felix/9572-c4-design

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Refs #9572 (acceptance item 1 of 3; the issue stays open for items 2–3, filed as C4.1–C4.6 below).

What this is

The C4 component design, landed in the #9568 program folder beside the C7 design (c7-rollups-design.md): c4-forecasting-design.md.

Done check behind it (verified against origin/main 1edebd5)

The Stage-3 line already covers ONE C4 kind — per-pool exhaustion as a point projection, published per tick (S1 #12695 / PR #12724) and scored (S2 #12696: accuracy ledger + backtest, 5,028 forecasts). The design grounds itself in that product instead of restating it, and specifies what it does not cover:

  • a prediction record of record — mandatory singular basis (S2.14), range as a first-class value calibrated by the S2 error ledger, stored rendered string (S2.13 formats), methodology version, honesty states;
  • scoring rules per kind, incl. range coverage/width on top of S2's wall-error/precision/recall;
  • the methodology-change log format (S2.5) with an operational definition of "relatively accurate";
  • downtime windows (S2.4), reset durations (S2.13), day-type + spike-day adjustments (S2.6/S2.7 — models defined, admitted per-cell by the Stage-3 sufficiency gate, not waived), model/plan arrivals (S2.3, honesty-first), forecast push alerts (S2.12 C4 half, via the S5 alerts-ledger precedent).

Gate check: #9572 is NOT gated on the C3 chain (#9571 / PR #12226) — its substrate (gatherer, snapshot store, Stage-3 forecast product, alerts ledger) is live; the design records this explicitly.

Remainder, filed under #9572

Docs only; no code, no new dependencies, no schedule created or changed.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…coring rules, methodology-change log

Acceptance item 1 of #9572. Grounds the design in the landed Stage-3
forecast product (S1 #12695, S2 #12696) and specifies what it does not
cover: downtime windows, reset-duration ranges, day-type/spike
adjustments (data-gated), model/plan arrivals, forecast push alerts.
Live-loop remainder filed as #13257, #13258, #13259, #13260, #13261,
#13262.
@coderabbitai

coderabbitai Bot commented Nov 23, 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 59 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: 1fb2edd9-d9be-4ad0-b523-4ef05a6c8725
Commits

Reviewing files that changed from the base of the PR and between 795b240 and a5785f3.

Files selected for processing: 1

  • doc/2026-11-13T15-12-00Z_design_reporting-architecture-event-driven/c4-forecasting-design.md
  • 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 Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T12:44:13.107016Z a5785f3 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.

@dezren39
dezren39 merged commit c1700bc into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the felix/9572-c4-design branch November 23, 2026 12:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5785f3bbf

ℹ️ 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".

```jsonc
{
"record_version": 1,
"id": "c4:<kind>:<subject-key>:<issued-at-epoch-ms>",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the basis in prediction record IDs

When §2 publishes parallel since_last_reset and trailing_30d forecasts for the same pool/window on one gatherer tick, both records receive the same ID under this format. That makes ID-based supersession and attribution of scores to individual predictions ambiguous, undermining the stated head-to-head comparison of bases. Include the basis and any concurrently published model variant in the record identity, or use a unique ID independent of the subject and issuance timestamp.

Useful? React with 👍 / 👎.

Comment on lines +289 to +290
`postIncident` precedent, source `quota-prediction`, deduped on
the prediction record id, thresholded per S3.15's selectivity

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Deduplicate forecast alerts by the predicted event

For a downtime or workhorse-wall forecast that persists across gatherer ticks, deduplicating on the prediction record ID creates a fresh alert each tick: §1 makes that ID issuance-time-specific, while AlertsStore.postIncident in pm-stack/aggregator/src/alerts.ts suppresses duplicates only for matching (source, incident_key). The selectivity threshold limits which forecast kinds alert, but does not suppress repeated alerts for the same impending outage. Use a stable event/episode key for alert deduplication and retain the prediction ID as supporting detail.

Useful? React with 👍 / 👎.

dezren39 added a commit that referenced this pull request Nov 23, 2026
)

Publish downtime_window prediction records on gatherer ticks, in
the C4 design's record format (doc/2026-11-13T15-12-00Z_design_
reporting-architecture-event-driven/c4-forecasting-design.md §1/§7,
landed by PR #13268): appended to quota-predictions.jsonl beside
the forecast product and mirrored into the Turso ledger under the
C4 source "quota-prediction".

src/quota-downtime.ts derives each record from the tick's Stage-3
forecast product (#12695): per-pool wall intervals [wall, reset)
intersected across every routing pool (canonical provider id);
earliest = the last member wall, latest = the earliest member
reset; basis since_last_reset, named with its detail; the §4
range rendering stored at issuance; supersedes linked from the
log's tail. Honesty per §1 and #13257 criterion 3: providers the
forecast cannot project publish insufficient_history with a named
reason (and veto a no-window verdict); an overlap no member reset
bounds is an honesty state, not an unbounded prediction; a
defensible no-window tick publishes no record — absence is the
scored no-prediction signal. First methodology entry c4-meth:1
recorded in c4-methodology-log.jsonl (§6).

Acceptance: criteria 1 (records published on gatherer ticks) and
3 (honesty state) of #13257. Criterion 2 (scoring per §3 in the
accuracy ledger) is the next slice; the mirrored records are its
input.

Tests: src/quota-downtime.test.ts (15 tests: record shape,
intersection range, in-progress windows, union within a provider,
disjoint overlaps, honesty states, supersedes, §4 rendering,
ledger mirror), mutation-checked; the gather-quota integration
test now also asserts the tick appends the downtime record.
Oracle: the C4 design §1/§7 over the #12695 forecast product.
dezren39 added a commit that referenced this pull request Nov 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant