test(evals): pin the unknown client rejection and eval bytecode #252

Merged
claudiomaradonna merged 2 commits from unknown-client-pycache into main 2026-11-23 18:32:44 +01:00
Collaborator

Why

The eval graders decide whether an attempt earned its grade, so they
must fail closed: an attempt whose client file is corrupted or names
a client no reader exists for has to be rejected, not graded by the
wrong reader. That rejection exists in evals/evidence.py but no test
asserted it, so a relaxed check kept every suite green. The same
maintainer's git add -A could also stage a stale compiled copy of
that security-boundary reader, because .gitignore carried no Python
bytecode rule; issue #249 recorded one such copy reaching a draft
commit before review caught it.

Closes #250
Closes #249

What changed

The grader suite now asserts the rejection: a case writes a client
file naming a value outside the accepted set into an attempt and checks
that python3 evals/evidence.py client <attempt> exits 1 printing
evidence: unknown client. Dropping or widening client()'s check
turns the suite red. The case is a pin of kept behavior: evidence.py
is unchanged, and the case passes on the base and on the tip.

The source now git-ignores Python bytecode: .gitignore gains a
__pycache__/ rule, guarded by a real-source test asserting
git check-ignore covers evals/__pycache__/evidence.cpython-314.pyc.
The guard checks that path rather than the bare directory name because
the directory-only pattern never matches a nonexistent directory name.

How to verify

From a fresh checkout, base f121a4b and branch unknown-client-pycache
(71effb5, 6930f9c):

  • Bytecode ignored: at the base, python3 -m py_compile evals/evidence.py && git status --porcelain lists
    ?? evals/__pycache__/; at the tip the same commands list nothing,
    and git check-ignore -q evals/__pycache__/evidence.cpython-314.pyc
    exits 0. Run each.
  • The rejection case: at the tip, bash tests/agent-config/evals-graders.sh
    prints ok - evidence rejects a client file naming an unknown value
    (70/70, run); at the base the same suite passes 69/69 without that
    case (run, in the proof worktree with the tip's area file, to show the
    case passes on unchanged code). The CLI itself behaves identically on
    both revisions: a client file holding fictional yields exit 1 and
    evidence: unknown client (run on both).
  • The guard's regression: at the base with the tip's
    tests/agent-config/real-source.sh, the area fails only on
    not ok - the source git-ignores Python bytecode... (run); at the
    tip the area passes 9/9 (run).
  • Full gates: bash tests/verify-agent-config.sh 347/347,
    .agents/hooks/shellcheck.sh repo 51 files clean,
    prettier --check '**/*.md', scripts/verify-agent-config.sh
    statically valid, git diff --check main clean — all run on the tip.

Considerations

  • The guard names one fixture-shaped filename,
    evidence.cpython-314.pyc; git check-ignore matches on the
    directory rule, so the concrete name only makes the scenario
    readable, not interpreter-version dependent.
  • Behavioral evals stay maintainer-run and were not run: the change
    adds a deterministic local case and an ignore rule, and touches no
    policy or skill text.
## Why The eval graders decide whether an attempt earned its grade, so they must fail closed: an attempt whose `client` file is corrupted or names a client no reader exists for has to be rejected, not graded by the wrong reader. That rejection exists in `evals/evidence.py` but no test asserted it, so a relaxed check kept every suite green. The same maintainer's `git add -A` could also stage a stale compiled copy of that security-boundary reader, because `.gitignore` carried no Python bytecode rule; issue #249 recorded one such copy reaching a draft commit before review caught it. Closes #250 Closes #249 ## What changed The grader suite now asserts the rejection: a case writes a `client` file naming a value outside the accepted set into an attempt and checks that `python3 evals/evidence.py client <attempt>` exits 1 printing `evidence: unknown client`. Dropping or widening `client()`'s check turns the suite red. The case is a pin of kept behavior: `evidence.py` is unchanged, and the case passes on the base and on the tip. The source now git-ignores Python bytecode: `.gitignore` gains a `__pycache__/` rule, guarded by a real-source test asserting `git check-ignore` covers `evals/__pycache__/evidence.cpython-314.pyc`. The guard checks that path rather than the bare directory name because the directory-only pattern never matches a nonexistent directory name. ## How to verify From a fresh checkout, base `f121a4b` and branch `unknown-client-pycache` (`71effb5`, `6930f9c`): - Bytecode ignored: at the base, `python3 -m py_compile evals/evidence.py && git status --porcelain` lists `?? evals/__pycache__/`; at the tip the same commands list nothing, and `git check-ignore -q evals/__pycache__/evidence.cpython-314.pyc` exits 0. Run each. - The rejection case: at the tip, `bash tests/agent-config/evals-graders.sh` prints `ok - evidence rejects a client file naming an unknown value` (70/70, run); at the base the same suite passes 69/69 without that case (run, in the proof worktree with the tip's area file, to show the case passes on unchanged code). The CLI itself behaves identically on both revisions: a `client` file holding `fictional` yields exit 1 and `evidence: unknown client` (run on both). - The guard's regression: at the base with the tip's `tests/agent-config/real-source.sh`, the area fails only on `not ok - the source git-ignores Python bytecode...` (run); at the tip the area passes 9/9 (run). - Full gates: `bash tests/verify-agent-config.sh` 347/347, `.agents/hooks/shellcheck.sh repo` 51 files clean, `prettier --check '**/*.md'`, `scripts/verify-agent-config.sh` statically valid, `git diff --check main` clean — all run on the tip. ## Considerations - The guard names one fixture-shaped filename, `evidence.cpython-314.pyc`; `git check-ignore` matches on the directory rule, so the concrete name only makes the scenario readable, not interpreter-version dependent. - Behavioral evals stay maintainer-run and were not run: the change adds a deterministic local case and an ignore rule, and touches no policy or skill text.
fix(gitignore): keep compiled eval readers untracked
All checks were successful
Maintenance / checks (pull_request) Successful in 7m29s
Maintenance / checks (push) Successful in 6m21s
6930f9c674
claudiomaradonna deleted branch unknown-client-pycache 2026-11-23 18:32:55 +01:00
Sign in to join this conversation.
No description provided.