Skip to content
engineering workbench.by StudyPort Academy
Learning path
Advanced20 minLESSON 06 / 6

Reviewing AI output like a PR

01

Understand the idea

Rubber-stamping tidy AI output is how subtle bugs ship. Review it the way a careful engineer reviews a junior pull request.

The review stance

is where this track becomes a habit. AI output arrives looking mergeable. Your stance is the same one you owe a junior teammate: curious, skeptical, specific. Ask what the change claims to do, then try to break that claim.

AI Lab · compare fixes

Two AI patches after an error-handling block moved

A refactor moved the error-handling block. The comment still says "continue to next file," but the code uses break. Production stopped processing the rest of a batch after the first bad file. Two chat suggestions disagree.

Fix A - trust the comment

// On parse error, continue to next file
for (const file of files) {
  try {
    process(file);
  } catch (error) {
    log(error);
    continue; // AI: comment said continue, so change break → continue
  }
}

Fix B - keep abort semantics, fix the comment

// On parse error, abort the batch (fail fast)
for (const file of files) {
  try {
    process(file);
  } catch (error) {
    log(error);
    break; // intentional: one bad file stops the batch
  }
}
// Tests and runbook require fail-fast; update the stale comment instead.
Which fix is better?

Questions that catch AI-shaped mistakes

What assumption does this encode? Which never appears in the snippet? What do existing tests and callers require? Did the model solve a neighboring problem with a familiar helper? Those questions catch substring identity checks, silent catches, and comment-driven control-flow edits.

Glance review versus PR review
LensGlancePR-grade
SyntaxParses, formats cleanlyNecessary, not sufficient
IntentComment sounds rightMatches tests and runbook
EdgesDemo input worksBoundary input chosen by you
RiskDiff is smallBehavior change is understood

Edge cases and callers

Read the call sites. A helper that returns 0 on failure may be fine in a chart and disastrous in a charge. AI often optimizes the local file. Review zooms out to the contract the callers already rely on.

When comments and code disagree

After refactors, comments drift. A model that "fixes" code to match a stale comment can invert product behavior while making the file locally consistent. Prefer the intentional source of truth - tests, runbook, product rule - then update the stale artifact.

Hold the same standard you hold a teammate

If you would request changes from a junior engineer, request them from the model. If you would demand a test for a control-flow change, demand it here. The author being non-human is not a reason to lower the bar. It is a reason to keep it.

02

Mental model

FOLLOW THE VALUE

glance
tidy diff
insufficient

Shape is not intent.

01 / 03Trace the transformation

03

Live example

A stale comment says continue while the keyword remains break - review trusts tests, not drifted prose.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022
04

Guided challenge

Pick the review instinct

The third log says trust-comment. Change it to trust-tests.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022

EXPECTED CONSOLE OUTPUT

continue to next file
break
trust-tests
not-rubber-stamp
reviewed

Hints 0/2

    Use all hints or make 3 failed runs (0/3).

    05

    Free sandbox

    Make a variation, test an assumption, or break the example on purpose. This draft is saved separately.

    Opening editor…
    LIVE PREVIEW
    Console 0

    Your console output appears here.

    Saved on this deviceJavaScript · ES2022
    06

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01What does reviewing AI output like a PR require?
    02If a comment says continue and the code says break, what should you trust first?

    Ready to call this one understood?

    Mark this lesson complete to earn 200 XP. You can always revisit it.

    Sign in to save progress