When Claude Code reports "tests passed," verify every CI check one by one

This article has been automatically translated.
Loading article...
Merry Christmas & Happy New Year!
Loading article...

This article has been automatically translated.
This content comes from an article by Zenn author タスキーナ. The author uses a single PC to periodically launch Claude Code and have it play different roles in a "company": one session acts as the CEO writing instruction documents, and another acts as the development department modifying code in a real repository. After the development session ends, the runner that launched it reruns the checks on the same branch and records the results. The author tallied records from 2026-10-23 to 2026-11-04 and found 6 cases where the report said tests: passed but a separately run check failed: 4 were line-count limits and 2 were type checks. In at least 4 of them, the acceptance record said "unit tests passed."
The conclusion is straightforward: don't treat the agent's self-reported passed as the basis for acceptance. Instead, pin down the CI checklist and run every item, comparing line by line. Below, I'll explain why this happens and how to do this verification locally.
The key point is that the tests field in the report only represents the items the development department actually ran itself, not the full set in CI.
The rules of the author's "company" are explicit: the development department does not run the type checker mypy itself; for the line-count limit, the check script can't run because of the guard, so the only option is to open the file and look at the line number of the last line. So passed really means "every check I could run is green," not "all of CI passed."
The acceptance record from 2026-11-04 22:00 acknowledges this too: the tests in the report refer to unit tests, and the development department did not run mypy, so it doesn't count as a false report. In the same record, the runner's separately run results were 4876 unit tests passing, with only the type check ending in exit code 1 and reporting 4 errors; the mismatch flag was true, and the changes were not pushed.
There's an even subtler example. In the report from 2026-10-26 00:00, the agent counted 608 lines in the file but did not compare that number against the 600 limit. Measuring and judging are two different things: a number appearing in a report doesn't mean that number was used to make a pass/fail decision. As an analogy, it's like a student saying "I've finished all my homework" when they only did the problems the teacher assigned in class—the difference is that the student at least knows what they missed, while the passed field itself gives no hint of the omission.
The prerequisite for verification is a complete checklist. The author's approach is to extract the .github/workflows/ YAML files (in GitHub Actions) from the CI definitions, pull out the run: lines, and write them to checks.txt, one check per line, in the format "name + space + command".
A few details that are easy to get wrong:
The author specifically warns that the checks most easily left out of the checklist are precisely the non-test checks—line count, types, import ordering. The two categories that went red in the 6 cases he tallied were exactly these. If the checklist is written correctly, the number of checks in the CI definition should match the number of lines in checks.txt.
With the checklist in hand, run each item with a while read loop and record the exit code. The author's core loop looks roughly like this:
REPORT=passed
while read -r name cmd ; do
[ -z "$name" ] && continue
sh -c "$cmd" > "out-$name.log" 2>&1 < /dev/null
echo "$name $?"
done < checks.txt > results.txtTwo details here are worth calling out separately. read -r preserves backslashes, so a \ in a command won't be eaten. < /dev/null is there to prevent the invoked command from reading the remaining lines of checks.txt and causing everything from the second line on to be skipped—if you find the number of result lines is fewer than the number of checklist lines, suspect this first.
The loop doesn't stop when an item goes red; it runs all the way to the end. Among the author's 6 cases, there were rounds where only one item was red and everything else was green.
After the run, use awk to organize the results into a readable comparison, and print a line of warning when the report claims passed but red items exist. The author's sample output looks like this:
unit 緑 (終わりの値 0)
lint 緑 (終わりの値 0)
types 赤 (終わりの値 1)
size 赤 (終わりの値 1)
<- 報告は passed、赤が 2 個If the report says skipped rather than passed the final warning line won't appear, and you'll need to read the table yourself to judge.
Important caveat:The author explicitly states that the commands and sample output in the article were worked out by hand line by line and were not actually run—because the "company" rule is not to execute draft code. So the first step should be to run the sample checklist once, confirm the output matches the sample, and then swap in the real commands. The true and false in the sample are fake commands: true does nothing and returns 0, and false returns a nonzero value, so they run in any environment.
Finding a red item is only the first step; you also need to judge whether this change caused it. The author's method is simple: run the same checklist on the commit before the change. If it was already red before the change, then the AI's change didn't cause it.
这一步把“代理漏报”和“仓库本来就坏”区分开,既不会冤枉代理,也不会放过真问题。对每个红项,读一下 out-<名字>.log 的末尾,应该能用一句话说清“哪个文件的哪一行、因为什么原因红了”。
The author also provides an acceptance table template, with each row recording: the check name, whether the report claimed it was run, whether the actual result was green or red, and the reason for red (caused by the change / already red / environment difference). The row that is "claimed not run" and "actually red" is exactly the shape shared by the 6 incidents he tallied.
The author honestly lists three blind spots; readers shouldn't assume that running the checklist makes everything foolproof.
Environment differences. When local tool versions don't match CI, a local red may be green in CI, and vice versa. The author's "company" rules even record a case where running the type check in the test environment reported type errors that don't appear in CI.
What's green. Everything passing doesn't mean the tests actually cover the defect that needs fixing.
Timeliness. This is a one-off verification; the next agent change requires running it again.
The author mentions that chapter 6 of his book embeds verification into every acceptance workflow and separates "the person writing the report" from "the person measuring," which can mitigate the third problem; but the book doesn't include the step for aligning local versions either, and the second problem is outside the book's scope.
Here are the above points organized into actionable steps: