From ef6a146a83e9b41b31876bc3e5ad8ab5bbf6e10e Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sun, 1 Nov 2026 13:43:42 +0200 Subject: [PATCH 1/2] chore(efficacy): drop scoring environments once read, and trees once archived Round 5c's scoring area held 26.5 GB, 21.8 GB of it per-trial environments nothing reads after scoring. The scorer and the security reading now delete each environment once its scores are read, and archive.py deletes the extracted trees once a round is archived and verified. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xQeiWaKvHqQNHTU1uJ --- docs/architecture/02-constraints.md | 2 +- docs/architecture/05-building-block-view.md | 4 +-- docs/architecture/07-deployment-view.md | 10 ++++-- tests/efficacy/archive.py | 38 +++++++++++++++++++++ tests/efficacy/score.py | 14 ++++++++ tests/efficacy/security.py | 30 +++++++++++++++- 6 files changed, 92 insertions(+), 6 deletions(-) diff --git a/docs/architecture/02-constraints.md b/docs/architecture/02-constraints.md index 169e464..3e39bb2 100644 --- a/docs/architecture/02-constraints.md +++ b/docs/architecture/02-constraints.md @@ -15,7 +15,7 @@ setting, not a choice the benchmark made. Chapter 9 records the choices. | 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 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 | +| 9 | A round's scoring area needs about 60 MB per trial, plus 0.5 GB for the trial being scored: about 5 GB for round 5's 75 | Each trial's environment, about 290 MB, is dropped once its scores are read; its tree stays until the round is archived | | 10 | GitHub refuses a file over 50 MB on push | The archive refuses one too | ## 2.2 Organisational constraints diff --git a/docs/architecture/05-building-block-view.md b/docs/architecture/05-building-block-view.md index 65d4393..a64417e 100644 --- a/docs/architecture/05-building-block-view.md +++ b/docs/architecture/05-building-block-view.md @@ -68,10 +68,10 @@ are still read. | Path | Holds | | ---- | ----- | | The hidden suite's clone | At the one revision the root is graded under | -| `scoring//tree/`, `venv/` | Each trial's extracted tree and clean environment | +| `scoring//tree/` | Each trial's extracted tree, until the round is archived; its clean environment goes once it is scored | | `tool-lock.txt` | The tool versions every trial is measured with | | `scores/`, `scores-change/` | One score per build trial and per change task | -| `security/`, `security-scores/` | Each trial's probe environment, and its readings | +| `security/`, `security-scores/` | Each trial's probe files, and its readings; the probe environment goes once it is read | | `judge/` | Each blind bundle, its judgings and the unblinding map | | `archived.json` | The stamp a verified archive writes, with the hash of every file the report reads | | `.running` | A claim that one run of that tool is working here | diff --git a/docs/architecture/07-deployment-view.md b/docs/architecture/07-deployment-view.md index 7fd58f6..b0bd423 100644 --- a/docs/architecture/07-deployment-view.md +++ b/docs/architecture/07-deployment-view.md @@ -44,8 +44,14 @@ Round 3's root held 5.5 GB after both tasks. Each scored trial's environment is about 290 MB. -Round 5's 75 build trials want about 40 GB free on the root's drive; a -K = 3 round of five arms and both tasks wanted about 15 GB. A full disk stops + +Round 5c's run root held 11.4 GB, and its scoring area 26.5 GB: 21.8 GB of +environments, 4.3 GB of extracted trees. + + +Scoring drops each trial's environment once its scores are read, and the +archive drops the trees, so round 5's 75 build trials want about 17 GB free on +the root's drive: the root and about 5 GB beside it. A full disk stops a trial or a scoring with `No space left on device`, and that trial is not a result. diff --git a/tests/efficacy/archive.py b/tests/efficacy/archive.py index bf01a88..20dc4da 100644 --- a/tests/efficacy/archive.py +++ b/tests/efficacy/archive.py @@ -328,6 +328,24 @@ def stamp(root, into): "readings": readings_digest(root)}) +def drop_trees(root): + """Delete the scoring area's extracted trees and any environment left + beside them; return how many folders went.""" + + # The judge and the security reading read a trial's tree, and both are + # done once the round is archived: a later reading would change what the + # stamp holds, and a re-score extracts the tree again from its tarball. + area = scoring_area(root) + folders = [] + for part in ("scoring", "scoring-change"): + for kind in ("tree", "venv"): + folders += glob.glob(os.path.join(area, part, "*", kind)) + folders += glob.glob(os.path.join(area, "security", "*", "venv")) + for folder in folders: + remove_tree(folder) + return len(folders) + + def plant_tarball(path, name, extra=()): """A frozen workspace holding code, a venv, caches and a git dir.""" entries = {"src/pkg/__init__.py": b"VALUE = 1\n", @@ -498,6 +516,24 @@ def self_test(): stamp_problem(root) is not None)) stamp(root, into) checks.append(("a stamped round has none", stamp_problem(root) is None)) + + # What scoring leaves: a trial's tree and environment, a change task's, + # and a security reading's environment. + area = scoring_area(root) + leftovers = [os.path.join(area, "scoring", "none-1", "tree"), + os.path.join(area, "scoring", "none-1", "venv"), + os.path.join(area, "scoring-change", "none-1", "tree"), + os.path.join(area, "security", "full-1", "venv")] + for folder in leftovers: + os.makedirs(folder, exist_ok=True) + with io.open(os.path.join(folder, "left.txt"), "w") as handle: + handle.write("x") + dropped = drop_trees(root) + checks.append(("an archived round drops its trees and environments", + dropped == len(leftovers) + and not any(os.path.exists(folder) for folder in leftovers))) + checks.append(("its readings stand, so the stamp still holds", + stamp_problem(root) is None)) score = os.path.join(scoring_area(root), "scores", "none-1.json") dump_json(score, dict(load_json(score), planted=True)) checks.append(("a reading changed after the stamp is a problem", @@ -598,6 +634,8 @@ def main(argv): lib.print_verdict(False, "archive not verified; no stamp written") return 1 stamp(options.root, source) + print("Dropped %d tree and environment folder(s) from the scoring area" + % drop_trees(options.root)) lib.print_verdict(True, "archive verified; %s stamped" % os.path.join(scoring_area(options.root), STAMP)) return 0 diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index f42f1ea..b7506f3 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -300,6 +300,14 @@ def create_venv(where): return where +def drop_venv(venv): + """Delete a trial's environment once its scores are read off it.""" + + # About 290 MB a trial, and nothing reads it again: a later reading + # makes its own from the trial's tree and the run's lock. + remove_tree(venv) + + def pip(venv, *args, **kwargs): """Run pip inside a trial's environment.""" timeout = kwargs.pop("timeout", 1800) @@ -1246,6 +1254,7 @@ def score_trial(record, options, suite, lock): scores["cost"] = cost(record) scores["flagged"] = metric_flags(scores) + drop_venv(venv) return scores @@ -1332,6 +1341,7 @@ def score_change_trial(record, options, suite): "commit")) scores["cost"] = cost(record) scores["flagged"] = metric_flags(scores) + drop_venv(venv) return scores @@ -1912,6 +1922,10 @@ def self_test(): + claim_checks(scratch) + security_checks(scratch) + coverage_checks(scratch) + python_files_checks(scratch) + scope_checks(scratch)) + dropped = create_venv(os.path.join(scratch, "dropped")) + drop_venv(dropped) + checks.append(("a scored trial's environment is dropped", + not os.path.exists(dropped))) venv = create_venv(os.path.join(scratch, "venv")) checks += boot_checks(scratch, venv) + interpreter_checks(scratch, venv) diff --git a/tests/efficacy/security.py b/tests/efficacy/security.py index e6152cb..d7d5e63 100644 --- a/tests/efficacy/security.py +++ b/tests/efficacy/security.py @@ -1051,6 +1051,17 @@ def read_trial(area, name, scores_file, auditor, auditor_reason): where = os.path.join(area, "security", name) os.makedirs(where, exist_ok=True) venv = create_venv(os.path.join(where, "venv")) + try: + return read_installed(venv, tree, where, result, auditor, + auditor_reason) + finally: + + # About 290 MB a trial, and nothing reads it again. + remove_tree(venv) + + +def read_installed(venv, tree, where, result, auditor, auditor_reason): + """The install, runtime and dependency checks of one trial, in `venv`.""" installed = pip(venv, "install", tree, cwd=where) if installed["failed"] or installed["status"] != 0: reason = ("the trial did not install: %s" @@ -1531,6 +1542,22 @@ def claim_self_checks(scratch): and not os.path.exists(os.path.join(area, "security")))] +def leftover_self_checks(scratch): + """A reading leaves no environment behind, even one whose trial did not + install.""" + area = os.path.join(scratch, "leftover") + tree = os.path.join(area, "tree") + os.makedirs(tree) + scores_file = os.path.join(area, "none-1.json") + with io.open(scores_file, "w", encoding="utf-8") as handle: + json.dump({"workspace": tree, "discovery": {"roots": []}}, handle) + result = read_trial(area, "none-1", scores_file, None, "not planted") + return [("a reading's environment is gone once it is read", + "probes" in result + and not os.path.exists(os.path.join(area, "security", "none-1", + "venv")))] + + def self_test(): """Prove each check counts what it names, records missing as missing, and that a live run refuses a second.""" @@ -1538,7 +1565,8 @@ def self_test(): remove_tree(scratch) os.makedirs(scratch) checks = (static_self_checks(scratch) + runtime_self_checks(scratch) - + audit_self_checks() + claim_self_checks(scratch)) + + audit_self_checks() + claim_self_checks(scratch) + + leftover_self_checks(scratch)) for label, ok in checks: print(" %-52s %s" % (label, "ok" if ok else "FAILED")) remove_tree(scratch) From 98b70e35c24e65b259178ac790609ba7997c2d50 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sun, 1 Nov 2026 13:48:44 +0200 Subject: [PATCH 2/2] fix(efficacy): refuse to archive a round a scoring tool is still running on The drop after the archive would delete trees and environments a live score, security or judge run is reading. archive.py now refuses while any of their claims on the scoring area names a live run. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xQeiWaKvHqQNHTU1uJ --- tests/efficacy/archive.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/efficacy/archive.py b/tests/efficacy/archive.py index 20dc4da..9abc249 100644 --- a/tests/efficacy/archive.py +++ b/tests/efficacy/archive.py @@ -26,7 +26,9 @@ import lib # noqa: E402 from harness import (TrialError, assert_outside_repository, # noqa: E402 - project_folder, remove_tree, scoring_area, write_run) + claim_path, claim_refusal_check, project_folder, + read_claim, remove_tree, running_as, scoring_area, + write_run) MANIFEST = "ARCHIVE.json" STAMP = "archived.json" @@ -328,6 +330,22 @@ def stamp(root, into): "readings": readings_digest(root)}) +# The tools that read and write a scoring area while they run, each under a +# claim of its own. +AREA_TOOLS = ("score.py", "security.py", "judge.py") + + +def live_run_problem(root): + """Why the round's scoring area is in use by a live run, or None.""" + area = scoring_area(root) + for tool in AREA_TOOLS: + holder = read_claim(claim_path(area, tool)) + if holder is not None and running_as(holder["pid"], tool): + return ("a %s run is live against %s: pid %d, started %s" + % (tool, area, holder["pid"], holder.get("started"))) + return None + + def drop_trees(root): """Delete the scoring area's extracted trees and any environment left beside them; return how many folders went.""" @@ -545,6 +563,11 @@ def self_test(): report.main(["--root", root, "--out-dir", out]) == 0 and bool(os.listdir(out)))) + for tool in AREA_TOOLS: + checks.append(claim_refusal_check( + tool, main, root, "--into", + os.path.join(scratch, "runs", "live-" + tool))) + for label, target in (("a non-empty target is refused", into), ("a target inside this repository is refused", os.path.join(lib.ROOT, "tmp", "archive-probe"))): @@ -613,6 +636,12 @@ def main(argv): if not options.root: print("--root is required") return 2 + + # A round still being scored, read or judged is not done, and the + # drop after the archive would delete what that run is reading. + problem = live_run_problem(options.root) + if problem: + raise TrialError(problem) import report seed = (options.seed if options.seed is not None else report.parse_args([]).seed)