From 9c171ef07f8936c6e5139134251122621ef9c53f Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Wed, 4 Nov 2026 16:02:07 +0200 Subject: [PATCH] chore(efficacy): drop round 1's letter names A trial is its arm's word and its block, and nothing else reads as one. The letter map, the second spelling every reader tried and the fixtures frozen under A1 and B1 go; a tarball frozen under another name still unpacks under the trial's own. Round 5d reuses round 5c, so the reuse module and its plant say so. Part of #91 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY --- docs/architecture/05-building-block-view.md | 3 - .../11-risks-and-technical-debt.md | 1 - tests/efficacy/harness.py | 83 ++++++------------- tests/efficacy/judge.py | 16 ++-- tests/efficacy/progress.py | 12 +-- tests/efficacy/report.py | 41 ++++----- tests/efficacy/reuse.py | 79 +++++++++--------- tests/efficacy/score.py | 68 +++++++-------- tests/efficacy/security.py | 15 ++-- 9 files changed, 130 insertions(+), 188 deletions(-) diff --git a/docs/architecture/05-building-block-view.md b/docs/architecture/05-building-block-view.md index a64417e..6f9b479 100644 --- a/docs/architecture/05-building-block-view.md +++ b/docs/architecture/05-building-block-view.md @@ -100,9 +100,6 @@ paired with `none-2`. Blocks run in order and arms interleave within each, each block starting one arm later than the last: `none-1`, `inline-1`, `hybrid-1`, `reference-1`, `skills-1`, then `inline-2`, `hybrid-2`, and so on. -Round 1 named its arms by letter. Reading its report, A is `none`, B is -`full` and C is `hand`. - ### 5.5.3 How the generated files are made **One non-interactive invocation per generated arm, and no person answers diff --git a/docs/architecture/11-risks-and-technical-debt.md b/docs/architecture/11-risks-and-technical-debt.md index 1316271..49454e0 100644 --- a/docs/architecture/11-risks-and-technical-debt.md +++ b/docs/architecture/11-risks-and-technical-debt.md @@ -24,7 +24,6 @@ Each risk names what holds it today. | - | ---- | ---- | --------- | | 1 | Windows-specific handling: `.CMD` shims, `cmd.exe` expansion, process trees | A run on another platform is untested | State the platform in [ch. 2](02-constraints.md), or test one | | 2 | `harness.py` and `report.py` each run past 3,000 lines | A change is hard to review in isolation | Split by stage when next touched | -| 3 | Round 1's trials keep their letter names on disk (`A1`, `B2`, `C3`) | Every reader maps them | None while round 1 is read | ## 11.3 Confounds and their controls diff --git a/tests/efficacy/harness.py b/tests/efficacy/harness.py index 02d5afe..a251e6c 100644 --- a/tests/efficacy/harness.py +++ b/tests/efficacy/harness.py @@ -151,63 +151,32 @@ "context": "skills/CLAUDE.md", "skills": "skills/skills"}, } -# Round 1 named its arms by letter and its trials `A1`, `B2`, `C3`. Its run -# records, tarballs, scores and judgings keep those spellings, and every -# reader turns them into the words, so the round is never rewritten on disk. -ROUND_ONE = {"A": "none", "B": "full", "C": "hand"} -ROUND_ONE_NAME = re.compile(r"^([A-Z])(\d+)$") - - -def arm_name(raw): - """An arm as its word, whether a record names it by word or by round 1's - letter.""" - return ROUND_ONE.get(raw, raw) - - def trial_name(arm, block): """A trial's name: the arm's word, a hyphen, the block it runs in.""" return "%s-%d" % (arm, int(block)) def split_name(name): - """A trial name as (arm, block), round 1's letters read as their words. + """A trial name as (arm, block). The block is the last hyphenated part, so an arm's word never carries a hyphen of its own. """ - match = ROUND_ONE_NAME.match(name) - if match and match.group(1) in ROUND_ONE: - return ROUND_ONE[match.group(1)], int(match.group(2)) arm, _, block = name.rpartition("-") if not arm or not block.isdigit(): - raise TrialError("%r is not a trial name; one reads as `full-1`, the " + raise TrialError("%r is not a trial name; one reads as `hand-1`, the " "arm's word and its block" % name) return arm, int(block) def canonical(name): - """A trial name in the form the arms are named today, `none-1` for `A1`.""" + """A trial name as the arms spell it, `none-1` for `none-01`.""" return trial_name(*split_name(name)) -def round_one_name(name): - """Round 1's spelling of a trial name, `B1` for `full-1`, or None where - the arm was not in round 1.""" - arm, block = split_name(name) - letters = {word: letter for letter, word in ROUND_ONE.items()} - return "%s%d" % (letters[arm], block) if arm in letters else None - - -def spellings(name): - """Every name a trial's files may be filed under: its canonical name - and, for a round 1 arm, its letter.""" - return [spelled for spelled in (canonical(name), round_one_name(name)) - if spelled] - - def name_of(record): """The trial a run record or a score describes, by canonical name.""" - return trial_name(arm_name(record.get("arm")), record.get("trial")) + return trial_name(record.get("arm"), record.get("trial")) # Web access is a confound: an arm that reads the # templates online is not the arm being measured. The two web tools are @@ -1036,9 +1005,9 @@ def freeze(workspace, record_dir, name): def frozen_top(tarball, unpacked): """The one top-level directory a frozen tarball unpacked to. - A workspace is frozen under the trial's name as spelled on the day, so a - tarball round 1 froze as `B1` unpacks to `B1` whatever the trial is - called now, and the reader takes the directory it finds. + A workspace is frozen under the name it had on the day, which a reused + trial need not keep, so the reader takes the one directory it finds + rather than looking for the trial's name. """ entries = os.listdir(unpacked) if len(entries) != 1 or not os.path.isdir(os.path.join(unpacked, @@ -1257,7 +1226,8 @@ def path_forms(paths): def path_pattern(paths): """A pattern matching any of `paths` the way a command line spells it. - It ends where the path does, so `A1` matches neither `A10` nor `A1.tar`. + It ends where the path does, so `none-1` matches neither `none-10` nor + `none-1.tar`. """ return re.compile("(?:%s)%s" % ( "|".join(re.escape(form) for form in path_forms(paths)), PATH_END)) @@ -1275,9 +1245,9 @@ def outside_pattern(workspace, temp): own.append("tmp/" + re.escape(name)) # A sentence can end on the trial's own path, as in "the repo at - # ...\A1. I need", so punctuation before the path ends still leaves it - # the trial's own, and so does a pip extra, as in `pip install - # "...\hybrid-2[dev]"`. A suffix is not punctuation: `A1.tar` stays + # ...\none-1. I need", so punctuation before the path ends still leaves + # it the trial's own, and so does a pip extra, as in `pip install + # "...\hybrid-2[dev]"`. A suffix is not punctuation: `none-1.tar` stays # another entry of the root. not_own = "(?!(?:%s)(?:\\[[^\\]/\\s\"';,]*\\])?[.:!?)\\]]*%s)" % ( "|".join(own), PATH_END) @@ -2359,7 +2329,7 @@ def change_checks(): scratch = os.path.join(tempfile.gettempdir(), "efficacy-change-self-test") remove_tree(scratch) - build = os.path.join(scratch, "A1") + build = os.path.join(scratch, "frozen-elsewhere") os.makedirs(build) git(build, "init", "-q") with io.open(os.path.join(build, "app.py"), "w", @@ -2373,9 +2343,9 @@ def change_checks(): encoding="utf-8") as handle: handle.write("left_uncommitted = True\n") - # Frozen under round 1's spelling of the trial, so the change task of - # `none-1` has to find a top directory named `A1`. - frozen = freeze(build, scratch, "A1") + # Frozen under another name, as a reused trial's tarball may be, so the + # change task of `none-1` has to take the top directory it finds. + frozen = freeze(build, scratch, "frozen-elsewhere") # The plant landed: the build trial ended with work it never committed, # which is the state a change task has to take into its starting commit. @@ -2387,7 +2357,7 @@ def change_checks(): except TrialError: workspace, base = None, None checks.append(("the change workspace unpacks under its own name, in its " - "pen, from a tarball frozen under round 1's", + "pen, from a tarball frozen under another name", workspace == trial_workspace(scratch, "change-none-1") and os.path.isfile(os.path.join(workspace, "draft.py")))) checks.append(("its starting state is committed", workspace is not None @@ -2757,9 +2727,10 @@ def leftover_checks(): # On Windows, the folder name the CLI itself wrote for a real trial, so the # check holds the harness to the CLI rather than to the harness's own rule. -PLANTED_TRANSCRIPT = ((r"C:\efficacy\run-v290\A1", "C--efficacy-run-v290-A1") +PLANTED_TRANSCRIPT = ((r"C:\efficacy\run-v290\none-1", + "C--efficacy-run-v290-none-1") if os.name == "nt" else - ("/efficacy/run-v290/A1", "-efficacy-run-v290-A1")) + ("/efficacy/run-v290/none-1", "-efficacy-run-v290-none-1")) def reach_checks(): @@ -2936,23 +2907,19 @@ def pen_checks(): def naming_checks(): - """A trial is named by its arm's word and its block, and round 1's - letters read as the words they became.""" + """A trial is named by its arm's word and its block, and nothing else + reads as one.""" checks = [ ("a trial is the arm's word, a hyphen and its block", trial_name("short", 2) == "short-2" and split_name("short-2") == ("short", 2)), - ("round 1's letters read as their words", - [split_name(name) for name in ("A1", "B2", "C3")] - == [("none", 1), ("full", 2), ("hand", 3)] - and canonical("B2") == "full-2"), - ("a record names its trial whichever way it spells the arm", - name_of({"arm": "B", "trial": 1}) == "full-1" + ("a record names its trial by its arm and block", + name_of({"arm": "hand", "trial": 1}) == "hand-1" and name_of({"arm": "hybrid", "trial": 3}) == "hybrid-3"), ("a word name canonicalises to itself", canonical("hybrid-3") == "hybrid-3"), ] - for name in ("none", "D1", "short-x", "-1"): + for name in ("none", "A1", "short-x", "-1"): try: split_name(name) checks.append(("%r is refused as a trial name" % name, False)) diff --git a/tests/efficacy/judge.py b/tests/efficacy/judge.py index c739065..33acd69 100644 --- a/tests/efficacy/judge.py +++ b/tests/efficacy/judge.py @@ -135,7 +135,7 @@ # would have changed what is being judged. MARKERS = ("CLAUDE.md", "AGENTS.md", "GEMINI.md", "solid-ai-templates", "Claude Code", "claude.ai", "CLAUDE", "context file", - "arm A", "arm B", "arm C", "arm none", "arm full", "arm short", + "arm none", "arm full", "arm short", "arm hybrid", "arm hand", "arm reference", "arm inline", "arm skills", "SKILL.md") @@ -681,11 +681,7 @@ def refusal(stripped): def trees(root): - """Every scored trial's extracted tree, by canonical trial name. - - A tree round 1 scored sits under its letter name, `B1`, and is judged - under its word, `full-1`. - """ + """Every scored trial's extracted tree, by canonical trial name.""" found = {} scoring = os.path.join(score.scoring_area(root), "scoring") for path in sorted(glob.glob(os.path.join(scoring, "*", "tree", "*"))): @@ -1251,15 +1247,15 @@ def label_checks(scratch): judging = os.path.join(scratch, "labels", "judge") os.makedirs(judging) plant(judging, { - "T3.json": json.dumps({"trial": "B1", "blind_id": "T3", + "T3.json": json.dumps({"trial": "inline-1", "blind_id": "T3", "outcome": "judged"}), - "T10.json": json.dumps({"trial": "C2", "blind_id": "T10", + "T10.json": json.dumps({"trial": "hand-2", "blind_id": "T10", "outcome": "failed"}), - "map.json": json.dumps({"seed": 1, "blind": {"A1": "T12"}}), + "map.json": json.dumps({"seed": 1, "blind": {"none-1": "T12"}}), }) return [ ("a judged trial is known under its word, a failed one is not", - judged(judging) == {"full-1": ["T3"]}), + judged(judging) == {"inline-1": ["T3"]}), ("the highest label counts every file and the map", highest_label(judging) == 12), ("new labels continue past it", diff --git a/tests/efficacy/progress.py b/tests/efficacy/progress.py index 12f2518..77106a9 100644 --- a/tests/efficacy/progress.py +++ b/tests/efficacy/progress.py @@ -23,7 +23,7 @@ import lib # noqa: E402 from harness import (ROUND5_K, SCORABLE, VOIDING, LiveRunError, # noqa: E402 - TrialError, arm_name, claim_path, now, read_claim, + TrialError, claim_path, now, read_claim, result_of, running_as, scoring_area, split_name) from report import ROUND5_RUN # noqa: E402 @@ -60,7 +60,7 @@ def arms_in(trials): # so each gets a bar from its first trial on; none is dropped as unknown. found = list(ROUND5_RUN) for record in trials: - arm = arm_name(record.get("arm")) + arm = record.get("arm") if arm and arm not in found: found.append(arm) return tuple(found) @@ -93,7 +93,7 @@ def tally(trials, arms): arms = {arm: {"done": set(), "voided": 0, "cost": 0.0, "running": None} for arm in arms} for record in trials: - arm = arms.get(arm_name(record.get("arm"))) + arm = arms.get(record.get("arm")) if arm is None: continue outcome = record.get("outcome") @@ -173,7 +173,7 @@ def arm_of(name): def blocks_of(names, arm): """The blocks of `arm` that `names` hold, each once however it is - spelled: round 1's `A1` and its word `none-1` are one trial.""" + spelled: `none-01` and `none-1` are one trial.""" found = set() for name in names: try: @@ -380,8 +380,6 @@ def dated(path, minutes, folder=False): dated(os.path.join(area, "scores", "%s.json" % name), minutes) dated(os.path.join(area, "security-scores", "none-1.json"), 6) - # Round 1's spelling of none-1, left beside the word a rescore wrote. - dated(os.path.join(area, "scores", "A1.json"), 4) dated(os.path.join(area, "scoring", "inline-2"), 20, folder=True) dated(os.path.join(area, "scoring", "hybrid-1"), 40, folder=True) dated(os.path.join(area, "scoring", "tools"), 50, folder=True) @@ -471,8 +469,6 @@ def scoring_now(alive=True): and not any(" scoring " in line for line in securing)), ("the security pass shows no scoring estimate, bar short or not", not any("left" in line for line in securing)), - ("a trial scored under two spellings counts once", - " 1/15" in scored.get("none", "")), ("a rescore shows its time in and no time left", any(" h in" in line for line in rescore_pace) and not any("h left" in line for line in rescore_pace)), diff --git a/tests/efficacy/report.py b/tests/efficacy/report.py index 2e9bf09..df58516 100644 --- a/tests/efficacy/report.py +++ b/tests/efficacy/report.py @@ -627,8 +627,8 @@ def non_inferior(key, interval, direction, baseline_mean=None, margins=None): def load(root): """Every scored trial, with its judging attached where one exists. - Keyed by canonical name: a score, judging or reading round 1 wrote names - its trial `A1`, and is read here as `none-1`. + Keyed by canonical name, so a trial's score, judging and reading meet + however each spelled it. """ area = scoring_area(root) trials = {} @@ -1670,9 +1670,8 @@ def lost_trials(root): # A voided directory is named for the workspace it held and when it was -# voided, as `change-hand-2-2026-09-16T20-29-18`; round 1 spelled the trial -# `C2`. -VOIDED = re.compile(r"^(change-)?([a-z]+-\d+|[A-Z]\d+)-(\d{4}-\d{2}-\d{2})" +# voided, as `change-hand-2-2026-09-16T20-29-18`. +VOIDED = re.compile(r"^(change-)?([a-z]+-\d+)-(\d{4}-\d{2}-\d{2})" r"T(\d{2})-(\d{2})-(\d{2})$") @@ -4417,13 +4416,13 @@ def reach_checks(): hit = {"tool": "Bash", "term": "solid-ai-templates", "call": "curl https://github.com/solid-ai-dev/solid-ai-templates"} planted = [ - {"arm": "B", "trial": 1, "outcome": "completed", + {"arm": "inline", "trial": 1, "outcome": "completed", "reach": {"transcripts": ["planted"], "hits": [hit]}}, - {"arm": "A", "trial": 1, "outcome": "completed", + {"arm": "none", "trial": 1, "outcome": "completed", "reach": {"transcripts": ["planted"], "hits": []}}, - {"arm": "C", "trial": 1, "outcome": "completed", - "workspace": os.path.join(scratch, "C1")}, - {"arm": "A", "trial": 2, "outcome": "blocked", + {"arm": "hand", "trial": 1, "outcome": "completed", + "workspace": os.path.join(scratch, "hand-1")}, + {"arm": "none", "trial": 2, "outcome": "blocked", "reach": {"transcripts": ["planted"], "hits": [hit]}}, ] with io.open(os.path.join(scratch, "run-planted.json"), "w", @@ -4436,7 +4435,7 @@ def reach_checks(): checks = [("the planted run record is read", len(run_records(scratch)) == len(planted)), ("a trial whose scan hit is named", - [row.split(" | ")[0] for row in rows] == ["| full-1"]), + [row.split(" | ")[0] for row in rows] == ["| inline-1"]), ("a trial with no transcript is not scanned", "Not scanned, having no transcript: hand-1." in lines)] shutil.rmtree(scratch, ignore_errors=True) @@ -4448,25 +4447,26 @@ def lost_checks(): scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-lost-self-test") shutil.rmtree(scratch, ignore_errors=True) - recorded = os.path.join(scratch, "void", "A1-2026-09-15T10-00-00") - unrecorded = os.path.join(scratch, "void", "change-C2-2026-09-16T18-30-00") + recorded = os.path.join(scratch, "void", "none-1-2026-09-15T10-00-00") + unrecorded = os.path.join(scratch, "void", + "change-hand-2-2026-09-16T18-30-00") for directory in (recorded, unrecorded): os.makedirs(directory) - # A1 was blocked and recorded; the run holding change C2 stopped before - # recording it, and C2's change task re-ran in a later run. + # none-1 was blocked and recorded; the run holding change hand-2 stopped + # before recording it, and hand-2's change task re-ran in a later run. runs = { "run-2026-09-15T09-00-00.json": [ - {"arm": "A", "trial": 1, "task": "build", "outcome": "blocked", + {"arm": "none", "trial": 1, "task": "build", "outcome": "blocked", "started_at": "2026-09-15T09:00:00", "reason": "planted", "void": {"dir": recorded}}, - {"arm": "A", "trial": 1, "task": "build", + {"arm": "none", "trial": 1, "task": "build", "outcome": "completed", "started_at": "2026-09-15T10:05:00"}], "run-2026-09-16T17-00-00.json": [ - {"arm": "C", "trial": 2, "task": "build", + {"arm": "hand", "trial": 2, "task": "build", "outcome": "completed", "started_at": "2026-09-16T17:00:00"}], "run-2026-09-16T20-00-00.json": [ - {"arm": "C", "trial": 2, "task": "change", + {"arm": "hand", "trial": 2, "task": "change", "outcome": "completed", "started_at": "2026-09-16T20:00:00"}], } for file, trials in runs.items(): @@ -4475,7 +4475,8 @@ def lost_checks(): json.dump({"trials": trials}, handle) landed = (sorted(os.listdir(os.path.join(scratch, "void"))) - == ["A1-2026-09-15T10-00-00", "change-C2-2026-09-16T18-30-00"] + == ["change-hand-2-2026-09-16T18-30-00", + "none-1-2026-09-15T10-00-00"] and len(run_records(scratch)) == 4) lost = lost_trials(scratch) shutil.rmtree(scratch, ignore_errors=True) diff --git a/tests/efficacy/reuse.py b/tests/efficacy/reuse.py index 9a1d19f..58a4517 100644 --- a/tests/efficacy/reuse.py +++ b/tests/efficacy/reuse.py @@ -1,12 +1,11 @@ """Bring an earlier round's trials into a run root, scored and judged as they were. -Round 2 reuses round 1's `full` and `hand` trials rather than running them -again. This module copies what the report -reads for a trial — its run record, frozen tarball, transcripts, score, -judging and security reading — from the earlier root and scoring area into -the new ones, under the arm's word, and marks each copy with where it came -from. The earlier root is never touched, and nothing copied is scored or +Round 5d reuses round 5c's trials rather than running them again. This +module copies what the report reads for a trial — its run record, frozen +tarball, transcripts, score, judging and security reading — from the earlier +root and scoring area into the new ones, and marks each copy with where it +came from. The earlier root is never touched, and nothing copied is scored or judged again: the scorer, the judge and the security reader skip a trial whose result is already there. """ @@ -24,10 +23,10 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import lib # noqa: E402 -from harness import (ARMS, PROMPT, TrialError, arm_name, # noqa: E402 +from harness import (ARMS, PROMPT, TrialError, # noqa: E402 assert_outside_repository, canonical, now, project_folder, remove_tree, scorable_trials, - scoring_area, spellings, write_run) + scoring_area, write_run) # The scoring area's per-trial readings, each a JSON file named for the # trial, that a reused trial brings with it. @@ -35,12 +34,9 @@ def existing_file(directory, name): - """The JSON file a trial's reading is filed under, in either spelling.""" - for spelled in spellings(name): - path = os.path.join(directory, "%s.json" % spelled) - if os.path.isfile(path): - return path - return None + """The JSON file a trial's reading is filed under, or None.""" + path = os.path.join(directory, "%s.json" % canonical(name)) + return path if os.path.isfile(path) else None def select(source, arms): @@ -48,10 +44,9 @@ def select(source, arms): canonical name.""" offered = scorable_trials(source, task="build") chosen = {name: record for name, record in offered.items() - if arm_name(record.get("arm")) in arms} + if record.get("arm") in arms} for arm in arms: - if not any(arm_name(record.get("arm")) == arm - for record in chosen.values()): + if not any(record.get("arm") == arm for record in chosen.values()): raise TrialError("no scorable build trial of arm %s in %s" % (arm, source)) return chosen @@ -102,7 +97,6 @@ def reuse_trial(name, record, source, target): "tarball": tarball} copied = dict(record) - copied["arm"] = arm_name(record.get("arm")) copied["reused_from"] = origin copied["frozen"] = dict(record["frozen"], tarball=os.path.join(target, "%s.tar" % name)) @@ -215,19 +209,19 @@ def reuse(source, target, arms): def plant_source(scratch): - """A source root shaped like round 1's: one trial per letter arm, each - scored, judged and read for security, with a transcript and a lock.""" + """A source root of an earlier round: one trial per arm, each scored, + judged and read for security, with a transcript and a lock.""" source = os.path.join(scratch, "earlier") area = scoring_area(source) records = [] - for letter, index in (("A", 1), ("B", 1), ("C", 1)): - old = "%s%d" % (letter, index) + for arm, index in (("none", 1), ("inline", 1), ("hand", 1)): + old = "%s-%d" % (arm, index) workspace = os.path.join(source, old) tarball = os.path.join(source, "%s.tar" % old) os.makedirs(workspace) with io.open(tarball, "wb") as handle: handle.write(b"frozen " + old.encode()) - records.append({"arm": letter, "trial": index, "task": "build", + records.append({"arm": arm, "trial": index, "task": "build", "outcome": "completed", "workspace": workspace, "frozen": {"head": "abc", "tarball": tarball}}) folder = os.path.join(source, "home", ".claude", "projects", @@ -240,12 +234,12 @@ def plant_source(scratch): os.makedirs(os.path.join(area, kind), exist_ok=True) with io.open(os.path.join(area, kind, "%s.json" % old), "w", encoding="utf-8") as handle: - json.dump({"name": old, "arm": letter, "trial": index, + json.dump({"name": old, "arm": arm, "trial": index, "suite_revision": "planted"}, handle) write_run(os.path.join(source, "run-planted.json"), datetime.datetime(2026, 9, 15, 12, 0, 0), records) os.makedirs(os.path.join(area, "judge")) - blind = {"C1": "T1", "B1": "T2", "A1": "T3"} + blind = {"hand-1": "T1", "inline-1": "T2", "none-1": "T3"} for old, label in blind.items(): with io.open(os.path.join(area, "judge", "%s.json" % label), "w", encoding="utf-8") as handle: @@ -272,22 +266,23 @@ def loaded(*parts): with io.open(os.path.join(*parts), encoding="utf-8") as handle: return json.load(handle) - names, run_file = reuse(source, target, ["full", "hand"]) + names, run_file = reuse(source, target, ["inline", "hand"]) records = {r["arm"] + "-" + str(r["trial"]): r for r in loaded(run_file)["trials"]} checks = [ ("the chosen arms' trials are copied under the words, and no other", - names == ["full-1", "hand-1"] - and sorted(os.listdir(target)) == ["full-1.tar", "hand-1.tar", - "home", os.path.basename(run_file)] - and sorted(records) == ["full-1", "hand-1"]), + names == ["hand-1", "inline-1"] + and sorted(os.listdir(target)) == ["hand-1.tar", "home", + "inline-1.tar", + os.path.basename(run_file)] + and sorted(records) == ["hand-1", "inline-1"]), ("each record names the arm's word, its origin and its copied tarball", - records["full-1"]["arm"] == "full" - and records["full-1"]["reused_from"]["name"] == "B1" - and records["full-1"]["frozen"]["tarball"] - == os.path.join(target, "full-1.tar") - and io.open(os.path.join(target, "full-1.tar"), "rb").read() - == b"frozen B1"), + records["inline-1"]["arm"] == "inline" + and records["inline-1"]["reused_from"]["name"] == "inline-1" + and records["inline-1"]["frozen"]["tarball"] + == os.path.join(target, "inline-1.tar") + and io.open(os.path.join(target, "inline-1.tar"), "rb").read() + == b"frozen inline-1"), ("the transcripts come along under the workspace's folder", os.path.isfile(os.path.join( target, "home", ".claude", "projects", @@ -298,23 +293,23 @@ def loaded(*parts): and loaded(area, kind, "%s.json" % name)["reused_from"]["name"] == old for kind in READINGS - for name, old in (("full-1", "B1"), ("hand-1", "C1"))) + for name, old in (("inline-1", "inline-1"), ("hand-1", "hand-1"))) and not os.path.exists(os.path.join(area, "scores", "none-1.json"))), ("the judgings keep their labels and the map is theirs alone", - loaded(area, "judge", "T2.json")["trial"] == "full-1" + loaded(area, "judge", "T2.json")["trial"] == "inline-1" and loaded(area, "judge", "T1.json")["trial"] == "hand-1" and not os.path.exists(os.path.join(area, "judge", "T3.json")) and loaded(area, "judge", "map.json")["blind"] - == {"full-1": "T2", "hand-1": "T1"}), + == {"inline-1": "T2", "hand-1": "T1"}), ("the earlier round's tool lock comes along", io.open(os.path.join(area, "tool-lock.txt"), encoding="utf-8").read() == "ruler==1.0\n"), ("the target offers the copied trials for scoring under the words", - sorted(scorable_trials(target)) == ["full-1", "hand-1"]), + sorted(scorable_trials(target)) == ["hand-1", "inline-1"]), ] try: - reuse(source, target, ["full"]) + reuse(source, target, ["inline"]) checks.append(("a trial the target already offers is refused", False)) except TrialError: @@ -344,7 +339,7 @@ def parse_args(argv): "this repository") parser.add_argument("--arms", help="which arms to bring, as words separated by " - "commas: full,hand") + "commas: none,inline") parser.add_argument("--self-test", action="store_true", help="prove a reuse copies the chosen trials and " "only those; copy nothing") diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index 4d9afbf..c637a4c 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -39,9 +39,9 @@ import lib # noqa: E402 import probes # noqa: E402 from harness import (SCORABLE, LiveRunError, TrialError, # noqa: E402 - arm_name, canonical, claim_area, claim_refusal_check, + canonical, claim_area, claim_refusal_check, frozen_top, name_of, release_area, remove_tree, - scorable_trials, scoring_area, spellings) + scorable_trials, scoring_area) HERE = os.path.dirname(os.path.abspath(__file__)) SCRIPT = os.path.basename(__file__) @@ -230,8 +230,8 @@ def extract(tarball, into, name): with tarfile.open(tarball) as archive: archive.extractall(into, filter="data") - # The tarball's top directory carries the trial's name as spelled when it - # was frozen; round 1's `B1` is scored under `full-1` today. + # The tarball's top directory carries the name the trial had when it was + # frozen, which a reused trial need not keep. try: top = frozen_top(tarball, into) except TrialError as error: @@ -1172,7 +1172,7 @@ def score_trial(record, options, suite, lock): files = python_files(workspace) venv = create_venv(os.path.join(scoring, "venv")) - scores = {"arm": arm_name(record["arm"]), "trial": record["trial"], + scores = {"arm": record["arm"], "trial": record["trial"], "name": name, "workspace": workspace, "templates_tree": record.get( "templates_tree"), @@ -1313,7 +1313,7 @@ def score_change_trial(record, options, suite): os.path.join(scoring, "tree"), frozen) venv = create_venv(os.path.join(scoring, "venv")) - scores = {"arm": arm_name(record["arm"]), "trial": record["trial"], + scores = {"arm": record["arm"], "trial": record["trial"], "name": name, "task": "change", "workspace": workspace, "base": record.get("base"), "model": record.get("model"), @@ -1390,27 +1390,25 @@ def plant(name, trials): encoding="utf-8") as handle: json.dump({"trials": trials}, handle) - # Round 1's records name their arms by letter, and a record of this round - # by word; both are offered under the words. - plant("run-1.json", [{"arm": "A", "trial": 1, "outcome": "blocked"}, - {"arm": "A", "trial": 1, "outcome": "completed"}, - {"arm": "B", "trial": 1, "outcome": "budget"}, - {"arm": "C", "trial": 1, "outcome": "refused"}, + plant("run-1.json", [{"arm": "none", "trial": 1, "outcome": "blocked"}, + {"arm": "none", "trial": 1, "outcome": "completed"}, + {"arm": "inline", "trial": 1, "outcome": "budget"}, + {"arm": "hand", "trial": 1, "outcome": "refused"}, {"arm": "short", "trial": 1, "outcome": "timeout"}]) offered = scorable_trials(scratch) checks = [("only completed, budget and timeout endings are offered, " "under the arms' words", - sorted(offered) == ["full-1", "none-1", "short-1"]), + sorted(offered) == ["inline-1", "none-1", "short-1"]), ("a blocked trial yields to its re-run", offered["none-1"]["outcome"] == "completed")] - plant("run-2.json", [{"arm": "A", "trial": 1, "outcome": "completed", + plant("run-2.json", [{"arm": "none", "trial": 1, "outcome": "completed", "task": "change"}]) checks.append(("a change task is offered only as a change task", sorted(scorable_trials(scratch, task="change")) == ["none-1"] and sorted(scorable_trials(scratch)) - == ["full-1", "none-1", "short-1"])) + == ["inline-1", "none-1", "short-1"])) plant("run-3.json", [{"arm": "none", "trial": 1, "outcome": "completed"}]) try: @@ -1419,16 +1417,16 @@ def plant(name, trials): except TrialError: checks.append(("a trial two records offer refuses", True)) - # A score round 1 wrote under its letter is the trial's score under its - # word, and a revision it was graded at is read back. + # An existing score is found by its trial's name, and the revision it was + # graded at is read back. written = os.path.join(scratch, "scores") os.makedirs(written) - with io.open(os.path.join(written, "A1.json"), "w", + with io.open(os.path.join(written, "none-1.json"), "w", encoding="utf-8") as handle: - json.dump({"name": "A1", "suite_revision": "earlier"}, handle) - checks.append(("an existing score is found under either spelling", + json.dump({"name": "none-1", "suite_revision": "earlier"}, handle) + checks.append(("an existing score is found, and its revision read back", existing_score(written, "none-1") - == os.path.join(written, "A1.json") + == os.path.join(written, "none-1.json") and existing_score(written, "short-1") is None and graded_revisions(written) == {"earlier"})) return checks @@ -1475,7 +1473,7 @@ def plant(name, text): def lock_checks(): """A trial's own package never reaches the lock, and a replaced one shows.""" freeze = ("ruff==0.16.0\n" - "tariff @ file:///C:/efficacy/run/scoring/A1/tree/A1\n" + "tariff @ file:///C:/efficacy/run/scoring/none-1/tree/none-1\n" "-e git+https://example.invalid/other.git#egg=other\n" "Tariff==0.1.0\n" "pytest==9.1.1\n") @@ -1487,9 +1485,11 @@ def lock_checks(): ("only the tools reach the lock", lock_lines(freeze) == ["ruff==0.16.0", "pytest==9.1.1"]), ("a package that stays put is not flagged", - package_moved("file:///run/B1", "file:///run/B1") is None), + package_moved("file:///run/inline-1", "file:///run/inline-1") + is None), ("a package the battery replaced is flagged", - package_moved("file:///run/B1", "file:///run/A1") is not None)] + package_moved("file:///run/inline-1", "file:///run/none-1") + is not None)] # The validator's JSON report in the shape html5validator 0.4.2 prints: the @@ -1534,17 +1534,17 @@ def readonly_checks(scratch): with io.open(planted, "w", encoding="utf-8") as handle: handle.write("planted") os.chmod(planted, 0o444) - source = os.path.join(scratch, "readonly-source", "A1") + source = os.path.join(scratch, "readonly-source", "frozen-elsewhere") os.makedirs(source) with io.open(os.path.join(source, "app.py"), "w", encoding="utf-8") as handle: handle.write("fresh = True\n") - # Frozen under round 1's spelling, so the extract under the word has to + # Frozen under another name, so the extract under the trial's name has to # take the directory it finds and rename it. - tarball = os.path.join(scratch, "readonly-A1.tar") + tarball = os.path.join(scratch, "readonly-elsewhere.tar") with tarfile.open(tarball, "w") as archive: - archive.add(source, arcname="A1") + archive.add(source, arcname="frozen-elsewhere") # The plant landed: the file the extract must replace is read-only, which # is what stops a plain removal on Windows. @@ -1562,7 +1562,7 @@ def readonly_checks(scratch): # The grader's report as `run_suite.py` writes it, cut to the counts: five -# checks skipped for want of a browser, as a re-score of A1 recorded. +# checks skipped for want of a browser, as a re-score of none-1 recorded. PLANTED_SUITE_REPORT = {"graded": True, "pass_rate": 0.9973, "counts": {"error": 0, "failed": 1, "passed": 371, "skipped": 5, "total": 377}} @@ -2045,13 +2045,9 @@ def self_test(): def existing_score(target, name): - """The score file already written for a trial, in either spelling, or - None.""" - for spelled in spellings(name): - path = os.path.join(target, "%s.json" % spelled) - if os.path.isfile(path): - return path - return None + """The score file already written for a trial, or None.""" + path = os.path.join(target, "%s.json" % canonical(name)) + return path if os.path.isfile(path) else None def graded_revisions(target): diff --git a/tests/efficacy/security.py b/tests/efficacy/security.py index d7d5e63..9250b7a 100644 --- a/tests/efficacy/security.py +++ b/tests/efficacy/security.py @@ -28,7 +28,7 @@ import lib # noqa: E402 from harness import (LiveRunError, canonical, claim_area, # noqa: E402 claim_refusal_check, release_area, remove_tree, - scoring_area, spellings) + scoring_area) from score import (absent, create_venv, lock_lines, measured, pip, # noqa: E402 python_in, run, script_in) @@ -1577,13 +1577,9 @@ def self_test(): def existing_file(directory, name): - """The JSON file a trial's reading is filed under, in either spelling, - or None.""" - for spelled in spellings(name): - path = os.path.join(directory, "%s.json" % spelled) - if os.path.isfile(path): - return path - return None + """The JSON file a trial's reading is filed under, or None.""" + path = os.path.join(directory, "%s.json" % canonical(name)) + return path if os.path.isfile(path) else None def parse_args(argv): @@ -1609,8 +1605,7 @@ def main(argv): print("--root is required unless --self-test is given") return 2 - # A score round 1 wrote sits under its letter name, `A1.json`, and is read - # under its word, `none-1`. + # A score is filed under its trial's name, read as the arms spell it. area = scoring_area(options.root) scores = os.path.join(area, "scores") scored = {canonical(os.path.splitext(entry)[0]):