EngineeringVerifying the Verifier: Fixed Expectations and a Fresh Session
- #verification
- #testing
- #runbook
- #ai-agent
This was a practice project: a master data management tool for raw materials and products. The tool had two means of verification. One was an automated check script, verify.mjs. The other was an operations runbook, runbook.md.
Both were already passing or already written. On November 26, each of them was tested on its own. For the automated check, the question was whether it still passed against code with a wrong rule. For the runbook, the question was whether a session that had never seen the app could follow it using only that document.
3
Checks moved to fixed expectations
64, 87, 165
168
Automated checks
all passing after the fix
5 → 0
Runbook vs. screen mismatches
run 1 → run 2
8 → 5
Steps the runbook alone could not get through
run 1 → run 2
A check that computed its expectations with the rule function
The tool links an evidence document to each product claim and decides whether that document can be used right now. The verdict has branches such as pass, expired, unapproved, outdated, and conflict. On the server, the rule functions verdict and warningOf make this decision.
The session assigned to cross-checking read verify.mjs and reported weak comparisons. Its note on check 64 read:
Computes the expected value from the seed with
warningOf, the same rule function the server uses. It only checks that the server response matches the rule function. IfwarningOfis wrong, both are wrong together.
Check 87 had the same shape. It computed the expected value with verdict and compared it with the server response. If the rule is wrong, the expected value is wrong in the same way, so this check cannot fail. Part of check 165 had the same shape too.
The cross-check session did not count the weak comparisons as defects, because other checks covered the same rules with fixed expectations. The orchestrating agent fixed these three checks anyway and wrote this reason in the work log:
If the expected value is computed with the same rule function as the server, it passes together with the rule even when the rule is wrong.
Fixed values counted separately from the seed
The session assigned to the screens edited verify.mjs. Expected values no longer use the rule functions. They are values counted separately from the seed JSON. Three places that picked the test target claim with a rule function now use a fixed ID.
-const rxExpected = rxClaims.map((c) => verdict(c, documents.find((d) => d.no === c.docNo), TODAY, documents).reason ?? 'pass').sort().join(',');
-const rxBlocked = rxClaims.find((c) => verdict(c, documents.find((d) => d.no === c.docNo), TODAY, documents).reason === 'expired');
+// 기대 판정: 규칙 함수 없이 시드 JSON을 직접 센 값(scratchpad/screen2/count_seed.py, 기준일 2026-11-25)
+// 시험 대상 문구는 고정 번호: 규칙 함수로 고르면 그 함수가 틀릴 때 대상이 없어져 검증이 멈춤.
+const rxBlocked = rxClaims.find((c) => c.no === '30026');The comments say: the expected verdicts are counted directly from the seed JSON without the rule function, and the test target is a fixed ID because picking it with the rule function makes the target disappear when that function is wrong, which stops the check.
The expected value for check 87 is now a literal string with the IDs and verdicts of 11 claims. It goes on like 30014 pass, 30026 expired, 30039 unapproved, 30042 outdated.
Testing again with deliberately broken copies
The fixed check was tested as well. First, the cross-check session counted the fixed values again by itself. It did not reuse the earlier counting script. It copied the business rules from the header comment of the code and counted with those. All three checks matched the fixed values.
Next, it made copies with a deliberately wrong verdict rule and ran verify.mjs against them.
| Copy | Rule changed | Result |
|---|---|---|
| m3 | Expiring-soon boundary cut by 10 days | Exit code 1. 64 and 65 fail |
| m4b | Outdated branch removed for prescription documents only | Exit code 1. 4 checks fail, including 87 |
| m5 | One counterpart dropped from the conflict preview | Exit code 1. 165 fails |
| m4 | Outdated branch removed entirely | Exit code 1. Stops with a TypeError at line 166, no result table |
m4 did not pass silently. But with no result table, there was no way to tell which check was wrong. The cross-check session logged this as defect 1. The fix: when an exception occurs mid-run, the script prints the results collected so far and adds one "run aborted" line as a failure. Run again, m4 printed "Total: 48 of 50 passed, 2 failed." and exited with code 1.
On the correct code, all 168 checks passed. This fix was committed at 13:00.
Giving the runbook to a session that has never seen the app
The runbook lists, for each role, where to click and the exact text the screen should show. Earlier that same night, a session that had never seen this app was assigned to check the runbook. It read only runbook.md and followed it on a fresh data store. It did not open the code.
For each step it wrote the runbook text next to the text it saw on screen and judged it as same, different, or could not do. Run 1: 5 different, 8 could not do, 10 blocked spots.
- Different: the runbook gave the search box hint as "name, brand", but the screen showed "Search: name, brand".
- Could not do: two sections used the same product. After the first section, the starting state the second section needed was gone. With one data store, there was no way to do them all in order.
- Blocked: the yearly expiry path said to check it on a server started with a changed reference date, but there was no command for changing the date. One step said only "check the branch", and only the next section revealed that a button should have been pressed.
Top to bottom in one pass
The session assigned to documents rewrote the runbook. It split products by step and noted when each exception should be done. It added the missing section for the lab's evidence owner and the command for changing the reference date. Section 3 of the rewritten runbook starts with this line:
Go in order from 3-1 to the end of section 4, top to bottom, in one data store (the new folder from 1.4). Later steps use the state left by earlier ones, so do not change the order.
Run 2 also used a fresh data store. Mismatches were 0, and all five roles were marked "done". Of the 23 items from run 1, 18 were resolved.
Of the remaining five, four were exceptions that cannot be produced from the screen. Their rejection text exists only in the processing code, so they are checked only by the automated check. The last one was a spot where the runbook did not say where to read the ID of a handled request. Run 2 also found 2 new blocked spots. The rewritten runbook was committed at 01:00.
Run 1
Followed the runbook alone. 5 different, 8 could not do, 10 blocked.
Rewrite
One data store, top to bottom. Products split by step, reference date command added.
Run 2
Followed again on a fresh data store. 0 different, all five roles done, 18 of the previous 23 resolved.
What the two have in common
Both cases tested the means of verification itself. The automated check was passing and the runbook was written. That alone did not show whether either one catches what is wrong.
Automated check
If expected values are computed with the same rule function as the code under test, a wrong rule passes too. Keep expected values fixed, and confirm the check fails on a copy with a broken rule.
Runbook
Give only the document to a session that has never seen the app and have it follow along. Count mismatches and undoable steps, rewrite, then have it follow again on a fresh data store.
When I build a means of verification, I also check once that it catches what is wrong.