From d132012ebeeb755511171ba6bf894c9128af954b Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:12:32 +0200 Subject: [PATCH 1/3] fix(efficacy): score every build on the spec's Python 3.12 The scorer made each trial's environment from its own interpreter, which was Python 3.14.8 for round 5c. Three builds that capped `requires-python` below 3.13, as the spec's "Python 3.12" invites, were refused at install and scored zero on every row after it. Every environment is now made on Python 3.12, found as the scorer itself, as `py -3.12` or as `python3.12`; without one the scorer refuses to score. Each score records the version it installed on. Closes #100 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xQeiWaKvHqQNHTU1uJ --- docs/architecture/02-constraints.md | 2 +- docs/architecture/07-deployment-view.md | 2 +- docs/rounds/round-5d.md | 3 + tests/efficacy/score.py | 98 ++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 5 deletions(-) diff --git a/docs/architecture/02-constraints.md b/docs/architecture/02-constraints.md index 882f430..169e464 100644 --- a/docs/architecture/02-constraints.md +++ b/docs/architecture/02-constraints.md @@ -14,7 +14,7 @@ setting, not a choice the benchmark made. Chapter 9 records the choices. | 5 | A deny rule matches a command's prefix, not the paths inside it | The file tools can be fenced, the shell cannot | | 6 | The builder and the judge bill against subscriptions | A round's budget is quota, not invoice. The judge's weekly plan limit sets how fast a round is judged | | 7 | This repository is public | The hidden suite and the raw runs live in private repositories, `braboj/tariff-hidden-suite` and `braboj/tariff-runs` | -| 8 | Scoring runs Python 3.12 | Every trial's environment is made by the scorer's own interpreter, so a round is scored under one version | +| 8 | Scoring runs Python 3.12 | Every trial's environment is made on Python 3.12, the spec's version, whatever the scorer runs under; without it the scorer refuses to score | | 9 | A round needs about 0.5 GB free per trial: about 40 GB for round 5's 75 | Each scored trial's environment is about 290 MB | | 10 | GitHub refuses a file over 50 MB on push | The archive refuses one too | diff --git a/docs/architecture/07-deployment-view.md b/docs/architecture/07-deployment-view.md index ac4ea43..7fd58f6 100644 --- a/docs/architecture/07-deployment-view.md +++ b/docs/architecture/07-deployment-view.md @@ -12,7 +12,7 @@ with its protocol. | Node or store | What it is | Needed for | Without it | | ------------- | ---------- | ---------- | ---------- | -| Python 3.12 | The interpreter the scripts run under, as `py -3.12` | Every scored trial's environment | Trials scored under another interpreter are measured with another ruler | +| Python 3.12 | Found as `py -3.12` or `python3.12` | Every scored trial's environment | The scorer refuses to score | | Claude Code CLI | `claude` on `PATH`, logged in | Every trial and every generation | The preflight refuses the run | | Codex CLI | `codex` on `PATH`, logged in | The rounds' judge, from round 5 | Each judging fails | | `gh` | Logged in with access to the hidden suite | Scoring clones the suite | Scoring refuses | diff --git a/docs/rounds/round-5d.md b/docs/rounds/round-5d.md index 67abd83..9c44e78 100644 --- a/docs/rounds/round-5d.md +++ b/docs/rounds/round-5d.md @@ -144,6 +144,9 @@ Done with this registration: trial, and every trial records the CLI's version; round 5d runs `C:/efficacy/cli/claude-2.1.314.exe`, a copy of 2.1.314 kept where the launcher's updater does not prune it +- scoring makes every environment on Python 3.12, the spec's version, and + records it on every score. Round 5c was scored on Python 3.14.8, which + refused three builds that capped `requires-python` below 3.13 The report still gains, with a self-test: diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index 2b556db..3c3d0c0 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -31,6 +31,7 @@ import sys import tarfile import tempfile +import zipfile sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -56,6 +57,17 @@ # The package every arm is asked to produce, fixed by the specification. PACKAGE = "tariff" +# The Python the specification names. A build may cap `requires-python` at +# it, as the spec's wording invites, so every environment scoring makes runs +# this version: on a newer scorer's Python such a build is refused at install +# and scores zero on every row after it. +SPEC_PYTHON = (3, 12) + +# Where an interpreter at the spec's version is looked for when the scorer +# runs on another: the Windows launcher, then a versioned name on the path. +SPEC_PYTHON_COMMANDS = (["py", "-%d.%d" % SPEC_PYTHON], + ["python%d.%d" % SPEC_PYTHON]) + # The specification seeds an empty database when the application starts, and # seeding refuses without an administrator password. Every command scoring # runs is given one, so the boot check and the probes reach the application. @@ -228,11 +240,52 @@ def extract(tarball, into, name): return target +# Each lookup's answer, so a run of many trials asks the launcher once. +FOUND_INTERPRETERS = {} + + +def spec_interpreter(commands=SPEC_PYTHON_COMMANDS): + """The path of a Python at the spec's version; a ScoreError if none is + found, since scoring on another version would grade the interpreter.""" + if commands is SPEC_PYTHON_COMMANDS and sys.version_info[:2] == SPEC_PYTHON: + return sys.executable + key = tuple(tuple(command) for command in commands) + if key not in FOUND_INTERPRETERS: + FOUND_INTERPRETERS[key] = find_interpreter(commands) + if FOUND_INTERPRETERS[key] is None: + tried = ", ".join(" ".join(command) for command in commands) + raise ScoreError("no Python %d.%d was found, and scoring runs on the " + "spec's Python only; tried: %s" + % (SPEC_PYTHON[0], SPEC_PYTHON[1], tried)) + return FOUND_INTERPRETERS[key] + + +def find_interpreter(commands): + """The first command's interpreter that runs the spec's version, or None.""" + probe = "import sys; print(sys.executable); print(*sys.version_info[:2])" + wanted = ["%d" % part for part in SPEC_PYTHON] + for command in commands: + outcome = run(list(command) + ["-c", probe], timeout=120) + lines = outcome["stdout"].splitlines() + if (outcome["failed"] is None and outcome["status"] == 0 + and len(lines) == 2 and lines[1].split() == wanted): + return lines[0].strip() + return None + + +def venv_version(venv): + """The Python version a virtual environment runs, as `3.12.10`, or None.""" + outcome = run([python_in(venv), "-c", + "import platform; print(platform.python_version())"], + timeout=120) + return outcome["stdout"].strip() or None + + def create_venv(where): - """A clean virtual environment for one trial.""" + """A clean virtual environment on the spec's Python.""" if os.path.exists(where): remove_tree(where) - outcome = run([sys.executable, "-m", "venv", where], timeout=600) + outcome = run([spec_interpreter(), "-m", "venv", where], timeout=600) if outcome["failed"] or outcome["status"] != 0: raise ScoreError("could not create the virtual environment at %s: %s" % (where, outcome["stderr"][:400])) @@ -1108,6 +1161,7 @@ def score_trial(record, options, suite, lock): "workspace": workspace, "templates_tree": record.get( "templates_tree"), "model": record.get("model"), "suite_revision": suite["revision"], + "python": venv_version(venv), "scored_at": datetime.datetime.now().isoformat( timespec="seconds"), "python_files": files} @@ -1247,6 +1301,7 @@ def score_change_trial(record, options, suite): "task": "change", "workspace": workspace, "base": record.get("base"), "model": record.get("model"), "suite_revision": suite["revision"], + "python": venv_version(venv), "scored_at": datetime.datetime.now().isoformat( timespec="seconds")} scores["install"] = install_trial(venv, workspace) @@ -1736,6 +1791,43 @@ def python_files_checks(scratch): ] +def interpreter_checks(scratch, venv): + """Every environment runs the spec's Python, so a build capped at it + installs, and a scorer that cannot find that Python refuses to score.""" + + # A wheel carries its `Requires-Python` in its metadata, so pip refuses + # or accepts it with no build backend and no network, the way it refused + # round 5c's three builds capped below 3.13 on Python 3.14. + capped = "%d.%d" % (SPEC_PYTHON[0], SPEC_PYTHON[1] + 1) + wheel = os.path.join(scratch, "capped_pkg-0.1-py3-none-any.whl") + info = "capped_pkg-0.1.dist-info" + with zipfile.ZipFile(wheel, "w") as archive: + archive.writestr("capped_pkg/__init__.py", "") + archive.writestr(info + "/METADATA", + "Metadata-Version: 2.1\nName: capped-pkg\n" + "Version: 0.1\nRequires-Python: >=%d.%d,<%s\n" + % (SPEC_PYTHON[0], SPEC_PYTHON[1], capped)) + archive.writestr(info + "/WHEEL", + "Wheel-Version: 1.0\nGenerator: self-test\n" + "Root-Is-Purelib: true\nTag: py3-none-any\n") + archive.writestr(info + "/RECORD", "") + installed = pip(venv, "install", "--no-index", "--no-deps", wheel, + timeout=300) + try: + spec_interpreter([["no-such-python-launcher"]]) + refused = False + except ScoreError: + refused = True + return [ + ("a scoring environment runs the spec's Python", + (venv_version(venv) or "").split(".")[:2] + == ["%d" % part for part in SPEC_PYTHON]), + ("a build capped below Python %s installs" % capped, + installed["failed"] is None and installed["status"] == 0), + ("no Python at the spec's version refuses to score", refused), + ] + + def self_test(): """Prove the missing-vs-zero rule fires before any score is believed. @@ -1762,7 +1854,7 @@ def self_test(): + coverage_checks(scratch) + python_files_checks(scratch) + scope_checks(scratch)) venv = create_venv(os.path.join(scratch, "venv")) - checks += boot_checks(scratch, venv) + checks += boot_checks(scratch, venv) + interpreter_checks(scratch, venv) empty = os.path.join(scratch, "empty") os.makedirs(empty) From f64a485b708701495501cb606c829d068f65f033 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:20:32 +0200 Subject: [PATCH 2/3] fix(efficacy): refuse scores from two Pythons, and find python3.12 on Windows A root holding scores installed on another Python, or on an unrecorded one, is refused by the scorer, and a round whose scores span two Pythons by the report. Round 5c's `none` is re-scored on 3.12 before round 5d reads it. The fallback `python3.12` is resolved on the path before it is launched: Windows reads `.12` as an extension and adds no `.exe`. Refs #100 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xQeiWaKvHqQNHTU1uJ --- docs/rounds/round-5d.md | 3 ++ tests/efficacy/report.py | 48 ++++++++++++++++++++++ tests/efficacy/score.py | 86 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/docs/rounds/round-5d.md b/docs/rounds/round-5d.md index 9c44e78..2148ef4 100644 --- a/docs/rounds/round-5d.md +++ b/docs/rounds/round-5d.md @@ -147,6 +147,9 @@ Done with this registration: - scoring makes every environment on Python 3.12, the spec's version, and records it on every score. Round 5c was scored on Python 3.14.8, which refused three builds that capped `requires-python` below 3.13 +- the scorer refuses a root holding scores on another Python, and the report + a round whose scores were installed on more than one, so round 5c's + `none` is re-scored on Python 3.12 before round 5d reads it The report still gains, with a self-test: diff --git a/tests/efficacy/report.py b/tests/efficacy/report.py index 0760991..4bcda81 100644 --- a/tests/efficacy/report.py +++ b/tests/efficacy/report.py @@ -1144,6 +1144,27 @@ def prompt_problem(root): return None +def python_problem(trials): + """Why the trials' scores were not all installed on one Python, or None. + + A score from before the scorer recorded its Python reads as unrecorded, + so a round's old scores beside new ones are refused too.""" + found = {} + for name, trial in trials.items(): + for part in ("scores", "change"): + scores = trial.get(part) + if scores is None: + continue + version = scores.get("python") + minor = ".".join(version.split(".")[:2]) if version else "unrecorded" + found.setdefault(minor, name) + if len(found) < 2: + return None + return ("the trials were installed on more than one Python: %s" + % ", ".join("%s (%s, for one)" % (minor, name) + for minor, name in sorted(found.items()))) + + def registration_problem(root, registration, repository=REPOSITORY): """Why the round's registration does not predate its first trial, or None when it landed on the main branch before that trial and is @@ -3521,6 +3542,25 @@ def trial(prompt=PROMPT, outcome="completed", task="build"): return checks +def python_checks(): + """A round is refused when its scores were installed on more than one + Python, an unrecorded one included.""" + def trials(*versions): + return {"none-%d" % (index + 1): { + "scores": {} if version is None else {"python": version}, + "change": None} for index, version in enumerate(versions)} + return [ + ("scores on one Python are read", + python_problem(trials("3.12.10", "3.12.15")) is None), + ("scores all unrecorded, as an old round's are, are read", + python_problem(trials(None, None)) is None), + ("scores on two Pythons are refused", + "3.14" in (python_problem(trials("3.12.10", "3.14.8")) or "")), + ("an unrecorded score beside a recorded one is refused", + "unrecorded" in (python_problem(trials("3.12.10", None)) or "")), + ] + + def registration_checks(): """A round is refused when its registration landed on the main branch after its first trial, has not landed, is changed and not committed, or @@ -4541,6 +4581,7 @@ def self_test(seed): checks.extend((label, ok, ok) for label, ok in registration_checks()) checks.extend((label, ok, ok) for label, ok in spec_checks()) checks.extend((label, ok, ok) for label, ok in prompt_checks()) + checks.extend((label, ok, ok) for label, ok in python_checks()) for label, ok, got in checks: print(" %-52s %s" % (label, "ok" if ok else "FAILED, got %r" % (got,))) @@ -4620,6 +4661,13 @@ def main(argv): print("refused: %s" % problem) return 2 + # Scores installed on two Pythons would read the interpreter as an arm's + # effect, so a round's scores have to share one. + problem = python_problem(trials) + if problem: + print("refused: %s" % problem) + return 2 + # A trial that read past its workspace measures what it read, not its # arm; the harness voids one its own scan catches, and this re-scan, under # the current rule, leaves out any it missed. diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index 3c3d0c0..664ce55 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -27,6 +27,7 @@ import os import re import secrets +import shutil import subprocess import sys import tarfile @@ -265,7 +266,14 @@ def find_interpreter(commands): probe = "import sys; print(sys.executable); print(*sys.version_info[:2])" wanted = ["%d" % part for part in SPEC_PYTHON] for command in commands: - outcome = run(list(command) + ["-c", probe], timeout=120) + + # Windows reads the `.12` of `python3.12` as an extension and adds no + # `.exe`, so the name is resolved on the path before it is launched. + program = shutil.which(command[0]) + if program is None: + continue + outcome = run([program] + list(command[1:]) + ["-c", probe], + timeout=120) lines = outcome["stdout"].splitlines() if (outcome["failed"] is None and outcome["status"] == 0 and len(lines) == 2 and lines[1].split() == wanted): @@ -1818,7 +1826,52 @@ def interpreter_checks(scratch, venv): refused = False except ScoreError: refused = True + + # A dotted name on the path, as `python3.12` is: a wrapper that hands its + # arguments to the spec's interpreter. + bin_dir = os.path.join(scratch, "dotted-bin") + os.makedirs(bin_dir) + real = spec_interpreter() + if os.name == "nt": + wrapper = os.path.join(bin_dir, "spec%d.%d.cmd" % SPEC_PYTHON) + text = '@"%s" %%*\r\n' % real + else: + wrapper = os.path.join(bin_dir, "spec%d.%d" % SPEC_PYTHON) + text = '#!/bin/sh\nexec "%s" "$@"\n' % real + with io.open(wrapper, "w", encoding="utf-8", newline="") as handle: + handle.write(text) + os.chmod(wrapper, 0o755) + path = os.environ.get("PATH", "") + os.environ["PATH"] = bin_dir + os.pathsep + path + try: + dotted = find_interpreter([["spec%d.%d" % SPEC_PYTHON]]) + finally: + os.environ["PATH"] = path + + # Scores kept in a root: each one on the spec's Python, one on another, + # and one from before the scorer recorded its Python. + wanted = "%d.%d.0" % SPEC_PYTHON + targets = {} + for label, versions in (("same", [wanted, wanted]), + ("other", [wanted, "3.14.8"]), + ("unrecorded", [wanted, None])): + target = os.path.join(scratch, "pythons", label) + os.makedirs(target) + for index, version in enumerate(versions): + with io.open(os.path.join(target, "none-%d.json" % (index + 1)), + "w", encoding="utf-8") as handle: + json.dump({} if version is None else {"python": version}, + handle) + targets[label] = python_problem(target) return [ + ("a dotted interpreter name on the path is found", + dotted is not None), + ("scores all on the spec's Python stand beside new ones", + targets["same"] is None), + ("a score on another Python refuses the root", + "3.14" in (targets["other"] or "")), + ("a score with no Python recorded refuses the root", + "unrecorded" in (targets["unrecorded"] or "")), ("a scoring environment runs the spec's Python", (venv_version(venv) or "").split(".")[:2] == ["%d" % part for part in SPEC_PYTHON]), @@ -1922,6 +1975,29 @@ def graded_revisions(target): return revisions +def python_of(scores): + """A score's Python as `3.12`, or "unrecorded" for one scored before the + scorer recorded it.""" + version = scores.get("python") + return ".".join(version.split(".")[:2]) if version else "unrecorded" + + +def python_problem(target): + """Why the scores already in `target` cannot stand beside new ones, or + None: each was installed on the spec's Python.""" + wanted = "%d.%d" % SPEC_PYTHON + others = set() + for file in glob.glob(os.path.join(target, "*.json")): + with io.open(file, encoding="utf-8") as handle: + others.add(python_of(json.load(handle))) + others.discard(wanted) + if not others: + return None + return ("%s holds scores installed on Python %s, and scoring runs on %s; " + "a run on another Python is another root" + % (target, ", ".join(sorted(others)), wanted)) + + def parse_args(argv): parser = argparse.ArgumentParser( description="Score frozen efficacy-benchmark trials.") @@ -2025,6 +2101,14 @@ def score_trials(options): lib.print_verdict(False, "0 scored, 1 refused") return 1 + # The same holds for the interpreter: a score kept from another Python + # beside new ones would compare the two Pythons, not the arms. + problem = python_problem(target) + if problem: + print("refused: %s" % problem) + lib.print_verdict(False, "0 scored, 1 refused") + return 1 + scored, skipped, refused = [], [], 0 for name in sorted(wanted - set(offered)): print("%s refused: no run record offers it for scoring" % name) From 6f522225855a3a56a3448a509e84951273369bc7 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:24:41 +0200 Subject: [PATCH 3/3] fix(efficacy): check both tasks' scores for another Python The scorer read only the scores of the task it was about to score, so a change task could be scored beside build scores on another Python, which the report then refuses. It now reads both before it scores either. Refs #100 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xQeiWaKvHqQNHTU1uJ --- tests/efficacy/score.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index 664ce55..f42f1ea 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -1854,15 +1854,19 @@ def interpreter_checks(scratch, venv): targets = {} for label, versions in (("same", [wanted, wanted]), ("other", [wanted, "3.14.8"]), - ("unrecorded", [wanted, None])): - target = os.path.join(scratch, "pythons", label) - os.makedirs(target) + ("unrecorded", [wanted, None]), + ("change", [wanted, wanted, "3.14.8"])): + area = os.path.join(scratch, "pythons", label) + + # The third score, where there is one, is a change task's. for index, version in enumerate(versions): - with io.open(os.path.join(target, "none-%d.json" % (index + 1)), + task = "scores-change" if index == 2 else "scores" + os.makedirs(os.path.join(area, task), exist_ok=True) + with io.open(os.path.join(area, task, "none-%d.json" % (index % 2 + 1)), "w", encoding="utf-8") as handle: json.dump({} if version is None else {"python": version}, handle) - targets[label] = python_problem(target) + targets[label] = python_problem(area) return [ ("a dotted interpreter name on the path is found", dotted is not None), @@ -1872,6 +1876,8 @@ def interpreter_checks(scratch, venv): "3.14" in (targets["other"] or "")), ("a score with no Python recorded refuses the root", "unrecorded" in (targets["unrecorded"] or "")), + ("a change task's score on another Python refuses the root", + "3.14" in (targets["change"] or "")), ("a scoring environment runs the spec's Python", (venv_version(venv) or "").split(".")[:2] == ["%d" % part for part in SPEC_PYTHON]), @@ -1982,20 +1988,24 @@ def python_of(scores): return ".".join(version.split(".")[:2]) if version else "unrecorded" -def python_problem(target): - """Why the scores already in `target` cannot stand beside new ones, or - None: each was installed on the spec's Python.""" +def python_problem(area): + """Why the scores already in a scoring area cannot stand beside new ones, + or None: each, of either task, was installed on the spec's Python.""" wanted = "%d.%d" % SPEC_PYTHON others = set() - for file in glob.glob(os.path.join(target, "*.json")): - with io.open(file, encoding="utf-8") as handle: - others.add(python_of(json.load(handle))) + + # Both tasks' scores, since the report reads a build's beside its change + # task's and refuses the pair on two Pythons. + for task in ("scores", "scores-change"): + for file in glob.glob(os.path.join(area, task, "*.json")): + with io.open(file, encoding="utf-8") as handle: + others.add(python_of(json.load(handle))) others.discard(wanted) if not others: return None return ("%s holds scores installed on Python %s, and scoring runs on %s; " "a run on another Python is another root" - % (target, ", ".join(sorted(others)), wanted)) + % (area, ", ".join(sorted(others)), wanted)) def parse_args(argv): @@ -2103,7 +2113,7 @@ def score_trials(options): # The same holds for the interpreter: a score kept from another Python # beside new ones would compare the two Pythons, not the arms. - problem = python_problem(target) + problem = python_problem(area) if problem: print("refused: %s" % problem) lib.print_verdict(False, "0 scored, 1 refused")