Skip to content

test(addie): harden variant eval runner — assertChanged + N≥3 runs - #3630

Merged
bokelley merged 2 commits into
mainfrom
bokelley/variant-eval-hardening
Apr 30, 2026
Merged

bokelley merged 2 commits into
mainfrom
bokelley/variant-eval-hardening

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Two follow-ups from the prompt-engineer review of #3601:

  1. assertChanged on variant transforms. Each variant declares an expectedSizeVsBaseline ('same' | 'smaller' | 'larger' | 'any'); the runner validates actual prompt size before any API calls. Silent no-op transforms (e.g., a future rule edit renames a heading stripBehaviorsSection targeted) now fail loud instead of producing misleading "no signal" eval results.
  2. RUNS_PER_QUESTION env var. Defaults to 1 (matches original integer-count behavior). Set to 3+ to rerun each question multiple times and aggregate as fractional fires-per-question. AnyViol uses a majority-vote framing — a question counts only if ≥50% of its runs hit any violation, so a 1/3-flake reads differently from a 3/3-consistent fire.
  3. Heavy column added for the structuredHeavy metric introduced in feat(addie): real-prompt shadow eval + shape grader + style-last prompt order #3601 (default-template criteria minus the closing-question requirement) — the prompt-engineer flagged that this metric was tracked internally but not surfaced in the comparison table.

Validated

  • unset ANTHROPIC_API_KEY && npx tsx server/tests/manual/prompt-variant-eval.ts — variant validation passes; size deltas printed.
  • ONLY_VARIANTS=A RUNS_PER_QUESTION=2 npx tsx server/tests/manual/prompt-variant-eval.ts — 24 Haiku calls, output reads correctly with fractional cells (9.0/12) and per-run Katie response printout (Run 1/2, Run 2/2).
  • npx tsc --noEmit clean.

Why now

The shape grader and corrected-capture pipeline shipped in #3601 make future variant evals cheap. Without these guardrails the next experiment would have a real risk of either (a) silently running a no-op transform and reporting "no signal" or (b) misreading single-run noise as variant-driven change. Both surface as "calibration follow-ups, easy" — landing them while the context is fresh.

🤖 Generated with Claude Code

bokelley and others added 2 commits April 29, 2026 23:52
Two follow-ups from the prompt-engineer review of PR #3601:

assertChanged: each variant declares expectedSizeVsBaseline ('same' |
'smaller' | 'larger' | 'any'). The runner validates actual prompt size
against the declaration BEFORE any API calls so a silent no-op transform
fails loud. Specific failure mode the engineer flagged: a future rule
edit renames a heading that stripBehaviorsSection targets, the strip
silently no-ops, and the eval reports "no signal" — looking like the
rule doesn't matter when the experiment never actually ran.

RUNS_PER_QUESTION: defaults to 1 (matches the original integer-count
behavior). Set to 3+ to rerun each question multiple times per variant
and aggregate fires-per-question as fractions. AnyViol uses majority-vote
framing — a question counts only if ≥50% of its runs hit any violation,
so a 1/3-flake reads differently from a 3/3-consistent fire. Adds a
Heavy column to the comparison table for the structuredHeavy metric
(default-template criteria minus the closing-question requirement) that
the prompt-engineer flagged was missing visibility.

Validated end-to-end with `ONLY_VARIANTS=A RUNS_PER_QUESTION=2` against
Haiku — 24 calls, output reads correctly with fractional cells and
per-run Katie response printout.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Guard `parseInt` against `RUNS_PER_QUESTION=foo` falling through to
  `Math.max(1, NaN) = NaN`, which would silently break the run loop.
- Use `Array.find` instead of looping all variants to read just `A`.
- Document the failed-run / empty-response handling in the aggregation
  block (intentionally graded as non-fire, not skipped).
- Drop redundant `Math.round` in `fmtHits` for the N=1 path — the values
  are already integers.
- Comment why per-run printout suppresses the response body when N>1
  (so a future reader doesn't "fix" it).

Pre-merge code-reviewer pass on PR #3630.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit a6a1dd3 into main Apr 30, 2026
10 checks passed
@bokelley
bokelley deleted the bokelley/variant-eval-hardening branch April 30, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant