Skip to content

test(evals): migrate the suite runners to scenarios - #204

Merged
pgermishuys merged 1 commit into
mainfrom
test/evals-runners-migration
Sep 21, 2026
Merged

pgermishuys merged 1 commit into
mainfrom
test/evals-runners-migration

Conversation

@pgermishuys

Copy link
Copy Markdown
Contributor

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.ts
drives the real runners through EvalOrchestrator + buildEvalRunner — the
pair packages/cli/src/commands/eval.ts constructs 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_routing cases score routingCorrectness from the routed agents,
    with no judge involved.
  • task_completion cases tagged judgment score executionCompleteness
    from 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.each is one source
case and many at runtime):

Before After
Unit files 8 5
Unit cases 464 (533) 47 (60)
Scenarios — 56 (323)

weft-review-runner.test.ts, warp-security-runner.test.ts and
spindle-tools-runner.test.ts are gone entirely.

What stayed, and why

Each kept file says this in its docblock:

Kept Why
Loom's boundary-matrix block, Shuttle's structural cases, the tcr-04/tcr-10 block They read the repository's own fixture corpus from disk with the production EVALS_ROOT. A scenario brings its own corpus, so it cannot notice a real fixture drifting away from its target_agent
extractDelegationChain, detectCompletionSignal, extractProducedArtifacts They feed the judge's prompt and nothing else; in production the judge is an LLM
scoreExecutionCompleteness, the no-scorer routing gate Local heuristics used only when no scorer is injected. The orchestrator always injects one
extractAcceptanceCriteria The criteria list is never published — only the derived signal is, and a miscollected criterion can still produce the right one
tcr's qualitative-gate and routing-override cases Both need a score record the real scorer cannot produce for a routing case; they pin a contract for a future scorer

Mutation testing

Eighteen mutations, run against tests/evals alone with every deleted unit
test already gone:

Mutation Result
Loom scores every mentioned agent, not the primary route 10 red
A generic-shuttle fallback scores 1.0 instead of 0.4 13 red
buildEvalRunner always exits 0 22 red
Weft's prompt-provider failure falls back to a prompt 3 red
Shuttle never flags an unobserved pass claim 3 red
A model failure scores the case full marks 2 red
The local diagnostic is no longer redacted 2 red
The public explanation quotes the composed prompt 2 red
The public explanation quotes the model's answer 1 red
Weft calls an approval disciplined unconditionally 1 red
Weft's dry run takes the live path 1 red
Pattern never flags an undeclared command 1 red
Warp ignores the blocker cap 1 red
Spindle always reports a confidence 1 red
Tapestry always marks the task complete 1 red
Raw artifacts are built and written without --raw-artifacts 2 red
(either raw-artifact gate alone) 0 red — the other gate still holds
(a CaseResultSummary carries rawContent) 0 red — the writer's allowlist strips it

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, InMemoryWeftRunner and their siblings extended the real
class and then override run() with their own implementation. The copies
diverged from the product and nothing noticed:

  • --model with no matching fixture publishes an empty green run on
    loom-routing and tapestry-execution. Both guard an empty case list but
    not an empty work item list, so the run writes a full bundle with
    totalCases: 0, suiteGreen: true, updates the dashboard indexes and exits
    0. A typo'd --model reads as success in CI. The other six suites return
    NoCasesFound and exit 1. Both runners' unit tests asserted NoCasesFound —
    against the in-memory copy, which does carry the guard.
  • The category-routing qualitative gate is all but inert.
    mergeWithScorerDimensions() averages delegationCorrectness,
    executionCompleteness and rationaleQuality and requires 0.7, but on an
    agent_routing case the first two are never applicable and an inapplicable
    dimension 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.
  • A documentation placeholder still earns fallback credit. An answer
    containing → \shuttle-{category}`` is rejected by the affirmative-route
    reader — 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's NoCasesFound message is the only one that does
    not 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

Copilot AI lite review requested due to automatic review settings September 21, 2026 06:40
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 2bc1dfcd-3d46-49bd-85f0-9ab7c55ebe2e

📥 Commits

Reviewing files that changed from the base of the PR and between 0997c04 and 05369d4.

⛔ Files ignored due to path filters (1)
  • .codesight/coverage.md is excluded by !.codesight/**
📒 Files selected for processing (12)
  • docs/artifacts/cli-evals-migration-handoff.md
  • docs/testing-strategy.md
  • packages/cli/src/evals/__tests__/loom-routing-runner.test.ts
  • packages/cli/src/evals/__tests__/pattern-planning-runner.test.ts
  • packages/cli/src/evals/__tests__/shuttle-execution-runner.test.ts
  • packages/cli/src/evals/__tests__/spindle-tools-runner.test.ts
  • packages/cli/src/evals/__tests__/tapestry-category-routing-runner.test.ts
  • packages/cli/src/evals/__tests__/tapestry-execution-runner.test.ts
  • packages/cli/src/evals/__tests__/warp-security-runner.test.ts
  • packages/cli/src/evals/__tests__/weft-review-runner.test.ts
  • tests/evals/suite-runners.scenario.test.ts
  • tests/support/evals.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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>
@pgermishuys
pgermishuys force-pushed the test/evals-runners-migration branch from 9b6cd0a to 05369d4 Compare September 21, 2026 06:44
@pgermishuys

Copy link
Copy Markdown
Contributor Author

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 override run():

git grep -c "override run" origin/main -- 'packages/cli/src/evals/__tests__/*runner.test.ts'
loom-routing · pattern-planning · shuttle-execution · spindle-tools
tapestry-execution · warp-security · weft-review        → 1 each

464 cases exercising a reimplementation.

Finding 2 confirmed, and the two findings are the same story. loom-routing and tapestry-execution are the only runners without a post-filter guard:

grep -c "workItems.length === 0" packages/cli/src/evals/*-runner.ts
0  loom-routing
0  tapestry-execution
1  (the other six)

The damning part is where the missing guard does exist. loom-routing-runner.test.ts references NoCasesFound eleven times and its docblock promises "NoCasesFound is returned when model filter eliminates all cases" — and line 229 of the test file implements if (workItems.length === 0) inside InMemoryLoomRunner. The guard was written into the double. The product never had it, and the suite was green for as long as it has existed.

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 docs/testing-strategy.md and the handoff doc conflicted with #203 — append collisions at the same insertion point, not contradictions, so both sides are kept in sequence. Verified both sections survive and links check.

Nothing else to change. Merging when green.

@pgermishuys
pgermishuys merged commit 0f7b5e7 into main Sep 21, 2026
6 checks passed
@pgermishuys
pgermishuys deleted the test/evals-runners-migration branch September 21, 2026 06:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

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.

Comment on lines +503 to +509
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);

Comment thread tests/support/evals.ts
options: SuiteRunOptions,
): Promise<SuiteRunObservation> {
const model = options.model ?? EVAL_MODEL;
const bundleRoot = await mkdtemp(join(tmpdir(), "weave-evals-run-"));
Comment thread tests/support/evals.ts
Comment on lines +445 to +447
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));
Copilot AI review requested due to automatic review settings September 21, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Moderate findings remain in the scenario harness and shared test helpers.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 Medium severity · 1 Low severity

Open (5)

describe("the model is unreachable mid-run", () => {
const NETWORK_ERROR = {
type: "NetworkError" as const,
message: "connect ECONNREFUSED with Bearer sk-or-v1-abcdef0123456789",
Comment thread tests/support/evals.ts
Comment on lines +232 to +233
await mkdir(join(root, "cases", spec.suite), { recursive: true });
await mkdir(join(root, "rubrics", spec.suite), { recursive: true });
pgermishuys added a commit that referenced this pull request Sep 21, 2026
…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>
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.

2 participants