Repository navigation
test(evals): migrate the suite runners to scenarios - #204
Conversation
|
Warning Review limit reachedNext included review available in 25 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The eight per-suite runner test files asserted what a runner does to a
model's answer. Seven of them did it against an `InMemory*Runner` subclass
that overrode `run()` with its own implementation, so they were largely
testing a copy — and the copy had guards the product does not.
`tests/evals/suite-runners.scenario.test.ts` drives the real runners through
`EvalOrchestrator` + `buildEvalRunner`, the pair `commands/eval.ts` builds,
with a scenario-owned fixture root and only the model and the LLM judge
stubbed. It asserts the exit code, `score-<suite>.json`, `public-report.*`
and the opt-in raw artifacts.
Unit cases 464 -> 47 in source (533 -> 60 at runtime); 56 scenarios added,
323 at runtime. `weft-review`, `warp-security` and `spindle-tools` runner
tests are gone entirely. What stays reads the repository's own fixture
corpus, or feeds only the LLM judge, and each kept file says so in its
docblock.
Eighteen mutations were run against `tests/evals` alone with the deleted
unit tests already gone; fifteen were caught, and the three survivors are
each masked by a second guard (the two raw-artifact gates, and the bundle
writer's allowlist). Breaking both raw-artifact gates together does turn
scenarios red.
Writing against observed behaviour turned up four things:
- `--model` with no matching fixture publishes an empty *green* run on
`loom-routing` and `tapestry-execution` — full bundle, `suiteGreen: true`,
dashboard indexes updated, exit 0. The other six suites fail closed. Both
runners' unit tests claimed `NoCasesFound`, against the in-memory copy.
- The category-routing qualitative gate averages in two dimensions that are
inapplicable on a routing case and scored 1.0, so only a judge verdict
below 0.1 can fail it; 0.2 passes.
- An answer containing the doc placeholder `-> shuttle-{category}` still
earns 0.4 generic-fallback credit, although the affirmative-route reader
rejects it.
- `ShuttleExecutionRunner`'s `NoCasesFound` message is the only one that
does not name its suite.
Refs #183 (task group 14).
Claude-Session: https://claude.ai/code/session_01DisVZW27sd6Pe7uhbjXNve
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
9b6cd0a to
05369d4
Compare
|
Reviewed, and I verified both headline findings independently rather than taking them on trust. Finding 1 confirmed, and it is the strongest result of this whole effort. Seven of the eight files subclass the real runner and 464 cases exercising a reimplementation. Finding 2 confirmed, and the two findings are the same story. The damning part is where the missing guard does exist. Filed as #205 with the verification, three fix options and the two related findings (the near-inert qualitative gate, the doc placeholder scoring 0.4). I have rebased this onto main. Both Nothing else to change. Merging when green. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (3)
What changed in this PR
Migrates eval suite-runner coverage to black-box scenarios, advancing #183 task group 14.
Changes:
- Adds end-to-end suite-runner scenarios and shared fixture/run helpers.
- Removes duplicated in-memory runner tests while retaining targeted unit coverage.
- Documents migration counts, mutation results, and discovered defects.
| File | Description |
|---|---|
| tests/support/evals.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/weft-review-runner.test.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/warp-security-runner.test.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/tapestry-execution-runner.test.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/spindle-tools-runner.test.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/shuttle-execution-runner.test.ts | Updated as part of this pull request. |
| packages/cli/src/evals/__tests__/pattern-planning-runner.test.ts | Updated as part of this pull request. |
| docs/testing-strategy.md | Updated as part of this pull request. |
| docs/artifacts/cli-evals-migration-handoff.md | Updated as part of this pull request. |
| .codesight/graph.md | Updated as part of this pull request. |
| .codesight/coverage.md | Updated as part of this pull request. |
| .codesight/CODESIGHT.md | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const raw = run.rawArtifacts[0]; | ||
|
|
||
| expect(run.rawArtifacts).toHaveLength(1); | ||
| expect(raw?.composedPrompt).toBe(PROMPT); | ||
| expect(raw?.rawContent).toBe(probe.goodAnswer); | ||
| expect(raw?.transcript.at(-1)?.content).toBe(probe.goodAnswer); | ||
|
|
| options: SuiteRunOptions, | ||
| ): Promise<SuiteRunObservation> { | ||
| const model = options.model ?? EVAL_MODEL; | ||
| const bundleRoot = await mkdtemp(join(tmpdir(), "weave-evals-run-")); |
| const files = absolute.map((path) => relative(bundleRoot, path)); | ||
| const scorePaths = absolute.filter((path) => /score-[^/]+\.json$/.test(path)); | ||
| const rawPaths = absolute.filter((path) => /\/raw\/case-/.test(path)); |
| describe("the model is unreachable mid-run", () => { | ||
| const NETWORK_ERROR = { | ||
| type: "NetworkError" as const, | ||
| message: "connect ECONNREFUSED with Bearer sk-or-v1-abcdef0123456789", |
| await mkdir(join(root, "cases", spec.suite), { recursive: true }); | ||
| await mkdir(join(root, "rubrics", spec.suite), { recursive: true }); |
…206) InMemoryTapestryRunner extended TapestryExecutionRunner and overrode run() with ~140 lines of its own, including a verbatim copy of normalizeDelegationChain() named normalizeDelegationChainForTest. Its two tests asserted that copy, so they described a product that need not exist. The proof: replacing the real condition with if (false), which disables alternate-delegate normalization outright, leaves all 32 unit tests green — including the one named "normalizes accepted alternate shuttle variants back to the canonical expected delegate". What replaces them is a scenario against the real runner. The premise that kept the double — that a delegation chain "has no observable form, because in production the judge is an LLM" — was false. The judge is stubbed at the scenario seam, so judgeCalls shows exactly what the runner asked it to score, and the runner serialises the chain into that input itself, after normalizing it. Four scenarios cover the transform, and the third is the contrast that keeps the second honest: the same answer and the same expected chain, with only accepted_alternates removed. Both directions are mutation-proved. if (true) turns the contrast scenario red; if (false) turns the normalization scenario red; each is caught by exactly one. This was the last instance in the repo. #203 and #204 removed seven others while migrating their areas. The remaining test subclasses (SymlinkFileSystem, FailingProbes, Mock/FailingOpenCodeAdapter) override a collaborator rather than the unit under test, which is the legitimate use and stays. Recorded as finding 11 in docs/testing-strategy.md, with the rule it gives us: a double may stand in for a dependency, never for the unit under test. Refs #183 (task group 14), #205 Claude-Session: https://claude.ai/code/session_01DisVZW27sd6Pe7uhbjXNve Co-authored-by: Claude Opus 5 <noreply@anthropic.com>


Migrates the eight per-suite eval runners from white-box unit tests to
black-box scenarios, continuing the work in #183 (task group 14).
What a user observes here
A runner turns a model's answer into a scored, published run. The new file
tests/evals/suite-runners.scenario.test.tsdrives the real runners through
EvalOrchestrator+buildEvalRunner— thepair
packages/cli/src/commands/eval.tsconstructs once it has an API key —against a scenario-owned fixture root in a temp directory. Only the two
external services are stubbed, the model client and the LangChain judge.
Everything else runs: fixture loading, signal extraction, scoring, bundle
assembly, artifact writing. The assertions are on the exit code,
score-<suite>.json,public-report.*and the opt-in raw artifacts.Two facts make this deterministic enough to assert on:
agent_routingcases scoreroutingCorrectnessfrom the routed agents,with no judge involved.
task_completioncases taggedjudgmentscoreexecutionCompletenessfrom produced artifacts against
required_artifacts.Signals that reach only the judge — a delegation chain, a completion cue —
have no observable form, and that is the line between what moved and what
stayed.
Counts
Source cases, with runtime in brackets (a table-driven
it.eachis one sourcecase and many at runtime):
weft-review-runner.test.ts,warp-security-runner.test.tsandspindle-tools-runner.test.tsare gone entirely.What stayed, and why
Each kept file says this in its docblock:
EVALS_ROOT. A scenario brings its own corpus, so it cannot notice a real fixture drifting away from itstarget_agentextractDelegationChain,detectCompletionSignal,extractProducedArtifactsscoreExecutionCompleteness, the no-scorer routing gateextractAcceptanceCriteriaMutation testing
Eighteen mutations, run against
tests/evalsalone with every deleted unittest already gone:
buildEvalRunneralways exits 0--raw-artifactsCaseResultSummarycarriesrawContent)The two survivors are defence in depth rather than gaps: raw text reaches disk
only if the runner builds the artifact and the orchestrator writes it, and an
unknown field on a summary is dropped by the bundle writer's allowlist. Two
scenarios were added mid-way because the first version of the mutation run
showed an absence assertion could not fail.
Defects this turned up
Seven of the eight runner test files were testing a copy of the runner.
InMemoryLoomRunner,InMemoryWeftRunnerand their siblings extended the realclass and then
override run()with their own implementation. The copiesdiverged from the product and nothing noticed:
--modelwith no matching fixture publishes an empty green run onloom-routingandtapestry-execution. Both guard an empty case list butnot an empty work item list, so the run writes a full bundle with
totalCases: 0,suiteGreen: true, updates the dashboard indexes and exits0. A typo'd
--modelreads as success in CI. The other six suites returnNoCasesFoundand exit 1. Both runners' unit tests assertedNoCasesFound—against the in-memory copy, which does carry the guard.
mergeWithScorerDimensions()averagesdelegationCorrectness,executionCompletenessandrationaleQualityand requires 0.7, but on anagent_routingcase the first two are never applicable and an inapplicabledimension is scored 1.0. Only a judge verdict below 0.1 can fail the gate;
0.2 passes. The unit test that claimed otherwise fed a hand-built record the
real scorer cannot produce.
containing
→ \shuttle-{category}`` is rejected by the affirmative-routereader — the property its unit test pinned — but the generic-fallback
detector still reads the line, so the case scores 0.4 rather than 0.
ShuttleExecutionRunner'sNoCasesFoundmessage is the only one that doesnot name its suite.
All four are recorded as scenarios pinning the observed behaviour, with a
comment saying which are defects. None is fixed here — each is a product
decision.
Checks
bun run test(5,653 pass),bunx tsc --noEmit -p tsconfig.json,bun run lint,bun run docs:check-links,bun run verify:test-coverage.Docs updated:
docs/testing-strategy.md(counts, kept/deleted table, mutation table, findings) and
docs/artifacts/cli-evals-migration-handoff.md(notes for the next session, including the two gates and the allowlist).
Refs #183 (task group 14).
🤖 Generated with Claude Code
https://claude.ai/code/session_01DisVZW27sd6Pe7uhbjXNve