From 4f571256f1c5657fc4443085995abd7e09396b01 Mon Sep 17 00:00:00 2001 From: darth-alexus Date: Tue, 17 Nov 2026 15:19:57 +0100 Subject: [PATCH 1/2] Keep every published result release viewable under v// The site also serves each published release at v// with a Results version menu, so a paper can link the exact numbers it cites. Only the newest releases and those listed in data/full_versions.yaml keep their per-piece views; older ones show their tables, keeping the site under the Pages limit. --- .github/workflows/pages.yml | 10 ++- data/full_versions.yaml | 18 +++++ docs/index.html | 87 +++++++++++++++++++- docs/maintaining.md | 17 ++++ matchmaker_eval/build_site.py | 101 ++++++++++++++++++++--- matchmaker_eval/release_results.py | 39 ++++++++- tests/test_workflows.py | 126 +++++++++++++++++++++++++++++ 7 files changed, 384 insertions(+), 14 deletions(-) create mode 100644 data/full_versions.yaml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index b4ba727..9debb3d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,4 +1,5 @@ # Publish selected runs as a release and deploy the leaderboard from its snapshot. +# Every published release is also served under v// (version menu). name: Publish leaderboard on: @@ -7,6 +8,7 @@ on: paths: - "docs/**" - ".github/workflows/pages.yml" + - "data/full_versions.yaml" workflow_dispatch: inputs: source_runs: @@ -56,11 +58,15 @@ jobs: SOURCE_RUNS: ${{ inputs.source_runs }} RELEASE_TAG: ${{ inputs.release_tag }} run: | - python matchmaker_eval/release_results.py --source-runs "$SOURCE_RUNS" --tag "$RELEASE_TAG" + python matchmaker_eval/release_results.py --source-runs "$SOURCE_RUNS" --tag "$RELEASE_TAG" \ + --versions-dir "$RUNNER_TEMP/benchmark-versions" - name: Assemble the site if: steps.results.outputs.ready == 'true' - run: python matchmaker_eval/build_site.py _site + # Every published release is also kept under v//, so a cited + # version stays viewable; data/full_versions.yaml decides which keep + # their per-piece views. + run: python matchmaker_eval/build_site.py _site --versions "$RUNNER_TEMP/benchmark-versions" - uses: actions/configure-pages@v5 if: steps.results.outputs.ready == 'true' diff --git a/data/full_versions.yaml b/data/full_versions.yaml new file mode 100644 index 0000000..2f9f0ac --- /dev/null +++ b/data/full_versions.yaml @@ -0,0 +1,18 @@ +# Which published result versions the website shows in full. +# +# Every published `benchmark-*` release stays on the website under v// +# and in the "Results version" menu. Versions listed here (and the newest +# ones) also keep their per-piece views and plots, about 25-30 MB each. All +# other versions show their tables only (under 1 MB); their per-piece results +# stay downloadable from the release files on GitHub. +# +# GitHub Pages allows 1 GB per site, so keep this list short. + +# How many of the newest releases to show in full. +newest: 3 + +# Versions that are always shown in full, whatever their age. Add every +# version a paper cites, e.g. the release made for the TISMIR submission. +# A tag listed here that has not been published yet only causes a warning. +keep: + - benchmark-v1 # TODO: the paper's version; confirm the tag once the final rerun is released diff --git a/docs/index.html b/docs/index.html index a7fbc57..e1bd694 100644 --- a/docs/index.html +++ b/docs/index.html @@ -142,6 +142,24 @@ color: var(--ink-soft); } + /* ── Result versions ──────────────────────────────────────────────────── */ + .versions { + display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; + font-size: 13px; color: var(--ink-soft); + } + .versions select { + font-family: var(--ui); font-size: 13px; color: var(--ink); + background: var(--surface); border: 1px solid var(--rule-firm); + border-radius: 2px; padding: 5px 9px; max-width: 100%; + } + .versions a { color: var(--ink-soft); text-underline-offset: 2px; } + .version-note { + border-left: 3px solid var(--warn); background: var(--surface); + padding: 8px 12px; font-size: 13px; color: var(--ink-soft); + } + .version-note b { color: var(--ink); font-weight: 500; } + .version-note a { color: var(--ink); text-underline-offset: 2px; } + /* ── Controls ─────────────────────────────────────────────────────────── */ .controls { display: flex; @@ -540,6 +558,12 @@

Matchmaker Benchmark

+ +
@@ -1129,7 +1153,10 @@

Submitting

container.innerHTML = '

Loading the full record…

'; const detail = await loadDetail(entry); if (!detail) { - container.innerHTML = '

Per-piece results are not published for this entry.

'; + container.innerHTML = tablesOnly + ? `

This older version is shown with its tables only. Per-piece results + are in its release files.

` + : '

Per-piece results are not published for this entry.

'; return; } @@ -1487,6 +1514,64 @@

Submitting

return null; } +// Published result versions. Pages serves the latest release at the root and +// every release under v// (build_site.py --versions); versions.json at +// the root lists them, newest first. Without it (a local checkout) the menu +// stays hidden. +const VERSION_PATH = location.pathname.match(/\/v\/(benchmark-[A-Za-z0-9][A-Za-z0-9._-]*)\/(?:index\.html)?$/); +const SITE_ROOT = VERSION_PATH ? "../../" : "./"; + +async function fetchJson(url) { + try { + const response = await fetch(url); + return response.ok ? await response.json() : null; + } catch (error) { return null; } +} + +// Set to this version's release URL when the site has its tables only. +let tablesOnly = null; + +async function showVersions() { + const [index, release] = await Promise.all([ + fetchJson(SITE_ROOT + "versions.json"), fetchJson("./release.json"), + ]); + const versions = (index && index.versions) || []; + const shown = release && release.tag; + if (!shown || !versions.length) return; + if (!versions.some((v) => v.tag === shown)) versions.unshift({ tag: shown }); + const newest = versions[0].tag; + const date = (v) => (v.published_at || "").slice(0, 10); + const select = el("version-select"); + select.innerHTML = versions.map((v) => ``).join(""); + select.addEventListener("change", () => { + // The newest version lives at the root; every version, newest included, + // also has a permanent address under v//. + location.href = SITE_ROOT + (select.value === newest ? "" : `v/${encodeURIComponent(select.value)}/`); + }); + const current = versions.find((v) => v.tag === shown); + const link = el("version-release"); + link.href = (current && current.url) + || `https://github.com/pymatchmaker/matchmaker_benchmark/releases/tag/${encodeURIComponent(shown)}`; + // Older versions may be published with their tables only (full_versions.yaml). + if (VERSION_PATH && current && current.full === false) tablesOnly = link.href; + el("versions").hidden = false; + + const note = el("version-note"); + if (shown !== newest) { + note.innerHTML = `You are viewing ${escapeHtml(shown)}${current && date(current) ? `, published ${escapeHtml(date(current))}` : ""}. + Newer results exist: see the latest version (${escapeHtml(newest)}).${ + tablesOnly ? " Per-piece plots for this version are in its release files." : ""}`; + note.hidden = false; + } else { + const permanent = new URL(`v/${encodeURIComponent(shown)}/`, new URL(SITE_ROOT, location.href)).href; + note.innerHTML = `To cite these exact numbers, link this version: ${escapeHtml(permanent)}`; + note.hidden = false; + note.style.borderLeftColor = "var(--accent)"; + } +} +showVersions(); + loadBoard().then((board) => { if (!board) { const empty = el("empty"); diff --git a/docs/maintaining.md b/docs/maintaining.md index b549874..92a8617 100644 --- a/docs/maintaining.md +++ b/docs/maintaining.md @@ -489,6 +489,23 @@ somewhere else. files, CSVs and details of a release snapshot, and deploys it to GitHub Pages. Documentation changes redeploy the latest release. +### Older result versions + +Every deployment also includes all published releases under their own path, +`v//` (for example +`https://pymatchmaker.github.io/matchmaker_benchmark/v/benchmark-v1/`), and the +page shows a **Results version** menu. The root always shows the latest release; +older versions show a note that newer results exist. Link a paper to its +`v//` address so readers see exactly the cited numbers. Each version is +shown with the current page code. + +Per-piece views take almost all of a version's space (about 25–30 MB, against +under 1 MB for its tables), and GitHub Pages allows 1 GB in total. So only the +newest versions and those listed in `data/full_versions.yaml` keep them; all +other versions show their tables, with the per-piece results in their release +files. **Add every version a paper cites to `keep`** in that file. A listed tag +that is not published yet only produces a warning in the publish run. + ### What the site can show `results/leaderboard.json` is the index: one row per entry, small enough to load diff --git a/matchmaker_eval/build_site.py b/matchmaker_eval/build_site.py index b44acef..e35075c 100644 --- a/matchmaker_eval/build_site.py +++ b/matchmaker_eval/build_site.py @@ -2,12 +2,21 @@ python matchmaker_eval/build_site.py _site # what Pages publishes python matchmaker_eval/build_site.py --serve # ...and open it locally + python matchmaker_eval/build_site.py _site --versions DIR # plus v// The site is ``docs/`` plus what the page reads and links to: the leaderboard JSON and CSV, the same pair per dataset, and the per-entry detail files. Both the publish workflow and the staging preview call this, so what you look at before merging is assembled by the same code as what goes live. +With ``--versions``, every published result release found in DIR (as written +by ``release_results.py --versions-dir``) is also assembled under +``v//``, and ``versions.json`` lists them for the page's version menu. +``data/full_versions.yaml`` decides which versions keep their per-piece views +(the newest few and any cited version); the others show their tables only. +Each version uses the current page with that release's data, so a link such +as ``v/benchmark-v1/`` keeps showing the numbers a paper cites. + The page also reads ``../results/`` when it is served from a checkout, so ``--serve`` from the repository root works without assembling anything; the assembled form is what Pages uploads. @@ -23,20 +32,32 @@ sys.path.insert(0, str(_path)) import argparse +import json +import re import shutil from matchmaker_eval.folds import REPO_ROOT, RESULTS_DIR DOCS_DIR = REPO_ROOT / "docs" +FULL_VERSIONS = REPO_ROOT / "data" / "full_versions.yaml" class SiteError(Exception): """Raised when the site cannot be assembled.""" -def build(destination: Path) -> dict: - """Copy docs/ and the result files into ``destination``. Returns a summary.""" +#: A published result tag, as release_results.py creates them. +VERSION_TAG = re.compile(r"benchmark-[A-Za-z0-9][A-Za-z0-9._-]*") + + +def build(destination: Path, results_dir: Path = None, details: bool = True) -> dict: + """Copy docs/ and the result files into ``destination``. Returns a summary. + + ``details=False`` leaves out the per-piece views, which are almost all of + a version's size; the tables and archived keys are always included. + """ destination = Path(destination) + results_dir = Path(results_dir or RESULTS_DIR) if destination.exists(): shutil.rmtree(destination) if not DOCS_DIR.is_dir(): @@ -44,29 +65,29 @@ def build(destination: Path) -> dict: shutil.copytree(DOCS_DIR, destination) summary = {"boards": [], "details": 0, "archives": 0, "missing": []} - for name in ("leaderboard.json", "leaderboard.csv"): - source = RESULTS_DIR / name + for name in ("leaderboard.json", "leaderboard.csv", "release.json"): + source = results_dir / name if source.exists(): shutil.copy2(source, destination / name) else: summary["missing"].append(name) # leaderboard-.json/.csv: the page links to them for download. - for source in sorted(RESULTS_DIR.glob("leaderboard-*.*")): + for source in sorted(results_dir.glob("leaderboard-*.*")): if source.suffix in (".json", ".csv"): shutil.copy2(source, destination / source.name) summary["boards"].append(source.name) - details = RESULTS_DIR / "details" - if details.is_dir(): + details_dir = results_dir / "details" + if details and details_dir.is_dir(): target = destination / "details" target.mkdir(exist_ok=True) - for path in sorted(details.glob("*.json")): + for path in sorted(details_dir.glob("*.json")): shutil.copy2(path, target / path.name) summary["details"] += 1 # Every leaderboard ever published under an evaluation key, so a key cited # in a paper resolves to archive//leaderboard.json on the site. - archive = RESULTS_DIR / "archive" + archive = results_dir / "archive" if archive.is_dir(): shutil.copytree(archive, destination / "archive") summary["archives"] = sum(1 for path in archive.iterdir() if path.is_dir()) @@ -79,6 +100,56 @@ def build(destination: Path) -> dict: return summary +def full_version_rule(path: Path = None) -> dict: + """Read data/full_versions.yaml: how many newest versions, and which tags, + keep their per-piece views on the site.""" + import yaml + + path = Path(path or FULL_VERSIONS) + config = (yaml.safe_load(path.read_text()) if path.is_file() else None) or {} + newest = config.get("newest", 3) + keep = config.get("keep") or [] + if not isinstance(newest, int) or newest < 1: + raise SiteError(f"{path}: 'newest' must be a positive whole number") + if not isinstance(keep, list) or not all(isinstance(t, str) for t in keep): + raise SiteError(f"{path}: 'keep' must be a list of release tags") + return {"newest": newest, "keep": keep} + + +def add_versions(destination: Path, versions_dir: Path, rule: dict = None) -> list: + """Assemble every downloaded release under ``destination/v//``. + + ``versions_dir/versions.json`` (newest first) decides what is listed; a + release whose snapshot is missing is left out rather than linked broken. + The newest versions and those kept by name (``full_version_rule``) are + assembled in full, the rest without per-piece views. Returns the listed + versions, also written to ``destination/versions.json``. + """ + destination, versions_dir = Path(destination), Path(versions_dir) + rule = rule or full_version_rule() + index = versions_dir / "versions.json" + if not index.is_file(): + raise SiteError(f"{index} is missing — run release_results.py --versions-dir first.") + listed = [] + for version in json.loads(index.read_text()).get("versions", []): + tag = version.get("tag", "") + if not VERSION_TAG.fullmatch(tag) or not (versions_dir / tag / "leaderboard.json").is_file(): + continue + full = len(listed) < rule["newest"] or tag in rule["keep"] + summary = build(destination / "v" / tag, versions_dir / tag, details=full) + if "release.json" in summary["missing"]: + raise SiteError(f"release {tag} has no release.json") + listed.append({**{key: version.get(key) for key in ("tag", "published_at", "url", "evaluation_keys")}, + "full": full}) + missing = [tag for tag in rule["keep"] if tag not in {v["tag"] for v in listed}] + for tag in missing: + # Expected until that version is published (e.g. the paper's release). + print(f"::warning::{tag} is kept in full by data/full_versions.yaml but is not published yet") + (destination / "versions.json").write_text( + json.dumps({"versions": listed}, indent=2) + "\n") + return listed + + def serve(directory: Path, port: int) -> None: import functools import http.server @@ -115,10 +186,18 @@ def main(): help="serve the assembled site over HTTP and keep running", ) parser.add_argument("--port", type=int, default=8000, help="port for --serve") + parser.add_argument( + "--versions", + type=Path, + default=None, + help="folder of downloaded releases (release_results.py --versions-dir); " + "each is added under v//", + ) args = parser.parse_args() try: summary = build(Path(args.destination)) + versions = add_versions(Path(args.destination), args.versions) if args.versions else [] except SiteError as e: print(f"\n{e}", file=sys.stderr) return 1 @@ -129,6 +208,10 @@ def main(): f"per-dataset file(s), {summary['details']} detail file(s), " f"{summary['archives']} archived key(s)" ) + if args.versions: + print(f" {len(versions)} published version(s) under v/: " + + (", ".join(v["tag"] + ("" if v["full"] else " (tables only)") for v in versions) + or "none")) for name in summary["missing"]: print(f" note: results/{name} was not there") if args.serve: diff --git a/matchmaker_eval/release_results.py b/matchmaker_eval/release_results.py index b60fe80..28d7182 100644 --- a/matchmaker_eval/release_results.py +++ b/matchmaker_eval/release_results.py @@ -8,6 +8,7 @@ import json import os from pathlib import Path +import re import shutil import subprocess import sys @@ -33,9 +34,16 @@ def releases(repo): return [release for page in pages for release in page] +def published(records): + """Published result releases with a website snapshot, newest first.""" + candidates = [r for r in records if r["tag_name"].startswith("benchmark-") + and not r["draft"] and not r["prerelease"] + and any(a["name"] == SNAPSHOT for a in r["assets"])] + return sorted(candidates, key=lambda r: r["published_at"], reverse=True) + + def latest(records): - candidates = [r for r in records if r["tag_name"].startswith("benchmark-")] - return max(candidates, key=lambda r: r["published_at"], default=None) + return next(iter(published(records)), None) def extract(archive, destination): @@ -137,11 +145,34 @@ def publish(repo, tag, run_ids, records, destination): return tag +def fetch_versions(repo, records, destination): + """Download every published snapshot to ``destination//`` for the site. + + ``versions.json`` lists them newest first, for the page's version menu. + """ + destination = Path(destination) + destination.mkdir(parents=True, exist_ok=True) + versions = [] + for release in published(records): + tag = release["tag_name"] + if not re.fullmatch(r"benchmark-[A-Za-z0-9][A-Za-z0-9._-]*", tag): + continue + fetch(repo, release, destination / tag) + manifest = json.loads((destination / tag / "release.json").read_text()) + versions.append({"tag": tag, "published_at": release["published_at"], + "url": release["html_url"], + "evaluation_keys": manifest.get("evaluation_keys", {})}) + (destination / "versions.json").write_text(json.dumps({"versions": versions}, indent=2) + "\n") + return versions + + def main(): parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) parser.add_argument("--repo", default=os.environ.get("GITHUB_REPOSITORY")) parser.add_argument("--tag", default="") parser.add_argument("--source-runs", default="", help="space-separated completed CI run IDs") + parser.add_argument("--versions-dir", type=Path, default=None, + help="also download every published release here, for the site's version menu") args = parser.parse_args() records = releases(args.repo) @@ -155,6 +186,10 @@ def main(): tag = release["tag_name"] if release else "" if release: fetch(args.repo, release, RESULTS_DIR) + if tag and args.versions_dir: + # Listed again: a release created just now is not in `records`. + versions = fetch_versions(args.repo, releases(args.repo), args.versions_dir) + print(f"Versions for the site: {', '.join(v['tag'] for v in versions)}") if os.environ.get("GITHUB_OUTPUT"): with open(os.environ["GITHUB_OUTPUT"], "a") as stream: stream.write(f"ready={'true' if tag else 'false'}\ntag={tag}\n") diff --git a/tests/test_workflows.py b/tests/test_workflows.py index 6a52ffa..33de235 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -149,6 +149,132 @@ def test_it_assembles_what_the_page_reads(self, tmp_path): assert (site / "leaderboard.json").exists() assert summary["details"] >= 0 + def test_every_published_version_gets_its_own_path(self, tmp_path): + """A cited release stays viewable after newer results are published.""" + import json + import build_site + + versions = tmp_path / "versions" + for tag, generated in (("benchmark-v2", "new"), ("benchmark-v1", "old")): + (versions / tag / "details").mkdir(parents=True) + (versions / tag / "leaderboard.json").write_text(json.dumps({"generated": generated})) + (versions / tag / "release.json").write_text(json.dumps({"tag": tag})) + (versions / "benchmark-v0").mkdir() # listed, but its snapshot is missing + (versions / "versions.json").write_text(json.dumps({"versions": [ + {"tag": "benchmark-v2", "published_at": "2026-12-01T00:00:00Z", "url": "u2"}, + {"tag": "benchmark-v1", "published_at": "2026-11-20T00:00:00Z", "url": "u1"}, + {"tag": "benchmark-v0"}, + {"tag": "../escape"}, + ]})) + site = tmp_path / "site" + build_site.build(site) + listed = build_site.add_versions(site, versions, {"newest": 3, "keep": []}) + + assert [v["tag"] for v in listed] == ["benchmark-v2", "benchmark-v1"] + assert all(v["full"] for v in listed) + assert json.loads((site / "versions.json").read_text())["versions"] == listed + for tag, generated in (("benchmark-v2", "new"), ("benchmark-v1", "old")): + assert (site / "v" / tag / "index.html").exists() + assert json.loads((site / "v" / tag / "leaderboard.json").read_text()) == {"generated": generated} + assert not (site / "v" / "benchmark-v0").exists() + # The root site is left as built from the current results. + assert (site / "leaderboard.json").exists() + + def test_only_the_newest_and_kept_versions_keep_per_piece_views(self, tmp_path, capsys): + """Older versions shrink to their tables, so the site stays under the + Pages size limit, while a version a paper cites is never trimmed.""" + import json + import build_site + + versions = tmp_path / "versions" + tags = [f"benchmark-v{n}" for n in (5, 4, 3, 2, 1)] # newest first + for tag in tags: + (versions / tag / "details").mkdir(parents=True) + (versions / tag / "details" / "m-midi.json").write_text("{}") + (versions / tag / "leaderboard.json").write_text("{}") + (versions / tag / "release.json").write_text(json.dumps({"tag": tag})) + (versions / "versions.json").write_text(json.dumps( + {"versions": [{"tag": tag} for tag in tags]})) + site = tmp_path / "site" + build_site.build(site) + rule = {"newest": 2, "keep": ["benchmark-v1", "benchmark-v9"]} + listed = build_site.add_versions(site, versions, rule) + + full = {v["tag"]: v["full"] for v in listed} + assert full == {"benchmark-v5": True, "benchmark-v4": True, "benchmark-v3": False, + "benchmark-v2": False, "benchmark-v1": True} + for tag, kept in full.items(): + assert (site / "v" / tag / "details" / "m-midi.json").exists() is kept + assert (site / "v" / tag / "leaderboard.json").exists() + # A kept tag that is not published yet is a reminder, not an error. + assert "benchmark-v9 is kept in full" in capsys.readouterr().out + + def test_the_committed_full_version_rule_is_valid(self): + import build_site + + rule = build_site.full_version_rule() + assert rule["newest"] >= 1 + assert all(build_site.VERSION_TAG.fullmatch(tag) for tag in rule["keep"]) + + def test_a_malformed_full_version_rule_is_refused(self, tmp_path): + import build_site + + path = tmp_path / "full_versions.yaml" + path.write_text("newest: 0\n") + with pytest.raises(build_site.SiteError, match="newest"): + build_site.full_version_rule(path) + path.write_text("keep: benchmark-v1\n") + with pytest.raises(build_site.SiteError, match="keep"): + build_site.full_version_rule(path) + + def test_versions_need_the_downloaded_index(self, tmp_path): + import build_site + + build_site.build(tmp_path / "site") + with pytest.raises(build_site.SiteError, match="versions.json is missing"): + build_site.add_versions(tmp_path / "site", tmp_path / "nothing") + + def test_release_versions_are_downloaded_newest_first(self, tmp_path, monkeypatch): + import json + from matchmaker_eval import release_results as R + + def release(tag, published, draft=False, snapshot=True): + return {"tag_name": tag, "published_at": published, "draft": draft, + "prerelease": False, "html_url": f"https://example/{tag}", + "assets": [{"name": R.SNAPSHOT}] if snapshot else []} + + records = [ + release("benchmark-v1", "2026-11-20T00:00:00Z"), + release("benchmark-v2", "2026-12-01T00:00:00Z"), + release("benchmark-v3", "2026-12-05T00:00:00Z", draft=True), + release("benchmark-v4", "2026-12-06T00:00:00Z", snapshot=False), + release("v0.4.0", "2026-10-27T00:00:00Z"), + ] + fetched = [] + + def fake_fetch(repo, rel, destination): + fetched.append(rel["tag_name"]) + destination.mkdir(parents=True) + (destination / "release.json").write_text(json.dumps( + {"evaluation_keys": {"midi": "ek2-" + rel["tag_name"][-2:]}})) + + monkeypatch.setattr(R, "fetch", fake_fetch) + versions = R.fetch_versions("owner/repo", records, tmp_path / "versions") + + assert fetched == ["benchmark-v2", "benchmark-v1"] + assert [v["tag"] for v in versions] == ["benchmark-v2", "benchmark-v1"] + assert versions[0]["url"] == "https://example/benchmark-v2" + assert versions[0]["evaluation_keys"] == {"midi": "ek2-v2"} + on_disk = json.loads((tmp_path / "versions" / "versions.json").read_text()) + assert on_disk["versions"] == versions + assert R.latest(records)["tag_name"] == "benchmark-v2" + + def test_the_publish_workflow_builds_the_version_paths(self): + pages = (WORKFLOWS / "pages.yml").read_text() + assert '--versions-dir "$RUNNER_TEMP/benchmark-versions"' in pages + assert 'build_site.py _site --versions "$RUNNER_TEMP/benchmark-versions"' in pages + assert "data/full_versions.yaml" in pages # editing the rule redeploys + def test_it_refuses_to_build_without_a_leaderboard(self, tmp_path, monkeypatch): import build_site From 12aa2a64bc3a5969704deb710ba51b619f203c80 Mon Sep 17 00:00:00 2001 From: darth-alexus Date: Thu, 19 Nov 2026 22:08:05 +0100 Subject: [PATCH 2/2] Address review: vX.Y.Z tags under versions/, no republishing of old tags, constants instead of full_versions.yaml - Result releases are tagged vMAJOR.MINOR.PATCH and served at versions//. The tag format is checked in one place (TAG in release_results.py). - Without source_runs, Publish leaderboard always redeploys the latest release, so the root is the newest version and the menu's latest link holds. - NEWEST_FULL_VERSIONS and PINNED_FULL_VERSIONS in build_site.py decide which releases keep their per-piece views; data/full_versions.yaml is removed. - Fewer checks and fallbacks, the explanation only in maintaining.md, and the three behaviour tests. --- .github/workflows/pages.yml | 9 +- data/full_versions.yaml | 18 ---- docs/index.html | 47 ++++------ docs/maintaining.md | 33 ++++--- matchmaker_eval/build_site.py | 80 +++++------------ matchmaker_eval/release_results.py | 15 ++-- tests/test_workflows.py | 139 ++++++++++------------------- 7 files changed, 116 insertions(+), 225 deletions(-) delete mode 100644 data/full_versions.yaml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 60bc12a..5a89dfb 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,5 +1,4 @@ # Publish selected runs as a release and deploy the leaderboard from its snapshot. -# Every published release is also served under v// (version menu). name: Publish leaderboard on: @@ -8,15 +7,14 @@ on: paths: - "docs/**" - ".github/workflows/pages.yml" - - "data/full_versions.yaml" workflow_dispatch: inputs: source_runs: - description: "Completed CI run IDs, separated by spaces; later runs replace entries (empty = republish)" + description: "Completed CI run IDs, separated by spaces; later runs replace entries (empty = redeploy the latest release)" required: false default: "" release_tag: - description: "New benchmark-* tag when releasing; otherwise existing tag or empty for latest" + description: "New release tag vX.Y.Z (needed with source_runs)" required: false default: "" @@ -64,9 +62,6 @@ jobs: - name: Assemble the site if: steps.results.outputs.ready == 'true' - # Every published release is also kept under v//, so a cited - # version stays viewable; data/full_versions.yaml decides which keep - # their per-piece views. run: python matchmaker_eval/build_site.py _site --versions "$RUNNER_TEMP/benchmark-versions" - uses: actions/configure-pages@v5 diff --git a/data/full_versions.yaml b/data/full_versions.yaml deleted file mode 100644 index 2f9f0ac..0000000 --- a/data/full_versions.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Which published result versions the website shows in full. -# -# Every published `benchmark-*` release stays on the website under v// -# and in the "Results version" menu. Versions listed here (and the newest -# ones) also keep their per-piece views and plots, about 25-30 MB each. All -# other versions show their tables only (under 1 MB); their per-piece results -# stay downloadable from the release files on GitHub. -# -# GitHub Pages allows 1 GB per site, so keep this list short. - -# How many of the newest releases to show in full. -newest: 3 - -# Versions that are always shown in full, whatever their age. Add every -# version a paper cites, e.g. the release made for the TISMIR submission. -# A tag listed here that has not been published yet only causes a warning. -keep: - - benchmark-v1 # TODO: the paper's version; confirm the tag once the final rerun is released diff --git a/docs/index.html b/docs/index.html index 0d5454f..1afb944 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1526,12 +1526,11 @@

Submitting

return null; } -// Published result versions. Pages serves the latest release at the root and -// every release under v// (build_site.py --versions); versions.json at -// the root lists them, newest first. Without it (a local checkout) the menu -// stays hidden. -const VERSION_PATH = location.pathname.match(/\/v\/(benchmark-[A-Za-z0-9][A-Za-z0-9._-]*)\/(?:index\.html)?$/); -const SITE_ROOT = VERSION_PATH ? "../../" : "./"; +// Published result versions: the latest release at the root, every release +// under versions//, listed newest first in versions.json at the root. +// Without that file (a local checkout) the menu stays hidden. +const IN_VERSION = /\/versions\/v\d+\.\d+\.\d+\/(?:index\.html)?$/.test(location.pathname); +const SITE_ROOT = IN_VERSION ? "../../" : "./"; async function fetchJson(url) { try { @@ -1540,7 +1539,7 @@

Submitting

} catch (error) { return null; } } -// Set to this version's release URL when the site has its tables only. +// This version's release URL when it is shown with its tables only. let tablesOnly = null; async function showVersions() { @@ -1548,39 +1547,31 @@

Submitting

fetchJson(SITE_ROOT + "versions.json"), fetchJson("./release.json"), ]); const versions = (index && index.versions) || []; - const shown = release && release.tag; - if (!shown || !versions.length) return; - if (!versions.some((v) => v.tag === shown)) versions.unshift({ tag: shown }); - const newest = versions[0].tag; - const date = (v) => (v.published_at || "").slice(0, 10); + const current = release && versions.find((v) => v.tag === release.tag); + if (!current) return; + const newest = versions[0]; + const date = (v) => v.published_at.slice(0, 10); const select = el("version-select"); select.innerHTML = versions.map((v) => ``).join(""); + ${v === current ? "selected" : ""}>${escapeHtml(v.tag)} · ${escapeHtml(date(v))}${v === newest ? " (latest)" : ""}`).join(""); select.addEventListener("change", () => { - // The newest version lives at the root; every version, newest included, - // also has a permanent address under v//. - location.href = SITE_ROOT + (select.value === newest ? "" : `v/${encodeURIComponent(select.value)}/`); + location.href = SITE_ROOT + (select.value === newest.tag ? "" : `versions/${select.value}/`); }); - const current = versions.find((v) => v.tag === shown); - const link = el("version-release"); - link.href = (current && current.url) - || `https://github.com/pymatchmaker/matchmaker_benchmark/releases/tag/${encodeURIComponent(shown)}`; - // Older versions may be published with their tables only (full_versions.yaml). - if (VERSION_PATH && current && current.full === false) tablesOnly = link.href; + el("version-release").href = current.url; + if (!current.full) tablesOnly = current.url; el("versions").hidden = false; const note = el("version-note"); - if (shown !== newest) { - note.innerHTML = `You are viewing ${escapeHtml(shown)}${current && date(current) ? `, published ${escapeHtml(date(current))}` : ""}. - Newer results exist: see the latest version (${escapeHtml(newest)}).${ + if (current !== newest) { + note.innerHTML = `You are viewing ${escapeHtml(current.tag)}, published ${escapeHtml(date(current))}. + Newer results exist: see the latest version (${escapeHtml(newest.tag)}).${ tablesOnly ? " Per-piece plots for this version are in its release files." : ""}`; - note.hidden = false; } else { - const permanent = new URL(`v/${encodeURIComponent(shown)}/`, new URL(SITE_ROOT, location.href)).href; + const permanent = new URL(`versions/${current.tag}/`, new URL(SITE_ROOT, location.href)).href; note.innerHTML = `To cite these exact numbers, link this version: ${escapeHtml(permanent)}`; - note.hidden = false; note.style.borderLeftColor = "var(--accent)"; } + note.hidden = false; } showVersions(); diff --git a/docs/maintaining.md b/docs/maintaining.md index f93ac05..c82a88c 100644 --- a/docs/maintaining.md +++ b/docs/maintaining.md @@ -337,8 +337,8 @@ published. `evaluate.yml` runs from `submissions`, so fast-forward it to - `source_runs`: the completed run IDs, separated by spaces. Later listed runs replace earlier entries for the same method. Entries not listed are carried over from the latest release. - - `release_tag`: a new `benchmark-*` tag. Leave `source_runs` empty to - redeploy that release, or both empty to redeploy the latest one. + - `release_tag`: a new version `vMAJOR.MINOR.PATCH` (see "Older result + versions" below). Leave both empty to redeploy the latest release. The workflow attaches the selected artifacts and a `benchmark-snapshot.zip` for the site to the release, then deploys it. Actions artifacts @@ -494,20 +494,25 @@ Documentation changes redeploy the latest release. ### Older result versions -Every deployment also includes all published releases under their own path, -`v//` (for example -`https://pymatchmaker.github.io/matchmaker_benchmark/v/benchmark-v1/`), and the -page shows a **Results version** menu. The root always shows the latest release; -older versions show a note that newer results exist. Link a paper to its -`v//` address so readers see exactly the cited numbers. Each version is -shown with the current page code. +Result releases are numbered `vMAJOR.MINOR.PATCH`: + +- **major**: a new evaluation key, e.g. changed scoring, data or matchmaker version +- **minor**: new entries under the same key +- **patch**: a fix to already published entries + +Every deployment serves the latest release at the root and every release at +`versions//`, e.g. +`https://pymatchmaker.github.io/matchmaker_benchmark/versions/v1.0.0/`, with a +**Results version** menu on the page. Link a paper to its `versions//` +address so readers see exactly the numbers it cites. Each version is shown with +the current page code. Per-piece views take almost all of a version's space (about 25–30 MB, against -under 1 MB for its tables), and GitHub Pages allows 1 GB in total. So only the -newest versions and those listed in `data/full_versions.yaml` keep them; all -other versions show their tables, with the per-piece results in their release -files. **Add every version a paper cites to `keep`** in that file. A listed tag -that is not published yet only produces a warning in the publish run. +under 1 MB for its tables), and GitHub Pages allows 1 GB. So only the newest +releases (`NEWEST_FULL_VERSIONS`) and pinned ones (`PINNED_FULL_VERSIONS`, e.g. +the release a paper cites) keep them, both in `matchmaker_eval/build_site.py`. +Other versions show their tables, and their per-piece results stay in the +release files. ### What the site can show diff --git a/matchmaker_eval/build_site.py b/matchmaker_eval/build_site.py index e35075c..54b153e 100644 --- a/matchmaker_eval/build_site.py +++ b/matchmaker_eval/build_site.py @@ -2,20 +2,15 @@ python matchmaker_eval/build_site.py _site # what Pages publishes python matchmaker_eval/build_site.py --serve # ...and open it locally - python matchmaker_eval/build_site.py _site --versions DIR # plus v// + python matchmaker_eval/build_site.py _site --versions DIR # plus versions// The site is ``docs/`` plus what the page reads and links to: the leaderboard JSON and CSV, the same pair per dataset, and the per-entry detail files. Both the publish workflow and the staging preview call this, so what you look at before merging is assembled by the same code as what goes live. -With ``--versions``, every published result release found in DIR (as written -by ``release_results.py --versions-dir``) is also assembled under -``v//``, and ``versions.json`` lists them for the page's version menu. -``data/full_versions.yaml`` decides which versions keep their per-piece views -(the newest few and any cited version); the others show their tables only. -Each version uses the current page with that release's data, so a link such -as ``v/benchmark-v1/`` keeps showing the numbers a paper cites. +With ``--versions``, every published release is also assembled under +``versions//`` (see docs/maintaining.md, "Older result versions"). The page also reads ``../results/`` when it is served from a checkout, so ``--serve`` from the repository root works without assembling anything; the @@ -33,23 +28,22 @@ import argparse import json -import re import shutil from matchmaker_eval.folds import REPO_ROOT, RESULTS_DIR DOCS_DIR = REPO_ROOT / "docs" -FULL_VERSIONS = REPO_ROOT / "data" / "full_versions.yaml" + +#: Releases that keep their per-piece views under versions/: the newest few, +#: plus any pinned ones, such as the release our paper cites. +NEWEST_FULL_VERSIONS = 3 +PINNED_FULL_VERSIONS = ("v1.0.0",) class SiteError(Exception): """Raised when the site cannot be assembled.""" -#: A published result tag, as release_results.py creates them. -VERSION_TAG = re.compile(r"benchmark-[A-Za-z0-9][A-Za-z0-9._-]*") - - def build(destination: Path, results_dir: Path = None, details: bool = True) -> dict: """Copy docs/ and the result files into ``destination``. Returns a summary. @@ -100,53 +94,19 @@ def build(destination: Path, results_dir: Path = None, details: bool = True) -> return summary -def full_version_rule(path: Path = None) -> dict: - """Read data/full_versions.yaml: how many newest versions, and which tags, - keep their per-piece views on the site.""" - import yaml - - path = Path(path or FULL_VERSIONS) - config = (yaml.safe_load(path.read_text()) if path.is_file() else None) or {} - newest = config.get("newest", 3) - keep = config.get("keep") or [] - if not isinstance(newest, int) or newest < 1: - raise SiteError(f"{path}: 'newest' must be a positive whole number") - if not isinstance(keep, list) or not all(isinstance(t, str) for t in keep): - raise SiteError(f"{path}: 'keep' must be a list of release tags") - return {"newest": newest, "keep": keep} - - -def add_versions(destination: Path, versions_dir: Path, rule: dict = None) -> list: - """Assemble every downloaded release under ``destination/v//``. +def add_versions(destination: Path, versions_dir: Path) -> list: + """Assemble each release in ``versions_dir/versions.json`` under ``versions//``. - ``versions_dir/versions.json`` (newest first) decides what is listed; a - release whose snapshot is missing is left out rather than linked broken. - The newest versions and those kept by name (``full_version_rule``) are - assembled in full, the rest without per-piece views. Returns the listed - versions, also written to ``destination/versions.json``. + The newest ``NEWEST_FULL_VERSIONS`` and the ``PINNED_FULL_VERSIONS`` keep + their per-piece views; the others keep their tables only. The list is also written to ``versions.json``. """ destination, versions_dir = Path(destination), Path(versions_dir) - rule = rule or full_version_rule() - index = versions_dir / "versions.json" - if not index.is_file(): - raise SiteError(f"{index} is missing — run release_results.py --versions-dir first.") - listed = [] - for version in json.loads(index.read_text()).get("versions", []): - tag = version.get("tag", "") - if not VERSION_TAG.fullmatch(tag) or not (versions_dir / tag / "leaderboard.json").is_file(): - continue - full = len(listed) < rule["newest"] or tag in rule["keep"] - summary = build(destination / "v" / tag, versions_dir / tag, details=full) - if "release.json" in summary["missing"]: - raise SiteError(f"release {tag} has no release.json") - listed.append({**{key: version.get(key) for key in ("tag", "published_at", "url", "evaluation_keys")}, - "full": full}) - missing = [tag for tag in rule["keep"] if tag not in {v["tag"] for v in listed}] - for tag in missing: - # Expected until that version is published (e.g. the paper's release). - print(f"::warning::{tag} is kept in full by data/full_versions.yaml but is not published yet") - (destination / "versions.json").write_text( - json.dumps({"versions": listed}, indent=2) + "\n") + listed = json.loads((versions_dir / "versions.json").read_text())["versions"] + for index, version in enumerate(listed): + version["full"] = index < NEWEST_FULL_VERSIONS or version["tag"] in PINNED_FULL_VERSIONS + build(destination / "versions" / version["tag"], versions_dir / version["tag"], + details=version["full"]) + (destination / "versions.json").write_text(json.dumps({"versions": listed}, indent=2) + "\n") return listed @@ -191,7 +151,7 @@ def main(): type=Path, default=None, help="folder of downloaded releases (release_results.py --versions-dir); " - "each is added under v//", + "each is added under versions//", ) args = parser.parse_args() @@ -209,7 +169,7 @@ def main(): f"{summary['archives']} archived key(s)" ) if args.versions: - print(f" {len(versions)} published version(s) under v/: " + print(f" {len(versions)} published version(s) under versions/: " + (", ".join(v["tag"] + ("" if v["full"] else " (tables only)") for v in versions) or "none")) for name in summary["missing"]: diff --git a/matchmaker_eval/release_results.py b/matchmaker_eval/release_results.py index 4ecd6c3..5d45f98 100644 --- a/matchmaker_eval/release_results.py +++ b/matchmaker_eval/release_results.py @@ -20,6 +20,9 @@ SNAPSHOT = "benchmark-snapshot.zip" +#: Result release tags, vMAJOR.MINOR.PATCH (see docs/maintaining.md). +TAG = re.compile(r"v\d+\.\d+\.\d+") + def gh(*args): return subprocess.check_output(["gh", *args], text=True).strip() @@ -36,7 +39,7 @@ def releases(repo): def published(records): """Published result releases with a website snapshot, newest first.""" - candidates = [r for r in records if r["tag_name"].startswith("benchmark-") + candidates = [r for r in records if TAG.fullmatch(r["tag_name"]) and not r["draft"] and not r["prerelease"] and any(a["name"] == SNAPSHOT for a in r["assets"])] return sorted(candidates, key=lambda r: r["published_at"], reverse=True) @@ -86,6 +89,8 @@ def snapshot(results, output): def publish(repo, tag, run_ids, records, destination): + if not TAG.fullmatch(tag): + raise ValueError(f"Release tag must look like v1.0.0, not {tag!r}") runs = [api(f"repos/{repo}/actions/runs/{run}") for run in run_ids] if any(run["conclusion"] != "success" for run in runs): raise ValueError("Only successful runs can be published") @@ -157,8 +162,6 @@ def fetch_versions(repo, records, destination): versions = [] for release in published(records): tag = release["tag_name"] - if not re.fullmatch(r"benchmark-[A-Za-z0-9][A-Za-z0-9._-]*", tag): - continue fetch(repo, release, destination / tag) manifest = json.loads((destination / tag / "release.json").read_text()) versions.append({"tag": tag, "published_at": release["published_at"], @@ -181,10 +184,10 @@ def main(): if args.source_runs: tag = publish(args.repo, args.tag, args.source_runs.split(), records, RESULTS_DIR) else: + # Without new runs, redeploy the latest release; older ones stay at versions//. if args.tag: - release = next(r for r in records if r["tag_name"] == args.tag) - else: - release = latest(records) + parser.error("--tag needs --source-runs; an older release is served at versions//") + release = latest(records) tag = release["tag_name"] if release else "" if release: fetch(args.repo, release, RESULTS_DIR) diff --git a/tests/test_workflows.py b/tests/test_workflows.py index 12d09ea..41d20ef 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -149,92 +149,57 @@ def test_it_assembles_what_the_page_reads(self, tmp_path): assert (site / "leaderboard.json").exists() assert summary["details"] >= 0 + @staticmethod + def _downloaded_versions(root, tags): + """Release snapshots as release_results.py --versions-dir leaves them.""" + import json + + for tag in tags: + (root / tag / "details").mkdir(parents=True) + (root / tag / "details" / "m-midi.json").write_text("{}") + (root / tag / "leaderboard.json").write_text(json.dumps({"tag": tag})) + (root / tag / "release.json").write_text(json.dumps({"tag": tag})) + (root / "versions.json").write_text(json.dumps({"versions": [ + {"tag": tag, "published_at": "2026-12-01T00:00:00Z", "url": f"u/{tag}"} + for tag in tags]})) + def test_every_published_version_gets_its_own_path(self, tmp_path): """A cited release stays viewable after newer results are published.""" import json import build_site - versions = tmp_path / "versions" - for tag, generated in (("benchmark-v2", "new"), ("benchmark-v1", "old")): - (versions / tag / "details").mkdir(parents=True) - (versions / tag / "leaderboard.json").write_text(json.dumps({"generated": generated})) - (versions / tag / "release.json").write_text(json.dumps({"tag": tag})) - (versions / "benchmark-v0").mkdir() # listed, but its snapshot is missing - (versions / "versions.json").write_text(json.dumps({"versions": [ - {"tag": "benchmark-v2", "published_at": "2026-12-01T00:00:00Z", "url": "u2"}, - {"tag": "benchmark-v1", "published_at": "2026-11-20T00:00:00Z", "url": "u1"}, - {"tag": "benchmark-v0"}, - {"tag": "../escape"}, - ]})) + self._downloaded_versions(tmp_path / "versions", ["v1.1.0", "v1.0.0"]) site = tmp_path / "site" build_site.build(site) - listed = build_site.add_versions(site, versions, {"newest": 3, "keep": []}) + listed = build_site.add_versions(site, tmp_path / "versions") - assert [v["tag"] for v in listed] == ["benchmark-v2", "benchmark-v1"] - assert all(v["full"] for v in listed) + assert [v["tag"] for v in listed] == ["v1.1.0", "v1.0.0"] assert json.loads((site / "versions.json").read_text())["versions"] == listed - for tag, generated in (("benchmark-v2", "new"), ("benchmark-v1", "old")): - assert (site / "v" / tag / "index.html").exists() - assert json.loads((site / "v" / tag / "leaderboard.json").read_text()) == {"generated": generated} - assert not (site / "v" / "benchmark-v0").exists() - # The root site is left as built from the current results. - assert (site / "leaderboard.json").exists() - - def test_only_the_newest_and_kept_versions_keep_per_piece_views(self, tmp_path, capsys): - """Older versions shrink to their tables, so the site stays under the - Pages size limit, while a version a paper cites is never trimmed.""" - import json + for tag in ("v1.1.0", "v1.0.0"): + assert (site / "versions" / tag / "index.html").exists() + assert json.loads((site / "versions" / tag / "leaderboard.json").read_text()) == {"tag": tag} + assert (site / "leaderboard.json").exists() # the root keeps the current results + + def test_only_the_newest_and_pinned_versions_keep_per_piece_views(self, tmp_path, monkeypatch): + """Older versions shrink to their tables, keeping the site under the Pages + limit, while a pinned version (e.g. the one a paper cites) stays complete.""" import build_site - versions = tmp_path / "versions" - tags = [f"benchmark-v{n}" for n in (5, 4, 3, 2, 1)] # newest first - for tag in tags: - (versions / tag / "details").mkdir(parents=True) - (versions / tag / "details" / "m-midi.json").write_text("{}") - (versions / tag / "leaderboard.json").write_text("{}") - (versions / tag / "release.json").write_text(json.dumps({"tag": tag})) - (versions / "versions.json").write_text(json.dumps( - {"versions": [{"tag": tag} for tag in tags]})) + monkeypatch.setattr(build_site, "NEWEST_FULL_VERSIONS", 2) + monkeypatch.setattr(build_site, "PINNED_FULL_VERSIONS", ("v1.0.0",)) + tags = ["v3.0.0", "v2.1.0", "v2.0.0", "v1.0.0"] # newest first + self._downloaded_versions(tmp_path / "versions", tags) site = tmp_path / "site" build_site.build(site) - rule = {"newest": 2, "keep": ["benchmark-v1", "benchmark-v9"]} - listed = build_site.add_versions(site, versions, rule) - - full = {v["tag"]: v["full"] for v in listed} - assert full == {"benchmark-v5": True, "benchmark-v4": True, "benchmark-v3": False, - "benchmark-v2": False, "benchmark-v1": True} - for tag, kept in full.items(): - assert (site / "v" / tag / "details" / "m-midi.json").exists() is kept - assert (site / "v" / tag / "leaderboard.json").exists() - # A kept tag that is not published yet is a reminder, not an error. - assert "benchmark-v9 is kept in full" in capsys.readouterr().out - - def test_the_committed_full_version_rule_is_valid(self): - import build_site + listed = build_site.add_versions(site, tmp_path / "versions") - rule = build_site.full_version_rule() - assert rule["newest"] >= 1 - assert all(build_site.VERSION_TAG.fullmatch(tag) for tag in rule["keep"]) + assert [v["full"] for v in listed] == [True, True, False, True] + for version in listed: + folder = site / "versions" / version["tag"] + assert (folder / "details" / "m-midi.json").exists() is version["full"] + assert (folder / "leaderboard.json").exists() - def test_a_malformed_full_version_rule_is_refused(self, tmp_path): - import build_site - - path = tmp_path / "full_versions.yaml" - path.write_text("newest: 0\n") - with pytest.raises(build_site.SiteError, match="newest"): - build_site.full_version_rule(path) - path.write_text("keep: benchmark-v1\n") - with pytest.raises(build_site.SiteError, match="keep"): - build_site.full_version_rule(path) - - def test_versions_need_the_downloaded_index(self, tmp_path): - import build_site - - build_site.build(tmp_path / "site") - with pytest.raises(build_site.SiteError, match="versions.json is missing"): - build_site.add_versions(tmp_path / "site", tmp_path / "nothing") - - def test_release_versions_are_downloaded_newest_first(self, tmp_path, monkeypatch): + def test_release_versions_are_filtered_and_newest_first(self, tmp_path, monkeypatch): import json from matchmaker_eval import release_results as R @@ -244,36 +209,26 @@ def release(tag, published, draft=False, snapshot=True): "assets": [{"name": R.SNAPSHOT}] if snapshot else []} records = [ - release("benchmark-v1", "2026-11-20T00:00:00Z"), - release("benchmark-v2", "2026-12-01T00:00:00Z"), - release("benchmark-v3", "2026-12-05T00:00:00Z", draft=True), - release("benchmark-v4", "2026-12-06T00:00:00Z", snapshot=False), - release("v0.4.0", "2026-10-27T00:00:00Z"), + release("v1.0.0", "2026-11-20T00:00:00Z"), + release("v1.1.0", "2026-12-01T00:00:00Z"), + release("v1.2.0", "2026-12-05T00:00:00Z", draft=True), + release("v1.3.0", "2026-12-06T00:00:00Z", snapshot=False), + release("benchmark-v9", "2026-12-07T00:00:00Z"), ] fetched = [] def fake_fetch(repo, rel, destination): fetched.append(rel["tag_name"]) destination.mkdir(parents=True) - (destination / "release.json").write_text(json.dumps( - {"evaluation_keys": {"midi": "ek2-" + rel["tag_name"][-2:]}})) + (destination / "release.json").write_text(json.dumps({"evaluation_keys": {}})) monkeypatch.setattr(R, "fetch", fake_fetch) versions = R.fetch_versions("owner/repo", records, tmp_path / "versions") - assert fetched == ["benchmark-v2", "benchmark-v1"] - assert [v["tag"] for v in versions] == ["benchmark-v2", "benchmark-v1"] - assert versions[0]["url"] == "https://example/benchmark-v2" - assert versions[0]["evaluation_keys"] == {"midi": "ek2-v2"} - on_disk = json.loads((tmp_path / "versions" / "versions.json").read_text()) - assert on_disk["versions"] == versions - assert R.latest(records)["tag_name"] == "benchmark-v2" - - def test_the_publish_workflow_builds_the_version_paths(self): - pages = (WORKFLOWS / "pages.yml").read_text() - assert '--versions-dir "$RUNNER_TEMP/benchmark-versions"' in pages - assert 'build_site.py _site --versions "$RUNNER_TEMP/benchmark-versions"' in pages - assert "data/full_versions.yaml" in pages # editing the rule redeploys + assert fetched == ["v1.1.0", "v1.0.0"] + assert [v["tag"] for v in versions] == ["v1.1.0", "v1.0.0"] + assert versions[0]["url"] == "https://example/v1.1.0" + assert R.latest(records)["tag_name"] == "v1.1.0" def test_it_refuses_to_build_without_a_leaderboard(self, tmp_path, monkeypatch): import build_site @@ -544,4 +499,4 @@ def test_unfinished_or_failed_run_is_not_published(self, tmp_path, monkeypatch, from matchmaker_eval import release_results monkeypatch.setattr(release_results, "api", lambda path: {"status": status, "conclusion": conclusion}) with pytest.raises(ValueError, match="successful runs"): - release_results.publish("test/repo", "benchmark-test", ["1"], [], tmp_path) + release_results.publish("test/repo", "v1.0.0", ["1"], [], tmp_path)