Repository navigation
impl(quota-plane): stage-3 S3 — shadow placement: forecast ordering logged beside live ordering (#12697) - #12748
Merged
Merged
Conversation
added 2 commits
November 23, 2026 01:08
…live ordering (#12697) Stage-3 S3 (design D3): a pure projection over the tick's quota-current + quota-forecast that computes the live placement ordering (burn-by-expiry, measured data only) and the shadow ordering (an open pool projected to wall before its reset is demoted into the caution tier, before the caution zone), and emits the per-decision diff record S7 scores: both orderings, the decision point, per-pool measured inputs, every forecast window row with its honesty state and consumption verdict, both ranks, movement reasons. Consumption binds S2's findings: the bare opencode-go monthly forecast (cross-workspace mixing artifact) is never consumed and the exclusion is logged; insufficient-history rows are logged, never consumed; a stale forecast reading degrades to no forecast. The forecast can never promote a measured demotion, remove a pool, or close anything; the live ordering is a function of the measured data alone (pinned by tests across forecast variants: null, empty, all-wall, honesty-only, stale).
After the forecast block, each tick writes quota-shadow-placement .json beside quota-current.json and appends the record to quota-shadow-placement-history.jsonl (QUOTA_SHADOW_PLACEMENT_PATH / QUOTA_SHADOW_PLACEMENT_HISTORY_PATH override). Fail-soft like the forecast: a shadow failure never fails the tick, and a failed forecast still yields a record with shadow == live. No live path reads the record.
|
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 48 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage-3 S3 implementation for #12697 (epic #12694, design D3 in
doc/2026-11-22T22-35-00Z_design_quota-plane-stage-3). Deliberately does not close #12697: its first acceptance criterion is one week of accumulated shadow diff records, which is calendar time after this lands and the laptop aggregator redeploys; the issue stays open for that, with the summary to be posted on #12694.What lands
pm-stack/aggregator/src/quota-shadow-placement.ts— a pure per-tick projection (S1/pool-state idiom: no I/O, clock only through arguments) emitting the per-decision diff record:NEAR_PCT) → walled, soonest reset first within a tier. Unknown is not closed: an unreadable pool stays in the ordering, it just has no measured expiry to burn by.quota-shadow-placement.jsonlatest + one appended line per tick inquota-shadow-placement-history.jsonl): both orderings, the decision point (gatherer tick + the current/forecast products'generatedAtstamps), and per pool the measured inputs, every forecast window row with its honesty state and whether it was consumed or excluded (and why), both ranks, and movement reasons — everything S7 needs to score shadow-vs-live after the fact.Consumption rules, binding S2's findings (#12696):
opencode-gopool's monthly forecast is never consumed — S2 showed that series is a cross-workspace mixing artifact (precision 0.054 vs 0.93–1.0 per-workspace); the exclusion is logged on the record. Per-workspace pools consume their monthly rows normally.insufficient-historyrows are logged with state + reason, never consumed — no ordering is invented from an unscoreable series.scripts/gather-quota.ts— after the forecast block (i.e. after every live output is written), the tick builds the record from the in-process forecast (nullif the forecast failed — the record still lands, shadow == live) and writes both files, fail-soft like the forecast and pool-state writes.QUOTA_SHADOW_PLACEMENT_PATH/QUOTA_SHADOW_PLACEMENT_HISTORY_PATHoverride the defaults besideQUOTA_CURRENT_PATH. No live path reads the record.Evidence (sandbox venue)
origin/mainfails with module-not-found (./quota-shadow-placement.ts), the expected whole-surface-missing failure.quota-shadow-placement.test.ts14/14 (63 expects), including the no-live-effect battery — live ordering identical across forecast variants (null, empty, every-pool-projected-to-wall, honesty-only, stale) and equal to the exportedliveOrderingFor(current)— the demotion-before-caution case, the bare-opencode-go exclusion vs per-workspace consumption, and the permutation property (shadow never adds/removes a pool).origin/mainin the same venue (verified by a scratch-worktree run):deriveEpicEtacensored-distribution (timing), charges feed-gate fallback,parsePhaseMappingreal-file read, dashboard: clean up the page list (12 registered pages, overlaps to resolve) #1497 curation manifest. Zero new failures.tsc --noEmitclean; biome check clean on the three changed files. No new dependencies.What remains
pace_hold, impl(quota-plane): stage-3 S4 — live forecast-driven admission: pace_hold from projected exhaustion #12698) consumes this record's evidence; S5–S7 untouched.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.