Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/architecture/05-building-block-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/architecture/11-risks-and-technical-debt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
83 changes: 25 additions & 58 deletions tests/efficacy/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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",
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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))
Expand Down
16 changes: 6 additions & 10 deletions tests/efficacy/judge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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", "*"))):
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 4 additions & 8 deletions tests/efficacy/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)),
Expand Down
41 changes: 21 additions & 20 deletions tests/efficacy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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})$")


Expand Down Expand Up @@ -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",
Expand All @@ -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)
Expand All @@ -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():
Expand All @@ -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)
Expand Down
Loading
Loading