7.4 Building Repeatable Evaluations

2 min read

A Passing Test ≠ A Correct Outcome

In Lesson 7.3, we evaluated the quality of individual research findings. But how do we know whether our evaluation rules continue to work as the system changes?

Running a few successful examples isn’t enough. We need repeatable tests that check how the system handles different conditions, including failures.

Test Cases and Expected Outcomes

A test case defines an input scenario and the behavior we expect.

For our research system, we’ll test five synthetic scenarios:

Test case Expected outcome
Complete, approved research PASS
Missing evidence FAIL
Tool failure with safe stop FAIL
Unsupported conclusion FAIL
Unauthorized save FAIL

Each case has predefined expectations for execution, research quality, governance, and the overall result.

The evaluator applies its rules and compares the observed results with those expectations.

A matching test doesn’t necessarily mean the research workflow succeeded.

For example, correctly identifying missing evidence produces a successful test, even though the research outcome is FAIL.

Detecting Regressions

A regression occurs when a change causes previously expected behavior to stop working.

Suppose we accidentally change the governance check so it accepts a save without human approval.

Our baseline evaluator correctly returns:

unauthorized_save    MATCH | expected FAIL; observed FAIL

After introducing the defective rule:

unauthorized_save    MISMATCH | expected FAIL; observed PASS

The test detects that a governance requirement is no longer being enforced by the evaluation rule.

This is why test expectations must be defined independently of the code being evaluated. Otherwise, a defective implementation could incorrectly declare itself successful.

Repeatable evaluation and regression detection, shown as five steps from left to right: the Unauthorized save test case; its expected outcome, FAIL; the observed outcome after a rule change, PASS; the result, MISMATCH; and the interpretation, governance regression detected.
A repeatable evaluation compares expected and observed outcomes to detect regressions.

Hands-On Lab: Experiment 7.4

Run the baseline evaluation:

python3 lab7_4_repeatable_evaluations.py

All five cases should match their expected outcomes.

Now introduce the simulated regression:

python3 lab7_4_repeatable_evaluations.py --simulate-regression

The script deliberately changes the governance evaluation behavior and highlights the unauthorized-save mismatch.

Observe: Why does the baseline report 5/5 matches even though four research outcomes are FAIL?

Try it: Open evaluation/cases.json, change an expected outcome, and rerun the baseline. See how the comparison identifies the mismatch.

Beyond Individual Tests

Repeatable tests help identify regressions, but a collection of PASS/FAIL results is difficult to interpret without context.

In Lesson 7.5, we’ll consolidate the evaluation results into a report that identifies failures, explains their causes, and highlights areas requiring investigation.

Test Your UnderstandingOptional · 3 questions

Question 1 of 3

A test suite reports 5/5 matching cases, but four research workflows have an overall FAIL. What does this mean?