The GRC Vibe Coder's Playbook · Lesson 07 of 10
How Do I Know AI-Generated Work Is Correct?
Check what the tool actually does against the promise you wrote.
All 10 Lessons · Jump to a Lesson
Return to Peachtree Demo. Incident-notification evidence is missing, so our blueprint promises Review Required. But suppose AI produces a polished screen showing Low Risk.
That is a mistake even if the code runs. Compare the result to the written rule, explain what went wrong, and ask for a correction. A test is a repeatable check.
A regression test checks that a fixed problem does not return. Passing automated checks only means the particular checks ran successfully, not that every possible outcome is correct.
Same Answers, Different Review Outcome
- Customer data used for AI training?
- No
- Data deletion supported?
- Yes
- Incident-notification evidence?
- Not provided
Low Risk
The function checks only for explicitly concerning answers and overlooks the unanswered question.
Incident-notification evidence was not provided.
Read a Small Change Against the Promise
Return to Peachtree Demo from Lesson 2: No to using customer data for training, Yes to deletion, and a missing incident-notification answer. The promised result is Review Required.
You do not need to read this code perfectly. Follow the inputs and the returned words first. The goal is exposure and growth: explain one rule, ask about an unfamiliar line, and become more confident with the next change.
Before: A Missing Answer Slips Through
This Python function translates the answers into a category. A function is a named piece of code we can call with inputs. Here, its three inputs correspond to our three questionnaire answers.
def assess_vendor(training, deletion, notification): if training is True or deletion is False or notification is False: return "Elevated Risk" return "Low Risk"Read if as “when this condition is met.” Read or as “any one of these conditions is enough.” return sends the result back to whoever called the function.
The function asks whether a concerning answer is explicitly present. Peachtree Demo's notification answer is None, which is different from False. None of the conditions matches, so the function reaches the last line and returns Low Risk. That breaks the blueprint.
After: Check for Missing Information First
def assess_vendor(training, deletion, notification): if training is None or deletion is None or notification is None: return "Review Required" if training is True or deletion is False or notification is False: return "Elevated Risk" return "Low Risk"The new first check looks for a missing answer in any of the three inputs. If it finds one, it returns Review Required immediately. Otherwise, it continues to the existing risk rule. The order matters because our blueprint gives missing information priority.
This short function assumes inputs are already limited to Yes, No, or missing. A UI or import needs its own validation before passing other values into it. The category is one part of the output; the tool must also display the answers and the missing-evidence reason promised in Lesson 2.
Check the Result with a Regression Test
A regression test helps catch a return of a previously fixed problem. This test records Peachtree Demo's answers and the result we expect.
def test_missing_notification_requires_review(): result = assess_vendor(False, True, None) assert result == "Review Required"The three values mean No to training, Yes to deletion, and missing notification evidence. assert checks that the result matches the expectation. == asks whether two values are equal. With the original function this test fails; with the correction it passes.
| Answers: training / deletion / notification | Before | After | Expected |
|---|---|---|---|
| No / Yes / missing (Peachtree Demo) | Low Risk | Review Required | Review Required |
| No / Yes / No | Elevated Risk | Elevated Risk | Elevated Risk |
| No / Yes / Yes | Low Risk | Low Risk | Low Risk |
| Yes / Yes / missing | Elevated Risk | Review Required | Review Required |
The last row checks our priority rule: a concerning answer does not erase missing information. Test the other missing fields too, and check that the visible report explains the reason.
Make a Review Decision You Can Explain
A useful request for changes could say:
Peachtree Demo is labeled Low Risk even though incident-notification evidence is missing. The blueprint requires Review Required. Check missing answers before assigning a risk category, add regression coverage, and verify that the report identifies the missing evidence.
After the fix, inspect the change and compare the actual output with the acceptance criterion. Passing this test supports one specific behavior. It does not establish that the complete tool or its security controls are correct.
Ask an AI or a peer: “Walk through Peachtree Demo's answers line by line. Why does the original function return Low Risk, and where does the corrected one stop?” Try explaining the answer yourself afterward. For more practice, visit the Code Reading Challenge.
The GRC Connection
Treat automated checks as evidence about specific tests. Review the actual control objective, missing evidence, exceptions, and the human decision.
Put It into Practice
Find why Peachtree Demo incorrectly shows Low Risk, describe the expected result, and ask AI to propose a test for missing answers. Write a short request for changes and explain why you are not approving the result yet.
Find the Plausible but Wrong Result
A vendor answers “unknown” for incident notification and leaves data deletion blank. The generated tool assigns Low Risk because no explicitly negative answer was recorded. It looks plausible, but it may violate the scoring rules and conceal missing evidence.
- Compare the result with the written scoring policy and acceptance criteria.
- Describe the defect and request a regression test for missing answers.
- Decide whether to approve, request changes, or mark the evidence insufficient. Record your reason.
What Good Looks Like
You can identify the incorrect outcome, state a check that catches it, and explain your review decision.
Check the result yourself. Save the decision or next step in GitHub so you can return to it later.