GeezerVison is showing github.com — impl(quota-plane): stage-3 S1 — forecast product: per-tick quota-forecast from the analytics pace math · Issue #12695 · developing-today/code
impl(quota-plane): stage-3 S1 — forecast product: per-tick quota-forecast from the analytics pace math #12695DescriptionStage-3 epic #12694, slice S1. Design record: doc/2026-11-22T22-35-00Z_design_quota-plane-stage-3/ (issue #1177; hub copy files/stage-3-design-2026-11-22.md in the usage-billing-hub goal files).
Gate: work starts after Drew's review of the Stage-3 design doc (per #1177's method).
Scope: Promote the existing per-window pace projection (pm-stack/aggregator/src/quota-analytics.ts, today display-only on /quota) into a per-tick forecast product written by the gatherer tick: quota-forecast.json beside quota-current.json (per pool/window: projected wall instant, rate, samples, honesty state) plus one Turso agent_quota_records-class ledger row per forecast. Consumers read the product; nobody recomputes. Honesty states carry over: a forecast that cannot be measured is an explicit state with a reason, never an invented date.
Acceptance criteria
- quota-forecast.json is produced on every gatherer tick for at least one week, verified from the heartbeat-adjacent record.
- Tests: unit/property tests for the promotion against the quota-analytics oracle (same inputs -> same projection), named oracle per the testing doctrine.
- The forecast for at least the five busiest pools (antigravity doors, opencode-go, claude-pro, meta, codex) is non-degenerate (real rates from real samples) on a majority of ticks in that week.
Activitydeveloping-today commented on Nov 22, 2026 dezren39 commented on Nov 22, 2026
Picked up by felix — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while felix posts progress markers; after 30 minutes of silence any other worker may pick this up.) dezren39 commented on Nov 22, 2026
Progress from felix: still working dezren39 commented on Nov 22, 2026 agent-note:v1
event: progress
by: agent felix (kind muse, Muse sandbox seat)
at: 2026-11-22
Picked up S1 under the approved Stage-3 design (#12702 merged; epic #12694). Building the forecast product per D1/D2:
- New pure module
src/quota-forecast.ts (pool-state.ts pattern): per-tick quota-forecast.json beside quota-current.json, pools keyed by the canonical provider id, per pool/window the quota-analytics.ts projection verbatim (state, ratePtsPerHour, samples, projectedWallAt, wallsBeforeReset) plus the reading's measuredAt and the window's resetsAt. The pace math is NOT reimplemented — the builder calls projectWindow (D2).
- Freshness per the quota-current.ts overlay rules: only a fresh ok reading is projected; a stale/retained/errored latest reading yields an explicit
insufficient-history forecast with a reason — never a number from stale data, never an invented date.
- Series joined across the recorded serviceId renames with an explicit key mapping in code (antigravity/_antigravity, command-code/commandcode/_commandcode, meta/meta:high-usage, openai/_openai spellings), mirroring the analytics-store join so forecast and /quota display agree on the same inputs.
- One Turso
agent_quota_records-class ledger row per pool/window per tick (source quota-forecast, forecast shape in the payload) alongside the reading rows, for S2's accuracy join.
- Wired into gather-quota.ts after the snapshot append, fail-soft like the pool-state projection: a forecast failure logs and never fails the tick; the previous forecast stands.
Acceptance note: criterion 1 (produced on every tick for a week, heartbeat-verified) and criterion 3 (five busiest pools non-degenerate on a majority of ticks) are live-run evidence that accrues after this lands and deploys on the laptop — this slice lands the product + hermetic tests against the analytics oracle (criterion 2). dezren39 commented on Nov 23, 2026
Progress from felix: still working dezren39 commented on Nov 23, 2026 agent-note:v1
event: progress
by: agent felix (kind muse, Muse sandbox seat)
at: 2026-11-22
Landed for review: PR #12724 — the S1 forecast product, unmerged (Felix reviews).
What it does, per D1/D2: every gatherer tick now publishes quota-forecast.json beside quota-current.json (pools keyed by the canonical provider id; per pool/window the quota-analytics projection verbatim + pctNow/measuredAt/resetsAt) and one Turso agent_quota_records ledger row per pool/window under source "quota-forecast". Pure builder in src/quota-forecast.ts calling projectWindow — the pace math is promoted, not reimplemented. Fail-soft like pool-state: a forecast failure never fails the tick.
Honesty states as implemented: fresh-ok readings only (retained last-known counts as stale by definition, per the overlay rule); stale/errored/lapsed latest readings yield explicit insufficient-history rows with reasons and null projections; thin history passes the oracle's own insufficient-history through; label-only windows get no row. Rename join is explicit code (forecastSeriesKey), mirroring the analytics-store join.
Evidence (sandbox): fail-before = suite load error on the base; pass-after 15/15 unit/property tests (60-case property run against the projectWindow oracle), tick-level test green (seeded 10 pts/h burn -> projected, wall before reset), full aggregator suite 3195 pass / 4 known environmental fails (identical set at pristine main), tsc clean, no new dependencies.
Remaining on this issue after merge: deploy on the laptop tick, then the acceptance week (criterion 1: forecast on every tick, heartbeat-verified; criterion 3: five busiest pools non-degenerate on a majority of ticks). Claim released; the issue stays open for that live evidence. dezren39 commented on Nov 23, 2026
Released by felix (outcome: free). S1 forecast product landed as PR #12724 (unmerged, Felix reviews). Issue stays open: post-merge deploy + one-week live acceptance evidence (criteria 1 and 3) remain. dezren39 commented on Nov 23, 2026 agent-note:v1
event: merged
by: agent felix (kind muse, Muse sandbox seat)
at: 2026-11-22
Merged: #12724 — S1, the quota forecast product, is on main.
Every gather tick now publishes quota-forecast.json beside quota-current.json plus one ledger row per pool/window (source "quota-forecast"), projecting with quota-analytics' own projectWindow — the pace math promoted, never reimplemented. Series join across the recorded renames is explicit code. Honesty states as designed: only a fresh ok reading is projected; stale/retained/errored readings yield insufficient-history rows with named reasons and null projections (stale percentages are never republished); label-only windows get no row. Fail-soft: a forecast failure logs and never fails the tick. Felix re-ran the forecast suite at review: 15/15, 358 expects, including the 60-case property test against the projectWindow oracle. No new dependencies.
The issue stays open for its live acceptance week: forecast present on every tick (heartbeat-verified) and the five busiest pools non-degenerate on a majority of ticks. Deployment rides the normal laptop aggregator install — note the deployed binary currently predates even #12689 (see #12718), so the forecast's first live ticks wait on the same rebuild.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|