feat: add all-skills leaderboard (task 0007)

Add a second pure transform to the benchmark core: a `--leaderboard` mode
that ranks per-skill results models into an index leaderboard, one row per
skill carrying both verdicts, links out to each per-skill report, and sorts
any red first (regressions above efficacy failures), then fragile-but-passing,
then clean green.

The fragile tier reuses the 0006 per-badge chips: the efficacy chip now
carries its win count so the leaderboard reads it against the pass floor
without recomputing margins, and fragility is scoped to the passing tier so a
red row never carries a chip. The runner's SKILL.md gains the no-argument
batch flow and the index invocation. The fixture test covers the tiered sort,
the not-applicable Regression cell, and the per-skill links.
This commit was merged in pull request #7.
This commit is contained in:
2026-07-24 16:58:02 -04:00
parent f4df5d31c9
commit 97c0eeb055
4 changed files with 325 additions and 25 deletions

View File

@@ -6,6 +6,8 @@
# It also drives the longitudinal layer: the per-skill history append-and-trim,
# the two trend ribbons including the two-arm gap in the regression series, and
# the per-badge fragility chips on a clean run and a green-but-fragile one.
# Last it drives the all-skills leaderboard: the tiered sort, the not-applicable
# Regression cell, and the links out to each per-skill report.
# No LLM runs.
{
pkgs,
@@ -199,6 +201,8 @@ pkgs.runCommandLocal "benchmark-core-check"
# The narrowest efficacy case (fewest wins) carries the chip, the roomy one does not.
assert [ch["axis"] for ch in cases["narrowest"]["chips"]] == ["efficacy"], cases["narrowest"]["chips"]
assert cases["roomy"]["chips"] == [], cases["roomy"]["chips"]
# The efficacy chip carries the case's win count, not merely its label text.
assert cases["narrowest"]["chips"][0]["wins"] == 3, cases["narrowest"]["chips"]
print("clean-run assertions passed")
PY
@@ -277,5 +281,78 @@ pkgs.runCommandLocal "benchmark-core-check"
grep -q 'class="chip efficacy"' fragile.html || fail "fragile run omits the efficacy chip"
grep -q 'class="chip regression"' fragile.html || fail "fragile run omits the regression chip"
# --- all-skills leaderboard: tiered sort, the N/A cell, and per-skill links ---
echo "the core ranks per-skill results into a tiered index leaderboard"
# A synthetic clean-green skill whose narrowest efficacy margin sits above the
# floor, so it is the one input that reaches the clean-green tier. The four
# scored models above supply the other tiers: three-arm regresses (tier 0),
# two-arm fails efficacy with regression not-applicable (tier 1), and the
# clean and fragile green runs are both one flip from failing (tier 2).
python3 - robust.results.json leaky.results.json <<'PY' || fail "writing the leaderboard fixtures failed"
import json, sys
# A clean-green skill whose narrowest efficacy margin clears the floor, the
# one input that reaches the clean-green tier.
json.dump({
"skill": "robust-skill",
"efficacyVerdict": "green",
"regressionVerdict": "green",
"cases": [{"chips": [{"axis": "efficacy", "wins": 5}]}],
}, open(sys.argv[1], "w"))
# An efficacy-red skill whose still-green regression axis sits one loss from
# regressing, so it carries a regression chip yet belongs in the red tier.
json.dump({
"skill": "leaky-skill",
"efficacyVerdict": "red",
"regressionVerdict": "green",
"cases": [{"chips": [{"axis": "regression"}]}],
}, open(sys.argv[2], "w"))
PY
python3 "$core" --leaderboard \
three.json two.json clean.json fragile.json robust.results.json leaky.results.json \
--json board.json --html board.html \
|| fail "the core exited non-zero rendering the leaderboard"
python3 - board.json <<'PY' || fail "a leaderboard assertion failed"
import json, sys
rows = json.load(open(sys.argv[1]))
# Any red first regressions above efficacy failures, efficacy failures
# ordered by name then fragile-passing by name, then clean green.
assert [r["skill"] for r in rows] == [
"sample-skill", "leaky-skill", "sample-skill-2arm",
"clean-skill", "fragile-skill", "robust-skill",
], [r["skill"] for r in rows]
assert [r["tier"] for r in rows] == [0, 1, 1, 2, 2, 3], [r["tier"] for r in rows]
by = {r["skill"]: r for r in rows}
# The regressed skill outranks the merely-efficacy-failed ones.
assert by["sample-skill"]["regressionVerdict"] == "red"
# A skill with no previous version reads not-applicable in its Regression cell.
assert by["sample-skill-2arm"]["regressionVerdict"] == "not-applicable"
assert by["sample-skill-2arm"]["efficacyVerdict"] == "red"
# The fragile tier reuses the per-badge chips: a floor-bound efficacy margin,
# a case one loss from regressing, or both.
assert by["clean-skill"]["fragileAxes"] == ["efficacy"], by["clean-skill"]
assert by["fragile-skill"]["fragileAxes"] == ["efficacy", "regression"], by["fragile-skill"]
assert by["robust-skill"]["fragileAxes"] == [], by["robust-skill"]
# A red skill carries no fragility chip even when a still-passing axis is at
# its edge, so the chip stays the marker of the fragile-but-passing tier.
assert by["leaky-skill"]["fragileAxes"] == [], by["leaky-skill"]
# Every row links out to its per-skill report, keyed by skill name.
for r in rows:
assert r["href"] == r["skill"] + ".html", r
print("leaderboard assertions passed")
PY
echo "the leaderboard is self-contained and links out to each per-skill report"
grep -q '<!doctype html>' board.html || fail "the leaderboard is not self-contained"
for skill in sample-skill sample-skill-2arm clean-skill fragile-skill robust-skill leaky-skill; do
grep -q "href=\"$skill.html\"" board.html || fail "the leaderboard omits the link to $skill"
done
grep -q '>N/A<' board.html || fail "the leaderboard omits the not-applicable Regression cell"
grep -q 'near regressing' board.html || fail "the leaderboard omits the regression fragility chip"
grep -q 'narrow efficacy' board.html || fail "the leaderboard omits the efficacy fragility chip"
touch "$out"
''