export function shippingFee(
total: number, member: boolean,
): number {
if (member) return 0;
if (total >= 50) return 0;
return 8;
}How to read code
your AI wrote.
You asked for express shipping. The tests pass. Here is how to see that an old rule changed too, and that nobody decided what members pay.
The request: “add express shipping for 12”.
This is a small example we wrote, in the shape of a change a coding agent might make. The test results, the plain words and the check below come from running it; the check is shortened.
export function shippingFee(
total: number, member: boolean,
express = false,
): number {
if (express) return 12;
if (member) return 0;
if (total > 50) return 0;
return 8;
}Tests: 2 passed, 0 failed, before and after. Would you notice what else changed by skimming?
The same code in plain words.
OpenThunder reads the code with Thunder™. No AI writes these sentences; each rule comes from a line of the code.
If member, the answer is 0. Otherwise, if total is at least 50, the answer is 0. Otherwise, the answer is 8.
If express, the answer is 12. Otherwise, if member, the answer is 0. Otherwise, if total is more than 50, the answer is 0. Otherwise, the answer is 8.
Now two things are easy to see:
- An order of exactly 50 used to ship free. Now it pays 8. The request did not ask for that.
- A member who picks express pays 12, because express is decided first. The request did not say. Is that what you want?
Passing tests are not the same as tested.
Neither test tries an order of 50 or uses express. openthunder check did not call this change safe:
Needs review: No test run shows the changed lines are exercised.
Next: Run your tests with coverage for the changed lines.
What this does not prove. The plain-words reading shows what the code does, not what you meant. The check asked for a person to look; it did not know that 50 should ship free. Code that Thunder cannot read is shown as not read. This is one small function, not a measure of how many mistakes OpenThunder finds.
Read your own code in three steps.
- Download the free desktop app for macOS, Windows or Linux.
- Open a repository. Choose an area, then an action, and read it in plain words.
- After your agent changes something, press Check this change and read what it says is not tested.