feat(sprint-gate): latency and idle-CPU limits are measured bands; the flat 10% is gone (c, 2/3) - #770
Conversation
…d the flat 10% is gone (c, 2/3) check_search compares p50/p95 to the band measured from attested green main runs (--attestations), never to baseline × 1.10; fewer than five runs reports the check UNMEASURED (rc 0, listed in payload.unmeasured, like SKIPPED) instead of a verdict nobody measured. check_resource keeps the ratified 30% ceiling and adds the band per process. Inline attestations are replay-only. Tests that FAIL on 3ee7c27: 294 ms (a real green-main value) was RED against 225 × 1.10; 950 ms was GREEN against the corpus's 911.887 × 1.10 while every green-main run sits at 98–294 ms. Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…t unused (DeepSource, #764) Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…rce (DeepSource PY-R1000: cyclomatic 17) Behaviour unchanged; the ceiling-plus-band reasoning moves into cpu_bands() with its docstring. Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…bling percentile; inline attestations obey the duplicate-run rule (lead review r1) Order in check_search is now: any False -> FAIL; else any None -> UNMEASURED; else PASS. The payload carries limits_ms (None where unmeasured) and per-percentile verdicts so a reader sees which side fired. Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…budget UNMEASURED, never PASS; verdicts are named (lead review r2) Same order as check_search: any FAIL (ceiling, band, RSS, missing process) wins; else any process without a band -> UNMEASURED, listed in payload.unmeasured; else PASS. Both checks now use margins.judge(), so a verdict is PASS/FAIL/UNMEASURED by name and no 'is False' test can fold an unmeasured band into not-RED. all_green carries idle_cpu_pct.* history for all four processes so the four-check green fixture proves the CPU band end to end. Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…k_resource (DeepSource PY-R1000: cyclomatic 18) Behaviour unchanged; same tests pass. Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
|
@coderabbitai review — brainlayerClaude (worker) · claude-code/claude-fable-5-1 |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_bff118f1-8eb2-41d9-a636-bdc5777c2844) |
|
|
BrainLayer ratchetEvery Value below was measured by this run. A row this machine cannot measure says
🟢 GREEN measured, within budget · 🔴 RED measured, out of budget — a finding to clear before merge · ⚪ n/a not measurable on this machine, never guessed. 1 RED row(s) to clear: Measured on Linux/x86_64 · measured |
|
Warning Review limit reachedNext included review available in 30 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (5)
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. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Sep 5, 2026 12:42p.m. | Review ↗ | |
| Swift | Sep 5, 2026 12:42p.m. | Review ↗ | |
| JavaScript | Sep 5, 2026 12:42p.m. | Review ↗ | |
| Shell | Sep 5, 2026 12:42p.m. | Review ↗ | |
| Secrets | Sep 5, 2026 12:42p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Ratchet bolt-down (c), slice 2 of 3 —
sprint_gate.pyuses the measured band; the flat 10% is goneSize XS. Base is
main; #763 merged as8aa562c3. Supersedes #764 (closed by GitHub when the stacked base branch was deleted; identical content, rebased onto main, no code changes). Review history — bot rounds, lead rounds 1 and 2, dispositions — lives on #764.Definition of done — tests that FAIL on
3ee7c279and pass here (verified by running them against agit archive 3ee7c279tree)3ee7c279test_a_value_inside_measured_variance_is_no_longer_red— 294 ms (a value green main actually produced, w8-REPORT 2026-09-02) vs baseline 225 mstest_a_two_fold_regression_no_longer_hides_behind_a_stale_baseline— 950 ms vs the corpus's 911.887 ms baselinetest_fewer_than_five_attested_runs_is_unmeasured_never_a_verdictUNMEASURED, values reported, nolimits_mstest_idle_cpu_goes_red_beyond_the_measured_band_even_under_the_ceiling— 20% idle, five green runs at 4.0–5.0%What changed
check_search: p50/p95 compared to the band from attested runs (--attestations <dir|file>), neverbaseline × 1.10. Fewer than five attested runs for either percentile → check statusUNMEASURED: rc 0, listed inpayload.unmeasured(same rule as SKIPPED — release consumers reject it themselves; the first five main runs must be able to complete for a band to exist).details.marginscarries the full sentence (mean, σ, k, n, limit) per percentile.check_resource: the ratified 30% ceiling stays a hard budget; the measured band is added per process (cpu_over_measured_band,cpu_margins). Unmeasured band → ceiling alone decides, stated per process.corpus.json:latency_regression_fractionremoved.latency_baseline_msstays as the calibration record (hostname/captured_at), which (b) also hashes.attestationsare replay-only; a live config carrying them is refused ("the hand-editable baseline all over again"). Fixturesall_green/search_latency_redcarry five inline runs so every check is still RED-provable.Not done here, on purpose
mcp_roundtripstores a probe chunk in the canonical DB, which this seat may not touch. Replay fixtures only.ratchet.ymldoes not yet download N attestations for the collector — (b) is editing that workflow; wiring the download is a follow-up after (b) merges.Tests
tests/test_sprint_gate.py+tests/test_ratchet_margins.py: 112 passed. ruff clean. Two pre-existing expectations updated (..._runs_latency_on_calibrated_host,..._keg_built_from_this_sha_is_proof_eligible): a live run with no attestations is nowUNMEASURED, not a PASS nobody measured.— brainlayerClaude (worker) · claude-code/claude-fable-5-1
Note
Medium Risk
Changes release-gate semantics (UNMEASURED vs PASS, stricter latency/CPU drift detection) and attestation handling; incorrect wiring could block or mis-report CI until workflows pass
--attestations.Overview
Sprint gate ratchet (c):
search_latencyand idle CPU inresource_budgetno longer usebaseline × 1.10or ceiling-only PASS. Limits come fromscripts/ratchet_marginsover attested green main runs (≥5 per metric); otherwise checks reportUNMEASURED(real samples, no fake PASS) and appear inpayload.unmeasured.Live runs load attestations only via
--attestations; inline config attestations are replay-only and validated (including duplicaterun_idrejection).corpus.jsondropslatency_regression_fraction. Resource checks keep the hard CPU/RSS ceiling but add per-process measured bands; verdict order is FAIL → UNMEASURED → PASS so one bad percentile/process is not masked.Fixtures and tests cover historical false RED/GREEN cases, attestation loading/refusal, and idle-CPU drift under the 30% ceiling.
Reviewed by Cursor Bugbot for commit 0c64d2a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace flat 10% latency threshold with attestation-based measured bands in
sprint_gatecheck_searchandcheck_resourcenow judge p50/p95 latency and idle CPU against per-percentile, per-process margins derived from attestation histories instead of the removedlatency_regression_fraction.UNMEASUREDcheck status for cases where no usable band exists (fewer than five attested runs).gate_statusacceptsUNMEASUREDalongsidePASSandSKIPPEDfor aggregate success, andresult_payloadlists unmeasured checks.--attestationsCLI argument for live runs; inline attestations are replay-only and validated (duplicate run IDs and malformed entries refuse the gate).gate_statusnow reports overall PASS when checks are onlyPASS,SKIPPED, and/orUNMEASURED; a measured-band FAIL takes precedence over anUNMEASUREDsibling. Calibrated live hosts without attestations now reportsearch_latencyandresource_budgetasUNMEASUREDrather thanPASS.Macroscope summarized 0c64d2a.