Repository navigation
feat(bench): the cutover gate, and the rule it applies (#1296) - #1297
Conversation
🦋 Changeset detectedLatest commit: e4a4731 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[Low impact] The PR appears safe to merge; no new actionable issues were found.
|
Coverage Report for CI Build 46361206591Coverage increased (+0.2%) to 77.855%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
…me the rule's authority
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
What
src/scripts/bench-gate.tsis the gate #868's cutover reads. It takes two schema-2 benchmarkartifacts (one
backend: "lmdb", onebackend: "postgres") and decides:by_id,author_kind,kind_since,tag— has itsp95_usband within 1.5× of the Postgres band's, tested at the band median and at the failing edge
(p90), each against the same bound (
2·lmdb ≤ 3·pg, integer cross-multiplication);create'sper_secondband is at or above 1× the Postgres band's, tested at the median and atp10.
An item whose median is inside the bound but whose failing edge is outside is a straddle, and a
straddle fails. Exit 0 pass, 1 fail, 2 refusal — one
bench-gate: refused: <detail>line onstderr, stdout always empty. A gated LMDB artifact needs
workload.repeats >= 3; a Postgresartifact needs at least 1 (a one-repeat Postgres artifact is legitimate and makes only the LMDB
edge testable). An artifact that records less work than its own corpus declares — a read-back
count short of its
events, or a gated shape with zero rows — is refused before any band iscompared, because the rig writes the artifact before
verify()runs.cpu_model,osandarchare printed and not compared; a null
cpu_model(a host with no/proc) prints asunknown.docs/rewrite/benchmarks.mdD8 carries the rule as the script defines it, the recorded run, andwhat the gate does not cover yet (the Postgres column is #1132's host and must be the same host;
1M/10M need disk and a quiet box). The script's named constants are the rule's definition and D8
is their reading, each text pointing at the other. D3's opening sentence names the four
find_by_filtersshapes and sayscountiscount_by_filters.The recorded run
No Postgres artifact exists in the tree, so until #1132 produces one the gate can only refuse.
Tests
test/unit/scripts/bench-gate.spec.tsspawns the gate on artifact pairs built in a temp directory— 29 rows / 33 cases, every case asserting exit status, exact stderr and empty stdout. The pass
fixture is spawned Postgres-first to prove roles come from
backend; refusal cases each trip onecheck a gate could plausibly skip. A25's two refusal rows are two cases each (one per artifact
side, one per gated kind) and A28's null-
cpu_modelfixture is one, which is where 33 comes from.test/unit/scripts/bench-gate-units.spec.tspins the exported pure functions in process (37cases): the argument contract, role resolution, the repeat floors, run completion, band parsing,
both verdicts and the workload comparison.
mocha --require ts-node/register --reporter dot test/unit/scripts/bench-gate.spec.ts→33 passingbench-gate-units.spec.ts→70 passing(also green with ts-node type-checking,no
TS_NODE_TRANSPILE_ONLY; the in-process file alone is37 passing).tsc --project tsconfig.build.json --noEmit→ exit 0.biome lint ./src ./test→ exit 0 (3 pre-existing warnings intest/unit/ci/).knip→ exit 0.Mutation checks: dropping the p90 edge test fails the two REQ straddle cases; reading
p10as themedian fails
pg-band; ignoring the repeat floor turnsrepeat-below-min's refusal into averdict; removing the completion check fails A25's four cases (29 passing, 4 failing); restoring
the string-only machine check fails the null fixture (32 passing, 1 failing); dropping
|| rows < 0from the row predicate fails
refuses a gated shape whose row count is below zero(36 passing, 1 failing).Note
R1's premise that knip derives entries from
package.jsonscripts does not hold with this knipversion/config (
Unused files (1) src/scripts/bench-gate.ts)..knip.jsonenumerates its entriesexplicitly, so the file is added there beside
scripts/benchmark-queries.ts;check:depsis green.The read-back signal is the rig's top-level
event_count_read_back(bench.rs:1188):volatile.storecarries only
data_bytes/bytes_per_eventandvolatile.timings.read_backhas no row count, so thefield the rig actually writes is the one the gate reads.