1354. Lesson identity
1355. Learning objective
After this lesson, you can inspect an AI-assisted diff, compare it with the requested boundary, identify unsafe or unrelated changes, evaluate the commit's evidence, and choose a safe recovery operation from the repository state.
1356. Why this matters
AI-assisted work can produce a technically plausible change that still violates the task boundary. A professional review checks more than whether the code looks reasonable: it checks scope, behavior, validation, and reversibility. This protects the production record and prevents an unclear commit from becoming the foundation for later work. The goal is not to distrust assistance; it is to make the final decision from inspectable evidence.
1357. Prior knowledge
You should have completed 3.14 L1 — History is part of the production record. You should be able to read a commit history, distinguish a focused commit from a mixed one, and describe a validation claim. You also need basic familiarity with working-tree changes, diffs, commits, and restoring or reverting work without accidentally discarding evidence.
1358. Core concept
A change set is acceptable only when its intent, boundary, implementation, evidence, and recovery path agree.
Review the change as a claim, not as a pile of modified files:
- Intent: What was requested?
- Boundary: What was allowed to change?
- Implementation: What actually changed?
- Evidence: What was checked, and what remains unknown?
- Recovery: Given the repository state, what is the smallest safe operation if the claim fails?
An AI-generated explanation is context for review, not proof. The diff, project behavior, validation record, and history are the evidence.
1359. Mental model
The B-E-R review
Use this compact review sequence for every assisted change set:
| Step | Question | Evidence to inspect |
|---|---|---|
| Boundary | Did the change stay within the requested area? | File list, diff scope, task statement |
| Effect | What behavior and structure did it alter? | Diff hunks, call sites, settings, runtime result |
| Recovery | What will you keep, separate, correct, or restore? | Repository state, commit structure, safe reference, explicit next action |
A review result should end with one of four decisions:
- Accept: the scope and evidence are sufficient.
- Separate: a useful change is mixed with unrelated work; preserve and isolate the parts.
- Correct: the change belongs in scope but needs a targeted fix.
- Recover: the change is unsafe, unexplained, or outside the boundary; return to a known safe state through a deliberate operation.
Recovery depends on repository state
“Undo the change” is not a sufficient recovery instruction. First determine whether the affected work is uncommitted or committed, whether committed history has been shared, and whether any current work must be preserved.
| Repository state | Appropriate operation category | Preserve first | Required checks afterward |
|---|---|---|---|
| Only unwanted uncommitted edits are present, and no part must be kept | Restore only the identified paths or hunks from the known safe reference | Record the diff if it may be needed as evidence | Confirm the intended paths are clean; inspect the remaining diff; rerun the relevant validation |
| Uncommitted edits contain both useful and unwanted work | Separate or save the useful portions before restoring only the unwanted paths or hunks | Useful edits, review notes, and any evidence needed to reconstruct the decision | Confirm the preserved work still exists; inspect the resulting diff; verify that only the intended scope remains |
| A faulty commit is local and has not been shared | Prefer a corrective commit when traceability matters; revise local history only when collaboration policy permits and preserved work is not at risk | Any unrelated uncommitted work and a reference to the current commit | Inspect the resulting history and diff; confirm the intended commit boundary; rerun validation |
| A faulty commit is already shared | Create a new corrective or revert commit rather than rewriting shared history | Unrelated uncommitted work and the identifier of the shared commit being addressed | Confirm the new commit targets the intended change; inspect history and working-tree state; rerun affected checks |
| A committed change is valid but current uncommitted work is unrelated | Preserve the uncommitted work before correcting or reverting the committed change | All unrelated uncommitted edits | Restore the preserved work only after confirming the committed recovery; inspect the combined state for accidental overlap |
| The state is unclear or the changes cannot yet be separated safely | Stop and create a recoverable reference or copy of the current diff before changing history or files | The complete current state and review evidence | Compare the preserved state with the result; verify no required work disappeared; continue only when the boundary is understood |
Do not treat restoration, a corrective commit, a revert commit, and local history revision as interchangeable. The correct category follows from the state of the work and the need to preserve collaboration history.
1360. Concrete example
Suppose the requested task is: “Adjust the guard detection radius and update the related tuning note.” An assistant changes the detection value, renames a helper, adds a debug overlay, and formats several unrelated files.
The detection value and tuning note may be in scope. The helper rename requires review of its call sites. The debug overlay and broad formatting pass are boundary violations unless explicitly requested. “The game still runs” is not enough to accept the change.
Review it by:
- recording the requested boundary;
- inspecting every changed file and diff hunk;
- separating the intended tuning change from unrelated edits;
- checking affected call sites and the relevant detection scenario;
- choosing accept, separate, correct, or recover.
Worked recovery decision for the mixed change set
Assume the detection adjustment and helper rename are already in one shared commit, while the debug overlay and unrelated formatting remain uncommitted. The formatting includes a note you need to retain for a different task.
- State: There is shared committed work plus mixed uncommitted work.
- Boundary judgment: The tuning change may be retained after validation; the helper rename is still uncertain; the overlay and formatting are outside the current task.
- Preservation: Save the unrelated note and record the current uncommitted diff before modifying anything. Do not let recovery of the shared commit overwrite those edits.
- Operation: Restore only the unwanted uncommitted overlay and formatting regions after preserving the note. If review shows that the shared helper rename is unsafe, create a new corrective or revert commit that addresses that committed change; do not rewrite the shared history.
- Post-operation checks: Confirm the preserved note still exists, inspect the working-tree diff, inspect the new history, review every helper call site, and rerun the detection scenario.
The choice changes if the questionable commit has not been shared: local history revision may be permitted by team policy, but a corrective commit remains appropriate when preserving an inspectable record is more important. In either case, preserve unrelated work first and validate the resulting state.
1361. AI-native workflow
Use AI as a review assistant, not as the authority that approves its own work.
- Give the assistant the task boundary and ask it to summarize the intended files and behaviors.
- Compare that summary with the actual changed-file list and diff.
- Ask for assumptions, possible boundary violations, and unverified behaviors.
- Verify the highest-risk claims yourself in the diff, project, or runtime.
- Determine whether the work is uncommitted or committed, whether the commit was shared, and what must be preserved.
- Record your decision and recovery operation in your own words.
Do not ask only, “Does this look good?” A useful prompt names the boundary and requests disagreement:
Review this change set against the stated task. List every changed file or behavior that appears outside scope. Separate evidence from assumptions, identify untested claims, and identify the repository-state facts needed before choosing a recovery operation. Do not approve the change.
The assistant's response is a candidate checklist. It does not replace inspection of the repository or the running project.
1362. Git workflow
For the guided review, work from a clean or deliberately documented starting point.
- Identify the target commit or working-tree change set.
- Inspect the changed-file summary before reading individual hunks.
- Read the complete diff, including nearby context where behavior may be affected.
- Compare the diff with the task boundary and commit message.
- Inspect relevant call sites, configuration, and validation evidence.
- Classify the repository state: uncommitted or committed, shared or unshared, and with or without work requiring preservation.
- Decide whether to accept, separate, correct, or recover.
- If recovery is required, name the exact safe operation category and affected paths or commits before acting.
- Recheck the resulting history, working-tree state, preserved work, and relevant behavior.
Never use a destructive reset or deletion merely because an AI-assisted change is confusing. First preserve the evidence or establish a known safe reference. A recovery decision must describe what is retained, what is changed, why the operation matches the repository state, and how the result will be validated.
1363. Common mistake
The common mistake is reviewing the assistant's summary or the final runtime result instead of the complete diff. A change can pass a narrow test while introducing unrelated edits, changing an interface, weakening a boundary, or leaving no credible recovery path. Another mistake is using “revert” as a generic word for every undo action. Uncommitted edits, local commits, and shared commits require different decisions.
1364. Guided practice
Task: Review and classify an assisted change set
Use a small existing change set from your practice project, or create a deliberately mixed example with at least three changed files or three distinct diff regions. The requested task must have a narrow boundary, such as changing one tuning value and its documentation.
- Write the task statement in one sentence and list the files or behaviors explicitly in scope.
- Ask an AI assistant to summarize the intended change and identify possible risks. Save the response in your notes; do not treat it as approval.
- Inspect the changed-file list and full diff independently.
- Mark each changed file or diff region as in scope, requires investigation, or out of scope. For every item requiring investigation, write the missing evidence.
- Check whether the commit message states one primary purpose and a clear validation claim.
- Record whether each relevant change is uncommitted or committed, whether committed work has been shared, and what work must be preserved.
- Select one decision: accept, separate, correct, or recover. Address both boundary and evidence.
- Write a recovery specification containing:
- the known safe reference;
- the repository state that determines the choice;
- the exact operation category and affected paths or commits;
- the work and evidence that must be preserved;
- the checks to run afterward.
- If the change is safe to retain, describe the smallest focused commit that should remain. If it is not safe, do not perform a destructive operation without first preserving relevant work and evidence.
The required judgment is the classification of at least one ambiguous or mixed change and the selection of a recovery operation that matches its repository state. Do not classify every item as acceptable without explaining why.
1365. Validation / evidence
Your review is complete when you can point to all of the following:
- a written task boundary;
- a changed-file list and inspected diff;
- at least one explicit boundary judgment with evidence;
- a commit-quality assessment tied to purpose and validation;
- a decision to accept, separate, correct, or recover;
- a recorded distinction between uncommitted and committed work and, when relevant, shared and unshared history;
- a recovery specification naming preservation, operation, affected paths or commits, and post-operation checks.
A strong result distinguishes facts from assumptions. It does not claim that untested behavior is safe, use “revert” as a synonym for every recovery action, or rewrite shared history as a generic remedy.
1366. Key takeaways
- Review the actual diff, not only the AI explanation or runtime result.
- Scope is a technical property of a change set, not a matter of author intent alone.
- A focused commit needs one primary purpose and a credible validation claim.
- Recovery depends on repository state: uncommitted versus committed, shared versus unshared, and whether work must be preserved.
- Preserve evidence, choose the smallest safe operation, and verify both history and behavior afterward.
- AI can propose review questions; the developer remains responsible for the decision.
1367. Next lesson
Continue to A test must fail for the right reason / Un test debe fallar por la razón correcta.
1368. Knowledge check
Answer these items for yourself before reading the answers.
What is the strongest evidence that an AI-assisted change stayed within scope?
Show answer and feedback
Answer: The actual file list and complete diff match the written task boundary
Why: Scope is established by comparing the actual changes with the written task boundary. An assistant summary, a short message, or a successful launch cannot prove that no unrelated work was included.
Before choosing to accept, separate, correct, or recover, what is the most appropriate initial classification for a useful change mixed with unrelated formatting changes?
Show answer and feedback
Answer: Requires investigation: inspect whether the in-scope and unrelated changes can be isolated safely
Why: Initial classification is not the final disposition. The reviewer must inspect whether the useful and unrelated changes can be isolated safely before choosing the final action.
A faulty commit has already been shared, and unrelated uncommitted work is present. What is the safest recovery plan?
Show answer and feedback
Answer: Preserve the unrelated work, create a corrective or revert commit for the shared change, and then inspect history, state, and validation results
Why: Shared history should not be rewritten as a generic remedy. Preserve unrelated uncommitted work, address the shared change with a new corrective or revert commit, and verify both repository state and affected behavior.
Why is an AI-generated review summary not sufficient approval evidence?
Show answer and feedback
Answer: The summary is a claim that still must be checked against repository and runtime evidence
Why: An AI summary can identify questions and risks, but it remains a claim about the work. Approval requires comparing it with the actual diff, project state, behavior, and validation evidence.