From ecdc91d5742e33f3df10f27eab0a9d9f844881d8 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:55:27 +0200 Subject: [PATCH 1/3] ci: run every self-test and pyflakes against a templates checkout (#6) Closes #6 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- .github/workflows/self-tests.yml | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/self-tests.yml diff --git a/.github/workflows/self-tests.yml b/.github/workflows/self-tests.yml new file mode 100644 index 0000000..7d9c743 --- /dev/null +++ b/.github/workflows/self-tests.yml @@ -0,0 +1,64 @@ +name: Self-tests + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + self-tests: + # The owner runs on Windows and the self-tests take both the Windows and the + # POSIX paths, so each is proved on its own runner. + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + env: + BENCHMARK_TEMPLATES: ${{ github.workspace }}/solid-ai-templates + steps: + - uses: actions/checkout@v4 + with: + path: solid-ai-benchmark + + # The benchmark carries no templates, so every self-test names a clone of + # them. A self-test makes no model call, so it needs no secret. + - uses: actions/checkout@v4 + with: + repository: solid-ai-dev/solid-ai-templates + path: solid-ai-templates + + # The interpreter every scored trial runs under. + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + # The self-tests commit in scratch workspaces, which needs an identity. + - name: Configure git + run: | + git config --global user.name "CI" + git config --global user.email "ci@example.invalid" + + - name: Install pyflakes + run: python -m pip install --disable-pip-version-check pyflakes + + - name: Run every self-test + working-directory: solid-ai-benchmark + run: | + set -e + for module in harness generate_arm score judge report archive reuse \ + security control/control; do + echo "::group::$module" + python "tests/efficacy/$module.py" --self-test + echo "::endgroup::" + done + + - name: Pyflakes + working-directory: solid-ai-benchmark + run: python -m pyflakes tests From f8222027748c052c279dc014d52a598745753232 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:59:16 +0200 Subject: [PATCH 2/3] fix(efficacy): put self-test scratch in the system temp directory, fetch the templates' tags in CI Outside Windows TEMP is unset, and the fallback '.' gave a relative scratch path that broke once a planted CLI ran with the scratch as its working directory. tempfile.gettempdir() is TEMP on Windows, so the owner's runs are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- .github/workflows/self-tests.yml | 3 +++ tests/efficacy/harness.py | 24 ++++++++++++------------ tests/efficacy/judge.py | 3 ++- tests/efficacy/report.py | 14 +++++++------- tests/efficacy/reuse.py | 3 ++- tests/efficacy/score.py | 3 ++- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/self-tests.yml b/.github/workflows/self-tests.yml index 7d9c743..b411c07 100644 --- a/.github/workflows/self-tests.yml +++ b/.github/workflows/self-tests.yml @@ -33,6 +33,9 @@ jobs: with: repository: solid-ai-dev/solid-ai-templates path: solid-ai-templates + # The arms are built from registered tags, such as the baseline's + # v2.90.0, so the clone needs its full history and tags. + fetch-depth: 0 # The interpreter every scored trial runs under. - uses: actions/setup-python@v5 diff --git a/tests/efficacy/harness.py b/tests/efficacy/harness.py index db36f05..63e7b48 100644 --- a/tests/efficacy/harness.py +++ b/tests/efficacy/harness.py @@ -1850,7 +1850,7 @@ def outcome_checks(): classify(status, result)[0] == expected) for label, status, result, expected in ENDINGS] - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-void-self-test") shutil.rmtree(scratch, ignore_errors=True) workspace = os.path.join(scratch, "none-1") @@ -2065,7 +2065,7 @@ def change_checks(): "`caps`", "/invoices/preview"))), ] - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-change-self-test") remove_tree(scratch) build = os.path.join(scratch, "A1") @@ -2127,7 +2127,7 @@ def dry_run_checks(): the run record offering it. The generator is a stand-in on `PATH` and the home a scratch one, so no real CLI or credential is reached. """ - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-dry-run-self-test") remove_tree(scratch) root = os.path.join(scratch, "root") @@ -2211,7 +2211,7 @@ def dry_run_checks(): def credential_checks(): """A trial's Git cannot borrow a credential the machine stores.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-credential-self-test") remove_tree(scratch) os.makedirs(scratch) @@ -2245,7 +2245,7 @@ def answers(env): def process_checks(): """A process running from a trial's directory is stopped, and no other.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-process-self-test") owned = os.path.join(scratch, "none-1") neighbour = os.path.join(scratch, "none-10") @@ -2313,7 +2313,7 @@ def claimed_pid(path): def claim_checks(): """A live run refuses a second; an ended or reused one is taken over.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-claim-self-test") remove_tree(scratch) live = planted_run("judge.py") @@ -2389,7 +2389,7 @@ def claim_refusal_check(tool, main, root, *extra): def leftover_checks(): """A temp entry a trial made and named moves to its own; nothing else.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-leftover-self-test") remove_tree(scratch) shared = os.path.join(scratch, "shared") @@ -2434,7 +2434,7 @@ def leftover_checks(): def reach_checks(): """A tool call fetching the templates is flagged; reading them is not.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-reach-self-test") remove_tree(scratch) home = os.path.join(scratch, "home") @@ -2493,7 +2493,7 @@ def reach_checks(): def outside_checks(): """A call into another part of the run is flagged; the trial's own workspace and temporary directory are not.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-outside-self-test") remove_tree(scratch) root = os.path.abspath(os.path.join(scratch, "run")) @@ -2602,7 +2602,7 @@ def alive(pid): def hang_checks(): """A CLI that lingers after its result, or never answers, is ended with everything under it, and what it printed is kept.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-hang-self-test") remove_tree(scratch) os.makedirs(scratch) @@ -2637,7 +2637,7 @@ def hang_checks(): def credential_link_checks(): """The scratch home reads the account's live credentials, and gets them back before a trial where they went missing.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-credential-link-self-test") remove_tree(scratch) real = os.path.join(os.path.expanduser("~"), CREDENTIALS) @@ -2663,7 +2663,7 @@ def vendor_checks(): if templates_root(required=False) is None: return [("a templates source is set in %s, so the vendoring can be " "proved" % TEMPLATES_ENV, False)] - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-vendor-self-test") remove_tree(scratch) workspace = os.path.join(scratch, "hybrid-1") diff --git a/tests/efficacy/judge.py b/tests/efficacy/judge.py index d687ede..1f60a72 100644 --- a/tests/efficacy/judge.py +++ b/tests/efficacy/judge.py @@ -26,6 +26,7 @@ import re import shutil import sys +import tempfile sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -1325,7 +1326,7 @@ def claim_checks(scratch): def self_test(): """Prove a bundle is blind and carries its tree's own specification, labels continue, the judge launches, and a live run refuses a second.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-judge-self-test") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) diff --git a/tests/efficacy/report.py b/tests/efficacy/report.py index eac9e63..5b49cfb 100644 --- a/tests/efficacy/report.py +++ b/tests/efficacy/report.py @@ -2543,7 +2543,7 @@ def parse_args(argv): def reach_checks(): """The report names a trial whose scan hit, and no other.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-reach-self-test") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) @@ -2578,7 +2578,7 @@ def reach_checks(): def lost_checks(): """A voided trial is listed whether or not a run record names it.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + 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") @@ -2627,7 +2627,7 @@ def lost_checks(): def rescan_checks(): """A record scanned under an earlier rule is read again from its transcript.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-rescan-self-test") shutil.rmtree(scratch, ignore_errors=True) workspace = os.path.join(scratch, "none-2") @@ -2756,7 +2756,7 @@ def escalation_checks(seed): checks.append(("a K = 3 run is assessed on its own vector", state == "assessed", state)) - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-escalation-self-test") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) @@ -2815,7 +2815,7 @@ def posthoc_checks(seed): posthoc_owed(trials) and not posthoc_owed(probed), (posthoc_owed(trials), posthoc_owed(probed)))) - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-posthoc-self-test") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) @@ -2867,7 +2867,7 @@ def rendered(trials, seed, withdrawn): results = contrasts(table, seed, crossed_labels(trials)) before = results["change_success"]["full-none"]["verdict"] withdraw(withdrawn, table, results) - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-withdrawal-render") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) @@ -2891,7 +2891,7 @@ def section_rows(text, heading, label): def withdrawal_checks(seed): """A withdrawn metric prints only its withdrawal, and only on runs graded by the revision it was withdrawn for.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-report-withdrawal-self-test") shutil.rmtree(scratch, ignore_errors=True) os.makedirs(scratch) diff --git a/tests/efficacy/reuse.py b/tests/efficacy/reuse.py index 80e7dea..998a8b1 100644 --- a/tests/efficacy/reuse.py +++ b/tests/efficacy/reuse.py @@ -19,6 +19,7 @@ import os import shutil import sys +import tempfile sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -260,7 +261,7 @@ def plant_source(scratch): def self_test(): """Prove a reuse copies the chosen arms' trials, and only those, under the words, and refuses to offer a trial twice.""" - scratch = os.path.join(os.environ.get("TEMP", "."), + scratch = os.path.join(tempfile.gettempdir(), "efficacy-reuse-self-test") remove_tree(scratch) source = plant_source(scratch) diff --git a/tests/efficacy/score.py b/tests/efficacy/score.py index b73b6b7..2f21b33 100644 --- a/tests/efficacy/score.py +++ b/tests/efficacy/score.py @@ -29,6 +29,7 @@ import subprocess import sys import tarfile +import tempfile sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -1664,7 +1665,7 @@ def self_test(): missing with a reason. Any that comes back zero is a scorer reporting a clean trial it never read. """ - scratch = os.path.join(os.environ.get("TEMP", "."), "efficacy-self-test") + scratch = os.path.join(tempfile.gettempdir(), "efficacy-self-test") remove_tree(scratch) os.makedirs(scratch) checks = (run_record_checks(scratch) + churn_checks(scratch) From fa7024df58b49af7f7ea2eb8fe36d276fd72b8ac Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Wed, 28 Oct 2026 09:01:12 +0200 Subject: [PATCH 3/3] ci: stand stub agent CLIs in for claude and codex Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- .github/workflows/self-tests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/self-tests.yml b/.github/workflows/self-tests.yml index b411c07..1a949a5 100644 --- a/.github/workflows/self-tests.yml +++ b/.github/workflows/self-tests.yml @@ -48,6 +48,22 @@ jobs: git config --global user.name "CI" git config --global user.email "ci@example.invalid" + # The self-tests build a trial's command line, which resolves the agent CLIs + # on PATH, but never launch one. Stubs that refuse to run stand in for them, + # so no model can be called. + - name: Put stub agent CLIs on PATH + run: | + stubs="$RUNNER_TEMP/stub-cli" + mkdir -p "$stubs" + for cli in claude codex; do + printf '#!/bin/sh\necho "%s is a CI stub" >&2\nexit 1\n' "$cli" \ + > "$stubs/$cli" + chmod +x "$stubs/$cli" + printf '@echo %s is a CI stub 1>&2\r\n@exit /b 1\r\n' "$cli" \ + > "$stubs/$cli.cmd" + done + echo "$stubs" >> "$GITHUB_PATH" + - name: Install pyflakes run: python -m pip install --disable-pip-version-check pyflakes