You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ratchet bolt-down (c), slice 3 of 3 — the table shows the margin each row applies
Size XS. Base is main; #763 merged as 8aa562c3. Supersedes #765 (closed by GitHub when the stacked base branch was deleted; identical content, rebased onto main). Rebase onto main met (b)'s #766 in tests/test_ci_ratchet_table.py — an append-versus-append conflict at the file end, resolved by keeping both blocks ((b)'s first); the collector auto-merged. Review history — bot rounds, lead rounds 1 and 2 (ACCEPT), dispositions — lives on #765. Known and stated: DeepSource flags except (AttestationError, ValueError) as overlapping (AttestationError subclasses ValueError); one-line lint fix held pending the lead's word, since this reopen is "no code changes".
What a reader sees now
Rendered locally with the seven real green-main values as attestations (python scripts/ci_ratchet_table.py --attestations <dir>):
search p50/p95 · Notes: Margin p50: limit 463.7 ms = mean 225.0 ms + k 3.36 × σ 71.1 ms (n=7 attested green main runs; one-sided 99% prediction limit for one run). Margin p95: limit 2457.5 ms = mean 1974.4 ms + k 3.36 × σ 143.8 ms (n=7 …). Calibrated on MacBook-Pro.local at 2026-09-01T08:42:22Z under active_sprint_load. Not measured by this run.
idle CPU · Notes: Ceiling: average CPU < 30% over a 60 s window, ratified and kept as a hard budget. Margin daemon: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin helper: … Margin watcher: …
Without --attestations (every PR run until ratchet.yml downloads them) the Notes say margin unmeasured — 0 of the 5 attested green main runs — a count, never a limit. The old Notes printed the 911.887 ms baseline with no margin at all.
Fail-closed
A store handed over and unreadable (--attestations at a missing path, a malformed file) turns search p50/p95 and idle CPU RED with the reason, never n/a; main exits 1 with ::error annotations for both. Rows that apply no margin (mapped bytes, provenance, signature) are untouched.
Tests
tests/test_ci_ratchet_table.py: 7 new (158 total) + tests/test_ratchet_margins.py 28 + the git-shellout registration test: 180 passed. Two of the new Notes tests were run against a git archive 3ee7c279 tree and fail there. ruff clean.
Low Risk
Changes are limited to CI ratchet table rendering and CLI; no production runtime paths, though reviewers should confirm workflow wiring for --attestations matches the new fail-closed RED behavior.
Overview
The ratchet sticky comment now explains which statistical margin applies to search latency and idle CPU, derived from attested green main runs instead of quoting a flat baseline limit in Notes.
scripts/ci_ratchet_table.py gains --attestations (file or directory of attestation.json), loads them through ratchet_margins, and stores the result on Probe. search p50/p95 and idle CPU Notes call margin_notes to print measured bands (mean, σ, limit, run count) or margin unmeasured when fewer than five runs exist; idle CPU keeps the hard 30% ceiling and adds per-process daemon/helper/watcher bands. Missing attestations stay n/a with unmeasured margins and exit 0; a path that was passed but cannot be read or yields invalid bands turns those rows RED and fails the collector without aborting unrelated rows.
Tests in tests/test_ci_ratchet_table.py cover unmeasured vs measured wording, fail-closed load errors, CLI integration, malformed data, and non-finite band refusal.
Reviewed by Cursor Bugbot for commit 5a1ec60. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Show measured or unmeasured ratchet margins per row via --attestations in ci_ratchet_table
Adds a --attestations file-or-directory option to the CLI in ci_ratchet_table.py; Probe.detect loads attestation documents through a new select_attestations loader backed by scripts.ratchet_margins.
The margin_notes helper renders each requested margin key with its unit from the probe's attestations, returning a row-level problem string on ValueError instead of propagating.
row_search_latency replaces the old flat-limit/baseline note with formatted p50 and p95 attested bands; row_idle_cpu keeps the existing 30%/60-second ceiling and appends per-process margins for daemon, helper, and watcher.
Rows that lack an attestation store render unmeasured margins and stay n/a; load failures, malformed data, or non-finite bands turn the affected rows RED while unrelated rows stay n/a.
Behavioral Change: row_search_latency and row_idle_cpu no longer emit the prior flat-limit/baseline text; callers of the CLI must pass --attestations to see measured bands, and an unreadable supplied path exits with code 1 and RED diagnostics.
… band or `unmeasured`, never a round number (c, 3/3)
--attestations <dir> hands the collector the attested main runs; the search p50/p95 and idle CPU
Notes print the band with every input (mean, σ, k, n) or 'margin unmeasured — N of the 5 attested
green main runs'. A store handed over and unreadable turns those rows RED, never n/a. The idle-CPU
Notes keep the ratified 30% ceiling and add the band per process.
Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…rgin rows RED, never aborts the table (Macroscope, #765)
The fix itself is in the margins module (validate at load); this pins the collector-level behaviour.
Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
…f aborting the table
margin_notes returns (notes, problem); search p50/p95 and idle CPU go RED with the reason.
Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
We reviewed changes in 8aa562c...5a1ec60 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
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.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Every Value below was measured by this run. A row this machine cannot measure says n/a — <reason> instead of a number; baselines in Notes name their own machine, method and date and were not measured here.
Row
Status
Value (measured by this run)
Method
Notes
commit provenance
🔴 RED
checkout 47133a95bcef is neither 5a1ec60b5c31 nor a merge of it — this run was triggered for a commit it does not have checked out
commit graph + live PR head · in-process · runner
Which commit this whole table is about. On a pull_request event the checkout is GitHub's synthetic merge ref, whose sha is not on the PR — #759's table printed 13fa724278bf while that PR's head was 4632f979 — so this row names the PR-head parent instead, the sha a reviewer can actually see. The comparison sha is read live from repos/{owner}/{repo}/pulls/{n} when the table is collected, not taken from the event payload, because the payload cannot know the run has been overtaken. Residual window, stated rather than papered over: a push landing between that read and the comment being posted is not caught here — the run for that push refreshes the table.
provenance
🟢 GREEN
stamped 47133a95bcef == HEAD, tree clean
wheel stamp · in-process · runner
Sha half of #749 keg-mode provenance: a keg built from this wheel can answer __build_sha__. The helper-age and served-process predicates need a running BrainBar and are measured only by scripts/sprint_gate.py on an installed Mac. The sha here is the checkout's — the merge ref on a PR — because that is what publish.yml stamps at release time; the PR-head sha this table describes is the one in commit provenance above.
mapped bytes
⚪ n/a
n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would
socket · installed Mac
Baseline 26.2 GB — installed Mac, socket, 2026-09-03, after R2 drained 15,070 → 0. Up from 16.8 GB because the drain left more vectors mapped under the same cap: the change is the drain, not a leak. Not measured by this run.
search p50/p95
⚪ n/a
n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would
socket · installed Mac
Margin p50: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin p95: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Calibrated on MacBook-Pro.local at 2026-09-01T08:42:22Z under active_sprint_load (tests/fixtures/sprint_gate/corpus.json). Not measured by this run.
idle CPU
⚪ n/a
n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would
ps sampling · installed Mac
Ceiling: average CPU < 30% over a 60 s window (resource_budget in scripts/sprint_gate.py), ratified and kept as a hard budget. Margin daemon: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin helper: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin watcher: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Needs the BrainBar daemon, helper and watcher actually running. Not measured by this run.
signature_valid
⚪ n/a
n/a — the macOS signature-parity job is trigger-gated and did not run on this PR: it touches no release or signing path (pyproject.toml, scripts/release-*, scripts/brainlayer-version-check.sh, publish.yml, ratchet.yml) and carries no ratchet:signatures label — a GitHub macOS runner bills at ~10× Linux minutes and rebuilds the keg venv from source
codesign · installed keg
scripts/release-verify-signatures.sh <keg> codesign-verifies every *.so/*.dylib under libexec/venv. The macOS parity job installs the published tap formula (etanhey/layers/brainlayer), so this row measures the release path — formula, published sdist and Homebrew's relocation — and not this PR's tree. Release-time baseline for the same keg on a different machine: 442 valid / 0 invalid — installed Mac (M4 Max), brew --prefix brainlayer 1.5.11, 2026-09-03.
🟢 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:commit provenance.
Measured on Linux/x86_64 · measured 5a1ec60b5c31 · PR head 5a1ec60b5c31 · checkout 47133a95bcef · run · updated 2026-09-05 17:03:28 UTC
Supersedes #765 (closed by GitHub when its base branch wt/ratchet-c1-margins-module was deleted at the #763 merge). Same patch series, rebased onto main past 8aa562c3.
— brainlayer lead (brainlayerClaude-3303a978, claude-fable-5-1)
The reason will be displayed to describe this comment to others. Learn more.
Overlapping exceptions (ValueError is an ancestor class of margins.AttestationError)
Two or more exceptions in the same exception handler clause that are identical or parts of the same inheritance hierarchy (i.e. overlapping). It is recommmend to refactor this.
The reason will be displayed to describe this comment to others. Learn more.
Real, and fixed in 5a1ec60: margins.AttestationError subclasses ValueError, so except ValueError alone covers both the refused-band path and describe()'s refusal. Behaviour identical; the same two tests (test_a_band_that_cannot_be_formed_turns_its_row_red_not_the_collector_dead, test_a_describe_failure_is_a_row_problem_not_a_collector_abort) pass unchanged.
… (DeepSource overlapping-exceptions)
Same two paths covered by the same two tests; behaviour identical.
Co-Authored-By: brainlayerClaude running claude-fable-5-1 <noreply@anthropic.com>
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
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.
Ratchet bolt-down (c), slice 3 of 3 — the table shows the margin each row applies
Size XS. Base is
main; #763 merged as8aa562c3. Supersedes #765 (closed by GitHub when the stacked base branch was deleted; identical content, rebased onto main). Rebase onto main met (b)'s #766 intests/test_ci_ratchet_table.py— an append-versus-append conflict at the file end, resolved by keeping both blocks ((b)'s first); the collector auto-merged. Review history — bot rounds, lead rounds 1 and 2 (ACCEPT), dispositions — lives on #765. Known and stated: DeepSource flagsexcept (AttestationError, ValueError)as overlapping (AttestationError subclasses ValueError); one-line lint fix held pending the lead's word, since this reopen is "no code changes".What a reader sees now
Rendered locally with the seven real green-main values as attestations (
python scripts/ci_ratchet_table.py --attestations <dir>):Without
--attestations(every PR run untilratchet.ymldownloads them) the Notes saymargin unmeasured — 0 of the 5 attested green main runs— a count, never a limit. The old Notes printed the 911.887 ms baseline with no margin at all.Fail-closed
A store handed over and unreadable (
--attestationsat a missing path, a malformed file) turns search p50/p95 and idle CPU RED with the reason, nevern/a;mainexits 1 with::errorannotations for both. Rows that apply no margin (mapped bytes, provenance, signature) are untouched.Tests
tests/test_ci_ratchet_table.py: 7 new (158 total) +tests/test_ratchet_margins.py28 + the git-shellout registration test: 180 passed. Two of the new Notes tests were run against agit archive 3ee7c279tree and fail there. ruff clean.— brainlayerClaude (worker) · claude-code/claude-fable-5-1
Note
Low Risk
Changes are limited to CI ratchet table rendering and CLI; no production runtime paths, though reviewers should confirm workflow wiring for
--attestationsmatches the new fail-closed RED behavior.Overview
The ratchet sticky comment now explains which statistical margin applies to search latency and idle CPU, derived from attested green
mainruns instead of quoting a flat baseline limit in Notes.scripts/ci_ratchet_table.pygains--attestations(file or directory ofattestation.json), loads them throughratchet_margins, and stores the result onProbe.search p50/p95andidle CPUNotes callmargin_notesto print measured bands (mean, σ, limit, run count) ormargin unmeasuredwhen fewer than five runs exist; idle CPU keeps the hard 30% ceiling and adds per-process daemon/helper/watcher bands. Missing attestations stayn/awith unmeasured margins and exit 0; a path that was passed but cannot be read or yields invalid bands turns those rows RED and fails the collector without aborting unrelated rows.Tests in
tests/test_ci_ratchet_table.pycover unmeasured vs measured wording, fail-closed load errors, CLI integration, malformed data, and non-finite band refusal.Reviewed by Cursor Bugbot for commit 5a1ec60. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Show measured or
unmeasuredratchet margins per row via--attestationsinci_ratchet_table--attestationsfile-or-directory option to the CLI in ci_ratchet_table.py;Probe.detectloads attestation documents through a newselect_attestationsloader backed byscripts.ratchet_margins.margin_noteshelper renders each requested margin key with its unit from the probe's attestations, returning a row-level problem string onValueErrorinstead of propagating.row_search_latencyreplaces the old flat-limit/baseline note with formatted p50 and p95 attested bands;row_idle_cpukeeps the existing 30%/60-second ceiling and appends per-process margins for daemon, helper, and watcher.unmeasuredmargins and stay n/a; load failures, malformed data, or non-finite bands turn the affected rows RED while unrelated rows stay n/a.row_search_latencyandrow_idle_cpuno longer emit the prior flat-limit/baseline text; callers of the CLI must pass--attestationsto see measured bands, and an unreadable supplied path exits with code 1 and RED diagnostics.Macroscope summarized 5a1ec60.