Agents write cases as code and the machine checks them. Each case runs once on the current code before approval, and again on the changed code when a push arrives.

Definition

Start with a project JUnit Jupiter test. Use the java_test example in ourdoc plan --help to select its source file and class, with an optional method. It runs against the verified project classes and signed test classpath. For simple checks, use public static boolean check() in a default-package OurDocPlanCase class.

Passing conditions

Case
Before approval, on the current code
After the push, on the new code
Reading
A case for a change
Fails
Passes
Evidence that the behavior changed.
A case for a preserve
Passes
Passes
Evidence that it stayed the same.
A change case that already passes
Passes
Passes
It cannot tell the change apart. The verdict is unknown.
A case that could not run
Unknown
Unknown
It shows nothing. The verdict is unknown.
For a case to count, its results before and after must look like this.
Kind of case
Current code
Changed code
Shows a requested change
Must fail
Must pass
Checks something preserved
Must pass
Must pass

A change case that already passes on the current code cannot tell the change apart, so a weak case like that makes the verdict "unknown". So does a case that always returns true. If a case fails on the changed code, the verdict is "outside". Both runs must use the same registered environment.

The run before approval

Each time a plan draft is created or revised, OurDoc runs its cases on the current code of the protected branch. The approver sees, for each case, whether it failed or passed, how long it ran, the hash of its log (a short value that changes if a single character changes) and the commit it ran on. Approval is bound to that result. If the protected branch moves after approval, the old result cannot prove the new comparison.

The run continues if the draft response returns first. The plan screen shows a run in progress, the reason a run failed, or that no runner is configured. While a run is in progress, the screen checks for the result automatically. A plan with cases can be approved once the result is recorded. After a failed run, the author or an agent acting for the author can run it again.

Each case shows which behavior it demonstrates, its result on the current code and what must hold after the change.
Each case shows which behavior it demonstrates, its result on the current code and what must hold after the change.

Isolated execution

Cases receive read-only code and bounded scratch space. They can read system properties and reflect on project classes. Network access, process launches, JVM exit and changes to the result channel are blocked. Declare a DB requirement with database. With no DB runner, the automated result stays unknown with the reason shown. A person can review the DB cases and confirm integration after scope is verified.