Module gate

Module gate 

Source
Expand description

2026-09-26: The pull-request gate: benchmark records committed beside the code they measured.

Owner: bench gate. Invariants: none beyond the types.

Each run writes one record file under .benchmarks/<id>/; a default-variant record is named YYYY-MM-DD-<sha>.json (record_path()). The thresholds a record must meet are assembled from every kernels/<hw>/<model>/BENCH.toml (read_baseline). check_gates judges every id in REQUIRED_GATES against the committed files.

Re-exports§

pub use check::Comparison;
pub use check::GateStatus;
pub use check::Standing;
pub use check::check_gates;
pub use check::check_record;
pub use check::compare;
pub use check::record_covers;
pub use check::record_standing;
pub use check::records_newest_first;
pub use record::Bound;
pub use record::GateBaseline;
pub use record::GateRecord;
pub use record::HardwareBaseline;
pub use record::ModelBaseline;
pub use record::date_of;
pub use record::merge_serve_overrides;
pub use record::now_secs;
pub use record::read_baseline;
pub use record::read_record;
pub use record::record_path;
pub use record::record_path_for;
pub use record::variant_slug;
pub use record::write_record;
pub use coverage::PERF_PATHS;

Modules§

agreement
2026-09-26: Do the records a PR adds agree with each other and with the head being certified?
amnesty
2026-09-26: Content-pinned amnesty: a table of paths whose exact blob at the head excuses them from invalidating gate records.
bench
2026-09-26: kernels/<hw>/<model>/BENCH.toml: a model’s benchmark entries and thresholds, beside its MODEL.toml, and baseline_for, which assembles one gate’s GateBaseline from every such file.
card
2026-09-26: Shareable result cards: a benchmark record rendered onto the SVG card template (assets/cards/result-card.svg).
check
2026-09-26: --pull-request-gate-check: does this commit have a passing record for every required gate? Reads .benchmarks/, the kernel tree and git diff; no endpoint, no GPU.
check_paths
2026-09-26: Which changed paths invalidate a gate record.
closure
2026-09-26: Excuse a kernel-only diff when every affected target still hashes to the closure its record attests.
codeowners
2026-09-26: Who owns a changed path, per .github/CODEOWNERS, for the telemetry table.
coverage
2026-09-26: Which changed paths invalidate which gate’s records.
group
2026-09-26: Benchmark groups: one gate satisfied by a complete partition of shard runs.
hermetic
2026-09-26: The serve keys met serve --hermetic closes, as one table that the bench and server crates both read.
pr_taxonomy
2026-09-26: The PR intent taxonomy (.github/pr-taxonomy.json): a tree of what a change is for (performance/decode, correctness/kv-cache), and the benchmarks each path implies. crate::gate::taxon is the separate hardware taxonomy derived from kernels/ paths.
recipe_closure
2026-10-02: The recipe a gate serves, as part of what its records attest.
record
2026-09-26: The committed shape of one gate run, the baseline shapes it is judged against, and reading both.
record_serve
2026-09-26: The serve settings a gate record discloses about the server it measured (GateRecord::serve_resolved).
required
2026-09-26: What a PR owes: the gates its changed paths invalidate (by_path) united with the gates its recorded intent classifications imply (by_intent).
scoring
2026-09-26: Scoring one record against one baseline, the pure half of the gate check: compare judges one metric against one bound, and check_record resolves the record’s own (hardware, checkpoint) pair and scores that entry’s pins and bounds.
signing
2026-09-26: Ed25519 signatures binding a gate record to the commit it measured.
taxon
2026-09-26: The gate’s view of the kernel taxonomy kernels/<hardware>/<model>/<quant>/: target enumeration, sources and configs, path-to-node helpers, and the set of targets a change affects.
telemetry
2026-09-26: The open-PR telemetry comment: which kernel targets each PR re-opens, which targets more than one open PR re-opens, a recommended merge order, and promotion-candidate debt.

Constants§

HARDWARE_TIMEOUT
2026-09-26: The timeout for the endpoint’s /hardware fetch when a gate record is written (bench_record.rs in metrale-server).
REQUIRED_GATES
2026-09-26: The ids of coverage::REQUIRED, in its order: the gates check_gates judges. A test in registry.rs looks up each id as a registered benchmark.

Functions§

dirty_perf_paths
2026-09-26: The files under PERF_PATHS that git status reports as modified, staged or untracked in this working tree, sorted and deduplicated. The gate run records this list, since a dirty perf path means the binary was not built from the commit the record names.
gate_dir
2026-09-26: .benchmarks/<benchmark_id> under root.
git_rev_parse
2026-09-26: The full 40-hex commit id rev resolves to in this working tree.
git_rev_parse_toplevel
2026-09-26: The repository root that contains dir, from git itself.
git_sha
2026-09-26: The short commit id of HEAD (--short=10), or the trimmed value of METRALE_GATE_SHA when that is set, for a checkout without git metadata.
shard_suffix
2026-09-26: The file-name tail for one shard’s record, -s<index>of<count>, 0-based like the --param shard=i/n that ran it. Empty for a whole-draw run.
shards_owed
2026-09-26: The (index, count) shards of group a certification at sha still owes, for a planner that wants wanted shards: