From 011325ca78b7a83aecbb7bce549f3bf934de83c9 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:58:13 +0200 Subject: [PATCH 1/2] feat(efficacy): tell every arm the spec is the approved plan Round 5's first start of block A stopped: inline-1 printed a plan and ended, following the templates' rule to wait for a plan's approval, which no headless trial gets. The prompt now says the spec is the approved plan and nobody will answer, for every arm alike. The report refuses a build run given another prompt, so the stopped start's run record cannot be mixed into the round. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- docs/architecture/06-runtime-view.md | 8 ++- .../architecture/09-architecture-decisions.md | 1 + docs/rounds/README.md | 2 +- docs/rounds/round-5.md | 31 +++++++++ tests/efficacy/harness.py | 8 ++- tests/efficacy/report.py | 67 ++++++++++++++++++- 6 files changed, 112 insertions(+), 5 deletions(-) diff --git a/docs/architecture/06-runtime-view.md b/docs/architecture/06-runtime-view.md index 2455572..6ba5b81 100644 --- a/docs/architecture/06-runtime-view.md +++ b/docs/architecture/06-runtime-view.md @@ -48,11 +48,17 @@ How a trial ends: Every arm gets one prompt, identical for all: -> Implement the application described in SPEC.md. Done means: +> Implement the application described in SPEC.md. SPEC.md is the +> approved plan, and nobody will answer questions during this run, so +> build it to the end without stopping for approval. Done means: > `pip install .` succeeds in a clean virtualenv, your own tests pass, > and every page and route in the spec works end to end against the > seed fixture. Commit when done. +The second sentence was added for round 5. A trial runs headless, and the +templates ask for a plan's approval before implementation code, so without it a +templates arm could end its trial with a plan and nothing built. + **Isolation.** Each trial runs apart from the machine and from the others: | What | How | diff --git a/docs/architecture/09-architecture-decisions.md b/docs/architecture/09-architecture-decisions.md index 359a813..30cd6d7 100644 --- a/docs/architecture/09-architecture-decisions.md +++ b/docs/architecture/09-architecture-decisions.md @@ -64,6 +64,7 @@ that mentions the design means the document these chapters replaced. | 2026-10-28 | A template change runs the baseline and the candidate head to head in the candidate's round, with one contrast, `candidate − baseline`, and no `none` arm; round 3 stays a reference without a verdict | A contrast pairing trials from different rounds gets no verdict, so round 3 as the baseline could decide nothing. Two arms answer "is the trim free" at the least cost | — | | 2026-10-28 | From round 5, size reads app code's lines and files against a band of 20 %, smallest change 40 %; test lines are reported without a verdict; docs and configuration leave size; committed generated files count as artifacts nobody asked for | A better solution is often a little bigger, with tests and layering. Round 4's source lines missed templates, and its file count was mostly docs, templates and committed bytecode | — | | 2026-10-29 | A round registers its spec by content, and the harness and the report each refuse a trial built from other content | Each trial recorded the spec's hash but nothing compared it, so an edit during a two-day run would have mixed two specs in one round unseen | — | +| 2026-10-29 | The prompt tells every arm the spec is the approved plan and nobody will answer, and the report refuses a build run on another prompt | Round 5's first start: `inline-1` stopped after its plan, waiting for an approval no headless trial gets | — | ¹ This agrees with Anthropic's guidance on context engineering, which asks for the smallest set of high-signal tokens: [Effective context engineering for AI diff --git a/docs/rounds/README.md b/docs/rounds/README.md index 62beb50..0bd8b3c 100644 --- a/docs/rounds/README.md +++ b/docs/rounds/README.md @@ -8,7 +8,7 @@ trial of that round has run. The rules every round shares are in | Round | Registered | Asks | | ----- | ---------- | ---- | | [Round 4](round-4.md) | Before its first trial, after round 3 | Does a file supply what a thin spec leaves out, and help a weaker model more | -| [Round 5](round-5.md) | 2026-10-26, amended 2026-10-27, 2026-10-28 and 2026-10-29 | Which way of delivering the rules gives the best and most consistent code | +| [Round 5](round-5.md) | 2026-10-26, amended 2026-10-27, 2026-10-28 and twice on 2026-10-29 | Which way of delivering the rules gives the best and most consistent code | ## Reports diff --git a/docs/rounds/round-5.md b/docs/rounds/round-5.md index c51de90..a26790d 100644 --- a/docs/rounds/round-5.md +++ b/docs/rounds/round-5.md @@ -6,6 +6,9 @@ and once to size the round from the noise of rounds 3 and 4 (#38). Moved here unchanged but for its links, and amended on 2026-10-28, still before any trial, to read code size as app code and test code (#39). Amended on 2026-10-29, still before any trial, to register the specification's content as well as its name. +Amended again on 2026-10-29, after a first start of block A was stopped and its +four trials discarded, to tell every arm the spec is the approved plan (section +13.7). ## 13. Round 5: how the rules are delivered @@ -200,3 +203,31 @@ Why: a better solution is often a little bigger, with tests, error handling and layering, so a small rise should not read as worse. In round 4's trees, tests were 10 to 40 % of the Python lines, and docs, templates and config outnumbered the app's modules, so the old rows measured neither code nor bulk cleanly. + +### 13.7 The prompt + +Amended on 2026-10-29, after a first start of block A. Every arm's prompt gains +one sentence after its first: + +> SPEC.md is the approved plan, and nobody will answer questions during this +> run, so build it to the end without stopping for approval. + +Why: `templates/core/review.md` at `9086e0ff` asks for a plan, and its +approval, before implementation code, unless the requester specified the change +in full. A trial runs headless, so nobody approves. The first start's +`inline-1` printed a plan, cited that rule, and ended after 2 minutes and $0.30 +with nothing built. Without the sentence a +templates arm loses for waiting, not for the code it guides. The sentence goes +to every arm, `none` included, so the context file stays the only difference. + +The first start, from 08:21 to 09:47 on 2026-10-29 in `C:/efficacy/r5-main`: + +| Trial | What happened | +| --- | --- | +| `none-1` | Voided for a command run outside its workspace, then rerun to completion | +| `inline-1` | Stopped after its plan, as above | +| `hybrid-1` | Stopped mid-build when block A was stopped | + +Its four trials count toward nothing. None was scored or judged. Block A +restarts at block 1 in a fresh run root, and the report refuses a build run +whose recorded prompt is not this one. diff --git a/tests/efficacy/harness.py b/tests/efficacy/harness.py index b2aca89..4586a36 100644 --- a/tests/efficacy/harness.py +++ b/tests/efficacy/harness.py @@ -50,9 +50,13 @@ # Identical for every arm, so the context file is the only difference. # Changing it changes what the benchmark measures, so it is a constant and -# not an option. +# not an option. A trial runs headless, so a context file asking the agent to +# wait for a plan's approval would end the trial with nothing built; the spec +# stands as the approved plan, and the prompt says nobody will answer. PROMPT = ( - "Implement the application described in SPEC.md. Done means: " + "Implement the application described in SPEC.md. SPEC.md is the approved " + "plan, and nobody will answer questions during this run, so build it to " + "the end without stopping for approval. Done means: " "`pip install .` succeeds in a clean virtualenv, your own tests pass, " "and every page and route in the spec works end to end against the " "seed fixture. Commit when done." diff --git a/tests/efficacy/report.py b/tests/efficacy/report.py index d178106..9aaee10 100644 --- a/tests/efficacy/report.py +++ b/tests/efficacy/report.py @@ -35,7 +35,7 @@ import lib # noqa: E402 from generate_arm import GENERATED, record_path # noqa: E402 from harness import (ARMS, ARMS_DIR, K_CEILING, K_PRIMARY, # noqa: E402 - ROUND5_ARMS, ROUND5_K, ROUND5_SPEC, SCORABLE, + PROMPT, ROUND5_ARMS, ROUND5_K, ROUND5_SPEC, SCORABLE, TEMPLATES_ENV, VOIDING, TrialError, canonical, git, k_ceiling, order, reach, read_transcripts, scoring_area, split_name, @@ -1119,6 +1119,26 @@ def spec_problem(root): return None +def prompt_problem(root): + """Why a run of the round's build trials gave them another prompt than + the one every arm is given, or None when none did.""" + for file in sorted(glob.glob(os.path.join(root, "run-*.json"))): + with io.open(file, encoding="utf-8") as handle: + run = json.load(handle) + if run.get("task", "build") != "build": + continue + + # A run whose trials were all refused or left unfinished put nothing + # in front of the scorer, so its prompt does not matter. + trials = run.get("trials", []) + if not any(record.get("outcome") in SCORABLE for record in trials): + continue + if run.get("prompt") != PROMPT: + return ("%s gave its trials another prompt than the one every " + "arm is given" % os.path.basename(file)) + return None + + 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 @@ -2856,6 +2876,43 @@ def build(arm, trial, digest="registered", outcome="completed"): return checks +def prompt_checks(): + """A round is refused when a build run with something to score gave its + trials another prompt than the one every arm is given.""" + scratch = tempfile.mkdtemp(prefix="efficacy-report-prompt-") + + def problem_for(*runs): + for old in glob.glob(os.path.join(scratch, "run-*.json")): + os.remove(old) + for index, run in enumerate(runs): + with io.open(os.path.join(scratch, "run-%d.json" % index), "w", + encoding="utf-8") as handle: + json.dump(run, handle) + return prompt_problem(scratch) + + def run(prompt=PROMPT, outcome="completed", task="build"): + return {"task": task, "prompt": prompt, + "trials": [{"arm": "none", "trial": 1, "task": task, + "outcome": outcome}]} + + try: + checks = [ + ("every run on the one prompt passes", + problem_for(run(), run()) is None), + ("a run on another prompt is refused", + problem_for(run(), run("Implement SPEC.md.")) is not None), + ("a run recording no prompt is refused", + problem_for(run(None)) is not None), + ("a run whose trials were all refused is not read", + problem_for(run(), run("Implement SPEC.md.", "refused")) is None), + ("a change run, which has its own prompt, is not read", + problem_for(run(), run("Change it.", task="change")) is None), + ] + finally: + shutil.rmtree(scratch, ignore_errors=True) + return checks + + 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 @@ -3717,6 +3774,7 @@ def self_test(seed): checks.extend((label, ok, ok) for label, ok in rescan_checks()) 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()) for label, ok, got in checks: print(" %-52s %s" % (label, "ok" if ok else "FAILED, got %r" % (got,))) @@ -3789,6 +3847,13 @@ def main(argv): print("refused: %s" % problem) return 2 + # The same holds for the prompt: trials given two prompts would read + # as one arm's effect. + problem = prompt_problem(options.root) + 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. From 3d33381ca2a6f00d8e1a62d55ea28825ccffc95f Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:26:49 +0200 Subject: [PATCH 2/2] fix(efficacy): check each trial's prompt, and register round 5b apart Review of #78: the guard read the run's prompt, which reusing a trial overwrites while the trial keeps its own, so it now reads every scorable build trial's. Round 5's registration is fixed once a trial has run, so it is restored as it was, and the prompt change is registered as round 5b, which takes round 5's design whole. The report reads round 5's arms against round 5b's registration. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- docs/architecture/06-runtime-view.md | 7 +- .../architecture/09-architecture-decisions.md | 2 +- docs/primer.md | 3 +- docs/rounds/README.md | 6 +- docs/rounds/round-5.md | 31 ------- docs/rounds/round-5b.md | 52 ++++++++++++ tests/efficacy/report.py | 83 ++++++++++--------- 7 files changed, 108 insertions(+), 76 deletions(-) create mode 100644 docs/rounds/round-5b.md diff --git a/docs/architecture/06-runtime-view.md b/docs/architecture/06-runtime-view.md index 6ba5b81..96f16a1 100644 --- a/docs/architecture/06-runtime-view.md +++ b/docs/architecture/06-runtime-view.md @@ -55,9 +55,10 @@ Every arm gets one prompt, identical for all: > and every page and route in the spec works end to end against the > seed fixture. Commit when done. -The second sentence was added for round 5. A trial runs headless, and the -templates ask for a plan's approval before implementation code, so without it a -templates arm could end its trial with a plan and nothing built. +The second sentence was added for [round 5b](../rounds/round-5b.md). A trial +runs headless, and the templates ask for a plan's approval before implementation +code, so without it a templates arm could end its trial with a plan and nothing +built. **Isolation.** Each trial runs apart from the machine and from the others: diff --git a/docs/architecture/09-architecture-decisions.md b/docs/architecture/09-architecture-decisions.md index 30cd6d7..c737c39 100644 --- a/docs/architecture/09-architecture-decisions.md +++ b/docs/architecture/09-architecture-decisions.md @@ -64,7 +64,7 @@ that mentions the design means the document these chapters replaced. | 2026-10-28 | A template change runs the baseline and the candidate head to head in the candidate's round, with one contrast, `candidate − baseline`, and no `none` arm; round 3 stays a reference without a verdict | A contrast pairing trials from different rounds gets no verdict, so round 3 as the baseline could decide nothing. Two arms answer "is the trim free" at the least cost | — | | 2026-10-28 | From round 5, size reads app code's lines and files against a band of 20 %, smallest change 40 %; test lines are reported without a verdict; docs and configuration leave size; committed generated files count as artifacts nobody asked for | A better solution is often a little bigger, with tests and layering. Round 4's source lines missed templates, and its file count was mostly docs, templates and committed bytecode | — | | 2026-10-29 | A round registers its spec by content, and the harness and the report each refuse a trial built from other content | Each trial recorded the spec's hash but nothing compared it, so an edit during a two-day run would have mixed two specs in one round unseen | — | -| 2026-10-29 | The prompt tells every arm the spec is the approved plan and nobody will answer, and the report refuses a build run on another prompt | Round 5's first start: `inline-1` stopped after its plan, waiting for an approval no headless trial gets | — | +| 2026-10-29 | The prompt tells every arm the spec is the approved plan and nobody will answer, and the report refuses a build trial on another prompt. Round 5 stays as registered and runs again as round 5b | Round 5's first start: `inline-1` stopped after its plan, waiting for an approval no headless trial gets. A registration is fixed once a trial has run, so the change is a registration of its own | — | ¹ This agrees with Anthropic's guidance on context engineering, which asks for the smallest set of high-signal tokens: [Effective context engineering for AI diff --git a/docs/primer.md b/docs/primer.md index 0b8478e..5b6002a 100644 --- a/docs/primer.md +++ b/docs/primer.md @@ -72,7 +72,8 @@ The five arms, the settings of the first knob: | `skills` | A short root file plus one skill per kind of task, loaded when the task needs it | Does a root file with skills deliver what hybrid does | [Round 5's registration](rounds/round-5.md) sets the arms and the questions -they answer. +they answer. [Round 5b](rounds/round-5b.md) runs it, with one sentence added +to the prompt. ### 3.3 Specs diff --git a/docs/rounds/README.md b/docs/rounds/README.md index 0bd8b3c..ca78fb1 100644 --- a/docs/rounds/README.md +++ b/docs/rounds/README.md @@ -8,7 +8,8 @@ trial of that round has run. The rules every round shares are in | Round | Registered | Asks | | ----- | ---------- | ---- | | [Round 4](round-4.md) | Before its first trial, after round 3 | Does a file supply what a thin spec leaves out, and help a weaker model more | -| [Round 5](round-5.md) | 2026-10-26, amended 2026-10-27, 2026-10-28 and twice on 2026-10-29 | Which way of delivering the rules gives the best and most consistent code | +| [Round 5](round-5.md) | 2026-10-26, amended 2026-10-27, 2026-10-28 and 2026-10-29; stopped after its first start | Which way of delivering the rules gives the best and most consistent code | +| [Round 5b](round-5b.md) | 2026-10-29, after round 5 stopped | Round 5's question, with a prompt that tells every arm the spec is the approved plan | ## Reports @@ -22,4 +23,5 @@ repository existed. | 2 | 2026-09-18 | Context file: adds the short and hybrid files | [Report](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-09-18-efficacy.md) | | 3 | 2026-09-27 | Context file: every arm run fresh | [Report](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-09-27-efficacy.md), [assessment of rounds 1 to 3](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-09-27-efficacy-assessment.md) | | 4 | 2026-10-17 | Spec: thin, and builder: Haiku 4.5 | [Summary](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-10-17-round-4.md), [thin spec](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-10-17-efficacy-thin.md), [weaker model](https://github.com/solid-ai-dev/solid-ai-templates/blob/main/docs/audits/2026-10-17-efficacy-weaker.md) | -| 5 | Not run yet | Context file: how the rules are delivered | — | +| 5 | Stopped 2026-10-29, after four trials | Context file: how the rules are delivered | — | +| 5b | Not run yet | Context file: how the rules are delivered | — | diff --git a/docs/rounds/round-5.md b/docs/rounds/round-5.md index a26790d..c51de90 100644 --- a/docs/rounds/round-5.md +++ b/docs/rounds/round-5.md @@ -6,9 +6,6 @@ and once to size the round from the noise of rounds 3 and 4 (#38). Moved here unchanged but for its links, and amended on 2026-10-28, still before any trial, to read code size as app code and test code (#39). Amended on 2026-10-29, still before any trial, to register the specification's content as well as its name. -Amended again on 2026-10-29, after a first start of block A was stopped and its -four trials discarded, to tell every arm the spec is the approved plan (section -13.7). ## 13. Round 5: how the rules are delivered @@ -203,31 +200,3 @@ Why: a better solution is often a little bigger, with tests, error handling and layering, so a small rise should not read as worse. In round 4's trees, tests were 10 to 40 % of the Python lines, and docs, templates and config outnumbered the app's modules, so the old rows measured neither code nor bulk cleanly. - -### 13.7 The prompt - -Amended on 2026-10-29, after a first start of block A. Every arm's prompt gains -one sentence after its first: - -> SPEC.md is the approved plan, and nobody will answer questions during this -> run, so build it to the end without stopping for approval. - -Why: `templates/core/review.md` at `9086e0ff` asks for a plan, and its -approval, before implementation code, unless the requester specified the change -in full. A trial runs headless, so nobody approves. The first start's -`inline-1` printed a plan, cited that rule, and ended after 2 minutes and $0.30 -with nothing built. Without the sentence a -templates arm loses for waiting, not for the code it guides. The sentence goes -to every arm, `none` included, so the context file stays the only difference. - -The first start, from 08:21 to 09:47 on 2026-10-29 in `C:/efficacy/r5-main`: - -| Trial | What happened | -| --- | --- | -| `none-1` | Voided for a command run outside its workspace, then rerun to completion | -| `inline-1` | Stopped after its plan, as above | -| `hybrid-1` | Stopped mid-build when block A was stopped | - -Its four trials count toward nothing. None was scored or judged. Block A -restarts at block 1 in a fresh run root, and the report refuses a build run -whose recorded prompt is not this one. diff --git a/docs/rounds/round-5b.md b/docs/rounds/round-5b.md new file mode 100644 index 0000000..a76e4cd --- /dev/null +++ b/docs/rounds/round-5b.md @@ -0,0 +1,52 @@ +# Round 5b registration + +Registered on 2026-10-29, after round 5's first start was stopped and before any +round-5b trial ran. Round 5's registration stays as it was when its first trial +ran; this one is a registration of its own. + +## 13b. Round 5b: round 5, with the headless prompt + +### 13b.1 What it takes from round 5 + +Round 5b runs [round 5's registration](round-5.md) as it stood at `66d6a1f`, the +commit its first trial ran from, whole: the question, block A, the arms, the +hypotheses H1 to H3 and their margins, K = 15 and the rotated order, the judge, +the code size rows and the spec at its registered sha256. Its verdicts are the +ones round 5 would have read, and they decide what round 5's would have decided, +ADR-058 included. + +One thing differs, the prompt. + +### 13b.2 The prompt + +Every arm's prompt gains one sentence after its first: + +> SPEC.md is the approved plan, and nobody will answer questions during this +> run, so build it to the end without stopping for approval. + +Why: `templates/core/review.md` at `9086e0ff` asks for a plan, and its +approval, before implementation code, unless the requester specified the change +in full. A trial runs headless, so nobody approves. Round 5's `inline-1` +printed a plan, cited that rule, and ended after 2 minutes and $0.30 with +nothing built. Without the sentence a templates arm loses for waiting, not for +the code it guides. The sentence goes to every arm, `none` included, so the +context file stays the only difference. + +The harness records the prompt on every trial, and the report refuses a round +holding a build trial with something to score that was given another prompt. + +### 13b.3 Round 5's start + +Round 5 ran from 08:21 to 09:47 on 2026-10-29, in `C:/efficacy/r5-main`, and +was stopped: + +| Trial | What happened | +| --- | --- | +| `none-1` | Voided for a command run outside its workspace, then rerun to completion | +| `inline-1` | Stopped after its plan, as above | +| `hybrid-1` | Stopped mid-build when the run was stopped | + +None of its trials was scored or judged, and none counts toward round 5b. +Round 5b starts at block 1 in a run root of its own. + +Nothing in this registration changes once a round-5b trial has run. diff --git a/tests/efficacy/report.py b/tests/efficacy/report.py index 9aaee10..9e49d0a 100644 --- a/tests/efficacy/report.py +++ b/tests/efficacy/report.py @@ -45,10 +45,13 @@ HERE = os.path.dirname(os.path.abspath(__file__)) REPOSITORY = os.path.dirname(os.path.dirname(HERE)) -# Round 5's registration, relative to this repository. Its hypotheses bind -# only if they landed on the main branch before its first trial ran and stayed -# unchanged after, so a registration that landed later read the results first. -ROUND5_REGISTRATION = "docs/rounds/round-5.md" +# The registration a run of round 5's arms is read against, relative to this +# repository. Its hypotheses bind only if they landed on the main branch before +# its first trial ran and stayed unchanged after, so a registration that landed +# later read the results first. Round 5 was stopped after its first start and +# runs again as round 5b, which takes round 5's design whole and changes only +# the prompt. +ROUND5_REGISTRATION = "docs/rounds/round-5b.md" # A registration counts once it is on this branch, not on a branch of its own. REGISTRATION_BRANCH = "main" @@ -1120,22 +1123,22 @@ def spec_problem(root): def prompt_problem(root): - """Why a run of the round's build trials gave them another prompt than - the one every arm is given, or None when none did.""" - for file in sorted(glob.glob(os.path.join(root, "run-*.json"))): - with io.open(file, encoding="utf-8") as handle: - run = json.load(handle) - if run.get("task", "build") != "build": + """Why one of the round's build trials was given another prompt than the + one every arm is given, or None when none was.""" + + # Read per trial, not per run: reusing a trial copies its record, with + # its own prompt, into a run that names the current one. + for record in run_records(root): + if record.get("task", "build") != "build": continue - # A run whose trials were all refused or left unfinished put nothing - # in front of the scorer, so its prompt does not matter. - trials = run.get("trials", []) - if not any(record.get("outcome") in SCORABLE for record in trials): + # A refused or unfinished trial put nothing in front of the scorer, + # so its prompt does not matter. + if record.get("outcome") not in SCORABLE: continue - if run.get("prompt") != PROMPT: - return ("%s gave its trials another prompt than the one every " - "arm is given" % os.path.basename(file)) + if record.get("prompt") != PROMPT: + return ("trial %s was given another prompt than the one every " + "arm is given" % trial_of(record)) return None @@ -2877,36 +2880,40 @@ def build(arm, trial, digest="registered", outcome="completed"): def prompt_checks(): - """A round is refused when a build run with something to score gave its - trials another prompt than the one every arm is given.""" + """A round is refused when a build trial with something to score was + given another prompt than the one every arm is given, or records none.""" scratch = tempfile.mkdtemp(prefix="efficacy-report-prompt-") + old_prompt = "Implement SPEC.md." - def problem_for(*runs): + def problem_for(*trials, run_prompt=PROMPT): for old in glob.glob(os.path.join(scratch, "run-*.json")): os.remove(old) - for index, run in enumerate(runs): - with io.open(os.path.join(scratch, "run-%d.json" % index), "w", - encoding="utf-8") as handle: - json.dump(run, handle) + with io.open(os.path.join(scratch, "run-1.json"), "w", + encoding="utf-8") as handle: + json.dump({"task": "build", "prompt": run_prompt, + "trials": list(trials)}, handle) return prompt_problem(scratch) - def run(prompt=PROMPT, outcome="completed", task="build"): - return {"task": task, "prompt": prompt, - "trials": [{"arm": "none", "trial": 1, "task": task, - "outcome": outcome}]} + def trial(prompt=PROMPT, outcome="completed", task="build"): + record = {"arm": "none", "trial": 1, "task": task, "outcome": outcome} + if prompt is not None: + record["prompt"] = prompt + return record try: checks = [ - ("every run on the one prompt passes", - problem_for(run(), run()) is None), - ("a run on another prompt is refused", - problem_for(run(), run("Implement SPEC.md.")) is not None), - ("a run recording no prompt is refused", - problem_for(run(None)) is not None), - ("a run whose trials were all refused is not read", - problem_for(run(), run("Implement SPEC.md.", "refused")) is None), - ("a change run, which has its own prompt, is not read", - problem_for(run(), run("Change it.", task="change")) is None), + ("every trial on the one prompt passes", + problem_for(trial(), trial()) is None), + ("a trial on another prompt is refused", + problem_for(trial(), trial(old_prompt)) is not None), + ("so is one reused into a run naming the current prompt", + problem_for(trial(old_prompt), run_prompt=PROMPT) is not None), + ("a scorable trial recording no prompt is refused", + problem_for(trial(None)) is not None), + ("a refused trial, which built nothing, is not read", + problem_for(trial(), trial(old_prompt, "refused")) is None), + ("a change task, which has its own prompt, is not read", + problem_for(trial(), trial("Change it.", task="change")) is None), ] finally: shutil.rmtree(scratch, ignore_errors=True)