Skip to main content
Post

Implicit state machines hide bugs that line-by-line review approves

Quickchat added a state-machine review to QuickReview, its open-source AI reviewer for code changes and pull requests. You can run it on your own pull requests.

It looks for implicit state machines. These are behavior that depends on state kept in flags like isLoading, nullable fields, status strings, or the order calls must come in. The example in the write-up is an upload handler that sets uploading to true. A new early return then skips the line that sets it back to false, so the button stays disabled until the user reloads. Each changed line looks fine, which is why a line-by-line reviewer approves it.

QuickReview already reads a change through narrow reviewers it calls lenses. The update adds eight, each hunting one kind of state bug. They include impossible flag combinations, status changes that don't check what they're leaving, stuck loading or processing states, events that arrive twice or out of order, stale cached copies, and lifecycle-order mistakes like use after close. The review reports only what the change made worse, and each claim is checked before a person sees it.

On 34 pull requests with 105 known state bugs, Quickchat says the new review found 89 and its default review found 75, at the same cost. The write-up says every review comment and label behind those numbers is public, along with a script that recomputes them. These are the author's own measurements. The write-up also says state bugs are a minority, about one real defect in eleven in the benchmarks it runs.

Loading replies