Repository navigation
test(addie): harden variant eval runner — assertChanged + N≥3 runs - #3630
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two follow-ups from the prompt-engineer review of #3601:
assertChangedon variant transforms. Each variant declares anexpectedSizeVsBaseline('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 headingstripBehaviorsSectiontargeted) now fail loud instead of producing misleading "no signal" eval results.RUNS_PER_QUESTIONenv 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.Heavycolumn added for thestructuredHeavymetric 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 --noEmitclean.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