GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(pm-stack): C4.1 complete-downtime window records on gatherer ticks (#13257) by dezren39 · Pull Request #13295 · developing-today/code 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 39 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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: b11b655e9b
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const spans: DowntimePoolSpan[] = []; | ||
| let latest = -Infinity; | ||
| for (const intervals of perPool) { | ||
| const iv = covers(intervals, start) as WallInterval; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Account for every binding limit in the latest reopening
When a pool has multiple overlapping wall intervals, covers() selects only the first one, so latest ignores other limits that still block that pool. For example, a single pool with two already-walled windows resetting at +1h and +10h produces reopening.earliest = +10h but reopening.latest = +1h; reversing the window order changes the result. This publishes an inverted reopening range and an incorrect full-restoration bound in both the JSON product and ledger. Compute the bound from all relevant blocking intervals rather than the first covering window.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| describe("deriveDowntimeWindow", () => { | ||
| test("overlapping walls predict a window with the intersection range and named basis", () => { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Add generated coverage for the downtime interval model
This suite contains only hand-written examples, although the new engine has union/intersection, maximal-window, and input-order invariants. AGENTS.md requires “property tests” where code has invariants and “model-based tests” where a model exists; acceptance examples alone do not satisfy that requirement. Add generated pool/window combinations checked against an independent interval-set oracle, including overlapping limits within a pool and permutation invariance—the current examples miss the order-dependent reopening calculation.
AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
) 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.
b11b655 to
6569d04
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 6569d04a58
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const bounded = overlaps.filter((o) => Number.isFinite(o.end)); | ||
| if (bounded.length > 0) { | ||
| return bounded.map((o) => { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Preserve the honesty state for an unbounded trailing overlap
When a tick contains both a finite complete-downtime interval and a later unbounded one, this early return silently drops the unbounded interval and bypasses the insufficient_history branch below. For example, a single provider with windows [+1h, +2h) and [+3h, Infinity) publishes only the first prediction, without disclosing that another all-walled interval cannot be bounded. Preserve an honesty record for the unbounded overlap even when finite predictions also exist, so the JSONL log and ledger distinguish an unbounded forecast from no prediction.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const records = deriveDowntimeWindowRecords(forecast, previous); | ||
| if (records.length) { | ||
| await mkdir(dirname(predictionsPath), { recursive: true }); | ||
| await appendFile(predictionsPath, records.map((r) => JSON.stringify(r)).join("\n") + "\n", "utf8"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Separate new records from a torn log tail before appending
If a previous append was interrupted before its terminating newline, the parser skips the torn final line, but this append concatenates the next tick's first record directly onto that fragment. The resulting line is invalid JSON, so the first new prediction is also lost from the readable log and cannot become a subsequent supersedes target; for the usual single-record tick, this loses the entire tick locally even though the ledger write proceeds. Repair or delimit an unterminated tail before appending new records so the intended torn-log recovery preserves the next prediction.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ): C4PredictionRecord[] { | ||
| const issuedAt = forecast.generatedAt; | ||
| const issuedMs = Date.parse(issuedAt); | ||
| const providerIds = Object.keys(forecast.pools).sort(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Restrict the downtime intersection to enabled routing providers
The forecast's provider keys are not exclusively routing pools: gather-quota.ts:264–278 explicitly requests quota for disabled doors, and collectRuns() retains those results in the entries passed to buildQuotaForecast(). In the checked .opencode/opencode.jsonc:350–363, _commandcode and deepseek are disabled but still explicitly gathered. Consequently, when every enabled routing provider is walled but one of these disabled providers has a no-wall-before-reset forecast, its empty down-set makes this function return no downtime prediction, even though that provider cannot serve as a fallback. Pass the enabled routing set into the derivation and intersect only those providers, while retaining disabled-provider measurements in the broader forecast product.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.