Compares cms e2e/render-bench/results/latest.json (written by the dojo render-bench suite) against the committed baseline.json. FAILs when home-page p50 exceeds baseline by >25%, with an explicit instruction to investigate and never bump the baseline without Captain approval. p95 breach (>40%) WARNs only: measured ambient p95 variance on an idle dev instance exceeds 100% between runs while p50 holds within ~7%, so a hard tail gate would block unrelated commits on dev-stack noise. SKIPs (never blocks) when: baseline.json absent (non-cms repo), latest.json absent (bench not run), latest older than 7 days, or latest predates the baseline — each with a nudge to run the suite from dojo. Comparison logic is Reporter-free and unit-tested (renderperf_test.go). Verified against the live tree in all three states: OK (p50 22.9 vs 27.3ms), FAIL (26% slower via delay proxy, mandated message), SKIP (latest.json removed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"time"
|
|
)
|
|
|
|
func init() {
|
|
register(Check{
|
|
Seq: 300,
|
|
ID: "30",
|
|
Title: "Render benchmark: home-page p50 within baseline (WO-RP-013)",
|
|
Run: func(ctx *ScanContext, rep *Reporter) {
|
|
benchDir := filepath.Join(ctx.repoRoot, "e2e", "render-bench")
|
|
baselinePath := filepath.Join(benchDir, "baseline.json")
|
|
if _, err := os.Stat(baselinePath); err != nil {
|
|
rep.Skip("no e2e/render-bench/baseline.json in this repo — render-perf gate not applicable")
|
|
return
|
|
}
|
|
latestPath := filepath.Join(benchDir, "results", "latest.json")
|
|
if _, err := os.Stat(latestPath); err != nil {
|
|
rep.Skip("render bench not run (no results/latest.json) — run the `render-bench` suite from dojo to gate render performance")
|
|
return
|
|
}
|
|
|
|
baseline, err := loadRenderBench(baselinePath)
|
|
if err != nil {
|
|
rep.Warn("render-perf baseline unreadable: %v", err)
|
|
return
|
|
}
|
|
latest, err := loadRenderBench(latestPath)
|
|
if err != nil {
|
|
rep.Warn("render-perf latest.json unreadable: %v — re-run the render-bench suite from dojo", err)
|
|
return
|
|
}
|
|
|
|
v := compareRenderPerf(baseline, latest, time.Now())
|
|
switch {
|
|
case v.skip:
|
|
rep.Skip("%s", v.message)
|
|
case v.fail:
|
|
rep.Fail("%s", v.message)
|
|
case v.warn:
|
|
rep.Warn("%s", v.message)
|
|
default:
|
|
rep.OK("%s", v.message)
|
|
}
|
|
},
|
|
})
|
|
}
|