Repository navigation
3.x.x: the lint job runs the alert and metric generators' --check, and the load harness's side report carries every gate (#817) - #845
Conversation
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. |
f7b7e2b to
67d5bd1
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Approved: a complete review with no bugs found.
No bugs or security points found.
Not posted: 1 nit. Reviews post bugs and security points only; the rest stay in Sixth Man's ledger.
Reviewed by Claude Opus 5.5. Red team (deepseek-v4.1-flash-abliterated): found nothing.
There was a problem hiding this comment.
Approved: a complete review with no bugs found.
No bugs or security points found.
Not posted: 2 nits. Reviews post bugs and security points only; the rest stay in Sixth Man's ledger.
Reviewed by Claude Opus 5.5. Red team (deepseek-v4.1-flash-abliterated): found nothing.
…the tip-delivery, mainnet-shape and churn presets gate their median tip (#842) ## The problem On 2026-11-03 three PR runs of the `run-load` set each failed a tip-to-last-notify gate, each on a different preset. No nightly failed one on the same code. The triage for #842 found the runner, not the code. The findings are drafted as a comment on #842. - **The trend tracks VM speed, not commits.** - No server or harness source changed between the 10-23 and 10-27 nightlies, or across 11-03, 11-04 and 11-11. - Each frontend's initial full refresh of the same seeded 416,260-row window took 6.5–17.9 s across the 39 preset runs examined. This is the frontend's `snapshot_ms` on its `trigger="initial"` refresh line. - Tip-delivery's median tip follows it over 13 runs at r = 0.87 (the gate's nearest-rank median), or r = 0.90 with the midpoint median. - Fast VMs give the same latency before 10-27 (572–624 ms) and after it (526–571 ms). - **Each failure was one stalled tip on its own VM.** Medians are nearest rank, as the gate computes them. | PR | Preset | Slowest tip / median tip | Where the time went | |---|---|---|---| | #833 | `tip-delivery-2000-miners-400k-2fe-retarget` | 4,546 / 1,039 ms | 1st tip: refresh 1.5 s plus 2.9 s of fan-out, on both frontends at once | | #835 | `mainnet-shape-130-addresses` | 4,860 / 1,005 ms | 3rd tip: refresh 4.1–4.6 s. A PostgreSQL check query took 1.1–1.8 s on both frontends, with no checkpoint running | | #834 | `rental-churn-bursts-and-storms` | 3,826 / 569 ms | 6th churn tip, after the 2,000-rental burst: refresh 2.1 s plus 1.7 s of fan-out | - **The share-ack path degraded on the same VMs.** In each failing run, the phase holding the slow tip had a share-ack p99 of 71, 207 and 380 ms. The other 36 preset runs had 2–38 ms. - **Nothing measured the VM itself.** No steal time, pressure stall or sampler gap was recorded, so a VM-level stall could only be inferred. - **One stall fails the whole run.** The gated "p99 over 6 or 8 tips" is the slowest tip, nearest rank. #790 had the same problem on the real-node smoke, and #805 split that gate. ## The change, in two commits and a follow-up ### 1. Measure the host The harness now reads `/proc/stat` and `/proc/pressure/{cpu,io,memory}` every `--process-sample-interval-ms` (new `contention` module). - **Where the figures go:** a `host_contention` block per phase, and per tip in `time_to_usable_work` and each churn section. - A tip's window runs from the node's tip stamp to its slowest session's first usable job. - When some session never got the tip, the window runs to the next tip instead, covering the time those sessions were starved. - **What each figure divides:** - `steal` and `iowait` are shares of the CPU time the kernel accounted. - The PSI figures (some and full) are shares of the harness's monotonic time from before one read of a file to after the next. That is the most the two totals can cover, so time the sampler loses around a read lowers a share and never raises it past what the kernel counted. - Each gives its share over the window and its worst interval. - **Unknown stays unknown:** a host without PSI or without a steal field reports that figure as null with a reason, never 0. - CPU `full` is not read, because the kernel reports it as zero at the system level. - The run-level block records the steal counter at start. A counter still at 0 cannot tell an idle hypervisor from one that doesn't report steal, so the gate's lines carry that caveat when it reads 0. - The sampler takes one last read as the run stops, so the final interval and a late tip have a read after them. - **Lock sampler:** it adds its longest gap between polls, with PostgreSQL's `clock_timestamp()` of the poll that ended it. A gap counts if its interval overlaps the phase, so a stall that began before the phase is still the phase's. - **Gate:** a failed tip row, main or churn, gets one informational row. It shows the host over the slowest tip, over its phase, and that phase's longest sampler gap. `gate::tip_timeline` prints each tip's line. All of it is additive to the report. An older report gates as before and simply gets no host row. A report without churn or a soak keeps its shape (the tips are reached with `pointer_mut`, not indexing). The top-level key is added to the load smoke's golden key list. ### 2. Gate the median tip and give the slowest tip room for a stall This applies #805's split to the nightly presets with tip budgets. | Preset | Median tip | Slowest tip (was) | |---|---|---| | `tip-delivery-2000-miners-400k-2fe-retarget` (and `-500-addresses`) | 2,500 ms | 5,000 ms (2,500) | | `mainnet-shape-130-addresses`, `mainnet-shape-650-addresses` | 3,000 ms | 6,000 ms (3,000) | | `rental-churn-bursts-and-storms` churn rows (8 tips) | 3,000 ms | 6,000 ms (3,000) | - **New key for churn tips:** `churn_tip_last_notify_median_budget_ms`, optional and validated like #805's key (finite and positive; absent or null means not gated). A preset whose median budget is above its p99 budget is refused, for either pair. - **Rental churn's warm-up row is not split.** Its 2 warm-up tips keep their 3,000 ms p99 and no median, because the nearest-rank median of 2 is the faster one. - **One check for both:** the churn rows now go through the same check as the run's own tip rows. - **The report records every gate:** its `preset.gates` block now serialises `preset::Gates` whole, so the median keys and `new_session_first_job_p99_budget_ms` are in it. - **Docs:** the README gate table, the workflow's dispatch description and the scenario criteria say the same thing. **The trade-off, plainly:** - **Now passes:** a regression confined to at most half the tips that lands between 1× and 2× the budget. A nearest-rank median of n tips is the ceil(n/2)-th fastest, so that is up to 3 of 6 or 4 of 8. Examples: only the first tip after a frontend start, or only churn's burst tip. - **Still fails:** - The median, when a regression slows more than half the tips. - The median, when the run delivered fewer tips than it planned (see the follow-up below). - The slowest-tip row, on a stall past twice the budget or a tip some session never got. - **Run against 11-03's three failures:** their medians (1,039 / 1,005 / 569 ms) and slowest tips (4,546 / 4,860 / 3,826 ms) all pass. - **The trend restarts for these presets:** a changed preset starts a new S6 baseline (`preset_sha256` is in the series key). These five series are judged again after `min_baseline` (5) kept nightlies. - **The dispatch override is unchanged:** the `tip_last_notify_p99_budget_ms` input still sets only the slowest-tip budget. The medians and churn budgets stay the preset's own, and the input's description now says so. The commits are ordered so the first can land without the second if the gate change is not wanted. ### 3. Follow-up: a split gate passes only a run that delivered every planned tip An independent verify found two gaps in commit 2. - **F1, a run with too few tips passed.** Nothing checked the tips delivered against the plan; `external_tips_unminted` was reported but never gated. The nearest-rank median of 2 tips is the faster one, so tip-delivery passed a run that delivered 2 of its 8 tips with one at 4,900 ms. The old single 2,500 ms budget failed it. - **F2, wording.** Exactly half the tips slow (4 of 8 at 4,900 ms) passes the median. This body said "fewer than half". The rule stays (it is #805's nearest rank) and the wording now says "at most half passes, more than half fails", as the README's table already did. **The rule:** where a median budget is gated, the median row is measured only over every tip the run planned. - **Main rows:** each phase now reports `external_tips_planned` beside `external_tips_unminted`. The gate sums them, and when the report holds fewer tips the row reads, for example, "unmeasured: 7 of 8 planned tips delivered, 1 held unminted behind a landing" and fails. - **Churn rows:** the same check, against the section's `plan.tips_at_seconds`, which reports have carried since #521. - **A report that does not record its plan** has an unmeasured median, which fails. - **Unchanged:** the p99 rows, and every preset without a median. **Why this rule:** it is the narrowest one that is exact. - `external_tips_unminted == 0` alone misses a real node's mint that failed or never reached the watcher, since `observed_mints` drops those without counting them. - A per-preset minimum tip count would add a key to keep in step with `--external-tips`. - The planned count catches every way a tip goes missing, adds no preset key, and applies only where a median can hide a missing tip. **The A/B summary:** it re-gates each base run on the candidate's preset. - A base harness older than this follow-up records no plan, so every base run would have failed a median-gated preset, and a candidate regression would have read "as does a base run". - When no phase records the plan, `compare` now fills it from the pinned `--external-tips`, which it already holds every counted run's tip list to. - **After landing:** add `external_tips_planned` to `legacy-flags.json`'s `report_fields`, with the landed squash commit as `introduced`, so a newer build that drops the key is caught rather than filled. The commit is not known until squash-sign, so it can't be done in this PR. **Not changed, by choice:** - p99-only presets don't check the plan. - The bridge script's tip p50 is reported over delivered tips only, and gates nothing. ## Tests run All on this branch, through the host's build gate: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -p qbit-prism-load --all-targets -- -D warnings`: clean, apart from the three known vendored sqlx-core warnings. - `cargo test -p qbit-prism-load --test contention`: 15 passed. - Parsers against real and truncated lines, plus this host's own `/proc/stat`. - Unknown versus a real zero for a host without PSI or a steal field, and a counter that went backwards. - Window math, and the tip annotation, including an unserved tip whose window runs to its replacement. - The lock sampler's gap, including one that straddles a window's start. - The sampler's final read, and the steal caveat. - A sampler preempted around a pressure read (the share stays at or below what the kernel counted), and the stamps on both sides of a read. - The gate rows: shown only on a failed tip row, absent for an old report, and pointing at an unserved tip. - `cargo test -p qbit-prism-load --test realism`: 24 passed. #805's preset test is now `presets_gate_the_tip_median_only_where_they_split_it_from_a_stall_budget`, which covers both median keys, their refusals (including a median above its p99) and null. It is not cited in the deleted-test map, which covers 2.x.x files only. - `cargo test -p qbit-prism-load --test churn`: 7 passed. The new churn median test uses #834's eight churn tips. - `cargo test -p qbit-prism-load --lib --test harness --test compare --test legacy_flags --test soak_plan --test faults -- --test-threads=4`: 56, 155, 50, 3, 5 and 1 passed. Without `PRISM_TEST_PG_BIN_DIR`, the PostgreSQL-gated tests in `harness` pass without running. - `python3 scripts/check_e2e_scenarios.py` and `python3 scripts/check_prism_pool_acquires.py`: pass. - The first commit alone also passes clippy and the contention, realism and churn tests, so it can land without the second. - All of the above was rerun after merging `origin/3.x.x` (#833 and #834). No load preset was run locally. **For the follow-up (commits after d96b217):** - `cargo test --locked --offline -p qbit-prism-load --lib --test realism --test churn --test contention --test compare --test harness -- --test-threads=4`: 56, 26, 7, 13, 51 and 155 passed. The new tests: - `realism`: `a_tip_median_is_measured_only_over_every_tip_the_run_planned` (a 2-of-8 run with one tip at 4,900 ms fails, a tip held unminted fails, a report without the plan fails, a short run with an unserved tip names both reasons) and `a_tip_median_passes_a_slowdown_on_half_the_tips_and_fails_one_on_more`. - `churn`: 2 of 8 churn tips delivered fails the median, and a section without its plan fails it. - `compare`: `a_base_report_predating_the_tip_plan_is_held_to_the_pinned_tips`. - `harness`: the ordered-tips runs record `tips_planned` 3, including the run with one tip held unminted. - `cargo fmt --all -- --check`: clean. `cargo clippy --locked -p qbit-prism-load --all-targets -- -D warnings`: clean, apart from the three known sqlx-core warnings. ## Landing note: merging with #845 #845 (`orca/817-alerts-check-and-report-gates`) lands first. Merged with this branch, `cargo test -p qbit-prism-load --lib` fails to compile: E0063, a missing `churn_tip_last_notify_median_budget_ms` in #845's two `Gates` literals in `preset_report_tests` (run.rs, near L5876 and L5904). - **Don't use `None` in both literals.** With `None`, #845's `every_gate_set` still passes when the new key is dropped from the report. - **`every_gate_set` needs `Some(non-default)`** for the new churn median key, as its own doc says ("each value differs from its default"). `the_side_report_carries_every_gate_key` then catches a dropped key. - **The golden key file should also cover `preset.gates`.** `tests/golden/fake_side_report_keys.json` pins only the `top_level`, `node`, `topology`, `versions` and `window` keys, so it would not catch a regression in the gates block either. ## What CI must cover - **`load_smoke`** (PostgreSQL-gated) is the only end-to-end proof of the wiring in `run.rs`. Its golden key set now includes `host_contention`. It now asserts, against a real run, that: - every phase has host intervals, with steal and iowait measured on Linux; - each PSI figure is measured or unknown with a reason; - the lock sampler's gap is present; - every driven tip, main and churn, carries a `host_contention` block naming its phase. - **`cargo test --workspace --all-targets`** picks up the new `tests/contention.rs`. - **Not touched:** server code, settings and metrics. The workflow edit is the dispatch input's description only, which `main` picks up at its next sync of the nightly workflow. Refs #842 🤖 Generated with [Claude Code](https://claude.com/claude-code) Squashed commits: 6aac948 3.x.x: the load report says what the host was doing over each phase and each tip's delivery (#842) b428e5f 3.x.x: the nightly tip-delivery, mainnet-shape and churn presets gate their median tip, with the slowest tip at twice the budget (#842) d96b217 Merge remote-tracking branch 'origin/3.x.x' into orca/842-load-notify-latency b53688c 3.x.x: a split tip gate passes only a run that delivered every planned tip (#842) 6859982 3.x.x: the A/B summary holds an older base report's tip median to the pinned tips (#842) 189e1a2 3.x.x: the A/B tip-plan fill-in leaves a report without a phase list as it is (#842) 3dcce7e 3.x.x: a PSI share divides by the time from before its first read to after its second (#842) Co-Authored-By: Claude Opus 5.5 <[email protected]>
c9a435c to
7cb26dc
Compare
…d the load harness's side report carries every gate (#817) ## Problem #817 found two low-severity gaps in the review of #811: 1. The required lint job didn't run `scripts/generate_prism_alerts.py --check`, or `scripts/generate_prism_metrics.py --check`. On closer reading, both checks *do* run in CI already: the Rust observability tests (`crates/qbit-prism-server/tests/observability/inventory.rs`, `inventory_is_generated_from_registry` and `migration_covers_every_deployed_alert_and_all_46_historical_names`) shell out to them in `rust-tests`. A stale artifact therefore did fail CI, but only after a full Rust test build, and under an unrelated test name. 2. `load-harness-report.json`'s `preset.gates` was a hand-copied subset of the preset's `Gates`. It left out `tip_last_notify_median_budget_ms`, `churn_tip_last_notify_p99_budget_ms` and `new_session_first_job_p99_budget_ms`. A real-node-smoke report showed only `tip_last_notify_p99_budget_ms: 10000`, which reads as a 10 s gate. The gate's verdicts were correct, because they rebuild the budgets from the preset. ## Change - **`.github/workflows/ci.yml`:** `lint-compile-compose` runs both generators' `--check` beside the alert UID check. A stale generated artifact now fails in seconds, under its own step name, in the job that already owns the alert checks. - **`tests/test_prism_generated_artifact_checks.py`** pins: - both steps in `lint-compile-compose`, not commented out, with no `if:` on the step and no `continue-on-error` on the step or the job; - no `if:` on the job other than the same-tree skip (#839), which skips it only for a merge tree that already passed; - `lint-compile-compose` in the `needs` of the required aggregate check `Lint, compile, and test`; - that each `--check` refuses a hand-edited output, on a temp copy of exactly the files each generator reads: the migration tables, a reformatted rule file (each of the two), an edited rule value (via the patch's specification digest), and the metric inventory. - **`crates/qbit-prism-load`:** `preset::Gates` derives `Serialize`, and the side report writes the whole struct (`run::preset_report`), so a gate key can't be left out again. Unit tests: - check that the report's block parses back (unknown keys refused) to the same `Gates`, with every gate set to a non-default value; - check that a preset with no optional gates reports the same keys, each ungated one as `null`. - Both tests fail against the old hand-copied subset. Ungated keys now appear as `null` in the report. The side report's readers (compare, collate, A/B and `scripts/prism_load_probe.py`) read only `preset.name`, `preset.sha256` and `preset.gates.phases`, which are unchanged. ## Tests run (minidev, on 00001ae) - `python3 scripts/generate_prism_alerts.py --check` and `python3 scripts/generate_prism_metrics.py --check`: exit 0 on the base tree and on this branch. - `python3 scripts/check_prism_alert_uids.py`: OK. - `python3 -m unittest tests.test_prism_generated_artifact_checks tests.test_check_prism_alert_uids`: OK. - The workflow pin also fails as it should when a step is commented out, when a step or the job gets `continue-on-error: true`, and when the job is dropped from the aggregate's `needs`. - `cargo test --locked -p qbit-prism-load --lib`: 58 passed. - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -p qbit-prism-load --all-targets -- -D warnings`: clean apart from the three known vendored sqlx-core warnings. ## CI must cover The full Python shards and `rust-tests`, including the observability inventory tests that also run both generators. Nothing PostgreSQL-gated was added. ## Left open (outside this PR's scope) - Without `--snapshot`, `generate_prism_alerts.py --check` checks only that the qbit-tools patch contains the current specification digest, not the patch body. A hand edit to a `+` line that keeps the digest line passes. The step name says what is actually checked. - That digest check is a bare `assert`, which `PYTHONOPTIMIZE` strips. CI doesn't set it. - Dispatch overrides of the gate's budgets (`PRISM_LOAD_MAX_SHORTFALL`, `PRISM_LOAD_TIP_LAST_NOTIFY_P99_BUDGET_MS`) reach only the gate binary, so the side report shows the preset file's gates, and gate.md's Budget column shows what was applied. `preset_report`'s doc comment says so. Refs #817 🤖 Generated with [Claude Code](https://claude.com/claude-code) Squashed commits: 7cb26dc 3.x.x: the lint job runs the alert and metric generators' --check, and the load harness's side report carries every gate (#817) e68ecac Merge 3.x.x (3d48a8f) into the #817 branch: the side report keeps preset_report, and its tests name #842's churn median gate 5748aac Merge 3.x.x (234ff1c) into orca/817-alerts-check-and-report-gates: take in the landed 3.1.2 PRs and the collate test fix (#874) Co-Authored-By: Claude Opus 5.5 <[email protected]>
5748aac to
2bf25a4
Compare
Problem
#817 found two low-severity gaps in the review of #811:
scripts/generate_prism_alerts.py --check, orscripts/generate_prism_metrics.py --check. On closer reading, both checks do run in CI already: the Rust observability tests (crates/qbit-prism-server/tests/observability/inventory.rs,inventory_is_generated_from_registryandmigration_covers_every_deployed_alert_and_all_46_historical_names) shell out to them inrust-tests. A stale artifact therefore did fail CI, but only after a full Rust test build, and under an unrelated test name.load-harness-report.json'spreset.gateswas a hand-copied subset of the preset'sGates. It left outtip_last_notify_median_budget_ms,churn_tip_last_notify_p99_budget_msandnew_session_first_job_p99_budget_ms. A real-node-smoke report showed onlytip_last_notify_p99_budget_ms: 10000, which reads as a 10 s gate. The gate's verdicts were correct, because they rebuild the budgets from the preset.Change
.github/workflows/ci.yml:lint-compile-composeruns both generators'--checkbeside the alert UID check. A stale generated artifact now fails in seconds, under its own step name, in the job that already owns the alert checks.tests/test_prism_generated_artifact_checks.pypins:lint-compile-compose, not commented out, with noif:on the step and nocontinue-on-erroron the step or the job;if:on the job other than the same-tree skip (ci: skip repeated CI when the tree under test already passed #839), which skips it only for a merge tree that already passed;lint-compile-composein theneedsof the required aggregate checkLint, compile, and test;--checkrefuses a hand-edited output, on a temp copy of exactly the files each generator reads: the migration tables, a reformatted rule file (each of the two), an edited rule value (via the patch's specification digest), and the metric inventory.crates/qbit-prism-load:preset::GatesderivesSerialize, and the side report writes the whole struct (run::preset_report), so a gate key can't be left out again. Unit tests:Gates, with every gate set to a non-default value;null.Ungated keys now appear as
nullin the report. The side report's readers (compare, collate, A/B andscripts/prism_load_probe.py) read onlypreset.name,preset.sha256andpreset.gates.phases, which are unchanged.Tests run (minidev, on 00001ae)
python3 scripts/generate_prism_alerts.py --checkandpython3 scripts/generate_prism_metrics.py --check: exit 0 on the base tree and on this branch.python3 scripts/check_prism_alert_uids.py: OK.python3 -m unittest tests.test_prism_generated_artifact_checks tests.test_check_prism_alert_uids: OK.continue-on-error: true, and when the job is dropped from the aggregate'sneeds.cargo test --locked -p qbit-prism-load --lib: 58 passed.cargo fmt --all -- --check: clean.cargo clippy --locked -p qbit-prism-load --all-targets -- -D warnings: clean apart from the three known vendored sqlx-core warnings.CI must cover
The full Python shards and
rust-tests, including the observability inventory tests that also run both generators. Nothing PostgreSQL-gated was added.Left open (outside this PR's scope)
--snapshot,generate_prism_alerts.py --checkchecks only that the qbit-tools patch contains the current specification digest, not the patch body. A hand edit to a+line that keeps the digest line passes. The step name says what is actually checked.assert, whichPYTHONOPTIMIZEstrips. CI doesn't set it.PRISM_LOAD_MAX_SHORTFALL,PRISM_LOAD_TIP_LAST_NOTIFY_P99_BUDGET_MS) reach only the gate binary, so the side report shows the preset file's gates, and gate.md's Budget column shows what was applied.preset_report's doc comment says so.Refs #817
🤖 Generated with Claude Code