Product case study · November 26, 2026
Ask Claude Code to reject an empty approval checklist
Reproduce Python all([]) approving an empty checklist, give Claude Code a precise repair contract, and verify missing and misleading approval values.

Require at least one recorded decision and accept only explicit True values before this checklist reports approval.
A draft has no review decisions yet. Your helper asks whether every decision is approved and returns True. The code runs without an exception, but the result gives an unreviewed draft a green light.
This exercise uses Claude Code to repair that gap between a Python operation and a product rule. You will define what approval means, reproduce the misleading result, and keep the acceptance tests fixed while the implementation changes. The example only returns a Boolean; it does not publish anything.
You need Bash, Python 3 and an installed, signed-in Claude Code session. The Python baseline and reference repair were tested locally. The Claude prompt is an authored exercise, not a recorded agent run. Official sources were checked November 26, 2026.
Reproduce the empty checklist
Create a disposable practice folder and a deliberately incomplete helper:
approval_lab=$(mktemp -d /tmp/claude-approvals.XXXXXX)
cd "$approval_lab"
cat > approvals.py <<'PY'
def ready_for_review_handoff(decisions):
return all(decisions)
if __name__ == "__main__":
print("empty:", ready_for_review_handoff([]))
print("approved:", ready_for_review_handoff([True, True]))
print("text:", ready_for_review_handoff(["pending"]))
PY
python3 approvals.py
The baseline prints:
empty: True
approved: True
text: True
Python documents that all() returns true for an empty iterable. There is no false element to stop it. That is useful when checking a general statement about a collection, but it does not establish that any review took place.
The string introduces a second policy question. Python’s truth-value rules treat a nonempty string as true, even when its contents say "pending" or "false". A checklist needs an explicit definition of an accepted decision.
Write the approval rule before asking for a fix
Save this as SPEC.md:
ready_for_review_handoff(decisions) receives a Python list.
Return a bool, never a list or a string.
Return True only when the list is nonempty and every item is
exactly the Boolean True. Return False for every other list.
Examples: [] -> False, [True] -> True, [True, False] -> False.
Strings, numbers, None and nested containers are not approvals.
Do not modify the input list.
Only approvals.py may change; preserve its demo.
Non-list inputs, reviewer identity, required reviewer counts and
real publishing are outside this lab. Add no dependencies.
This policy deliberately treats [1] as unapproved even though 1 is truthy. It also allows a single explicit approval. If your actual workflow requires three named reviewers, that is a separate requirement: a nonempty list alone cannot prove all required people responded.
Save the following as test_approvals.py:
import unittest
from approvals import ready_for_review_handoff
class ApprovalTests(unittest.TestCase):
def test_empty_is_not_approved(self):
self.assertIs(ready_for_review_handoff([]), False)
def test_explicit_approvals(self):
for decisions in ([True], [True, True]):
with self.subTest(decisions=decisions):
self.assertIs(ready_for_review_handoff(decisions), True)
def test_rejection_in_any_position(self):
for decisions in ([False], [False, True], [True, False]):
with self.subTest(decisions=decisions):
self.assertIs(ready_for_review_handoff(decisions), False)
def test_truthy_values_are_not_approvals(self):
for value in (1, 1.0, "true", "false", "pending", [True]):
with self.subTest(value=value):
self.assertIs(
ready_for_review_handoff([True, value]), False
)
def test_missing_or_false_values(self):
for value in (None, 0, "", []):
with self.subTest(value=value):
self.assertIs(ready_for_review_handoff([value]), False)
def test_input_is_unchanged(self):
decisions = [True, False, True]
ready_for_review_handoff(decisions)
self.assertEqual(decisions, [True, False, True])
Run the tests:
python3 -m unittest -v test_approvals
The local baseline failed the empty-list case and all six truthy-value subcases; the other four test methods passed. Keep this baseline. It shows why testing only [True, True] and [True, False] would miss the problem.
The tests use assertIs to distinguish the actual Boolean results from merely false-like or true-like values. Python’s unittest documentation describes these assertions, subtests and verbose command-line reporting.
Give Claude Code a bounded repair
Start claude in the practice folder and paste:
Read SPEC.md, approvals.py and test_approvals.py.
Run python3 -m unittest -v test_approvals and report the baseline.
Explain why both [] and ["pending"] currently produce True.
Change only approvals.py to satisfy SPEC.md and the unchanged tests.
Preserve the demo. Do not edit tests, add dependencies, delegate,
commit, publish, or access other folders.
Run the same test command and python3 approvals.py after the edit.
Report actual results and explain how the fix enforces both
nonempty evidence and explicit Boolean approvals.
This follows Anthropic’s debugging workflow: supply a reproduction, ask for a focused fix and verify it. The prompt defines scope; it is not a filesystem sandbox. Review the session’s permissions and proposed commands as described in the project-session lesson.
If the agent changes the tests to accept "pending", restore the tests shown above. If it converts every value with bool(), ask it to compare that behavior with the explicit-approval rule. If it builds a reviewer database, bring it back to the one-function exercise.
Review the two parts of the repair
This reference implementation passed all six test methods locally:
def ready_for_review_handoff(decisions):
return bool(decisions) and all(item is True for item in decisions)
Replace only the function; leave the demo below it intact. bool(decisions) establishes that the list contains something. The identity comparison accepts the Boolean True specifically. Both parts are needed for the contract you wrote.
A tempting version is return decisions and all(decisions). For an empty input it returns [], violating the Boolean return contract. Another partial fix, bool(decisions) and all(decisions), still accepts "pending". The existing tests catch both without prescribing how the function must be written. An explicit loop can satisfy the same policy.
After leaving the agent session, run the checks yourself:
python3 -m unittest -v test_approvals
python3 approvals.py
The repaired demo should print:
empty: False
approved: True
text: False
If Python cannot import approvals, run from the folder containing both files. If it reports zero tests, check the test_ method names and the test filename. If tests pass but the demo differs, inspect whether the agent changed the demonstration inputs instead of repairing the helper.
Carry the policy into the caller
The result proves a narrow property: this list contains at least one item, and every item is an explicit approval. It says nothing about who supplied those items, whether a required review was omitted, or whether an approval is still current.
Before adapting this to a real handoff, identify where the list is assembled. A filter that removes pending reviewers could turn incomplete evidence into [True]; this helper would correctly approve that list under its limited contract. Required reviewer identity and completeness need their own checks before calling it.
For the lab, the deliverable is smaller and reviewable: an unchanged test file, a focused helper edit, and command output showing that no decisions no longer means approval.
Sources
Checked November 26, 2026:
- Python built-in functions: all — empty-iterable behavior.
- Python truth-value testing — truthy values and Boolean operators returning operands.
- Python unittest — assertions, subtests and command-line execution.
- Claude Code common workflows — reproduction-led debugging and verification.
Put this to work
Why all() accepts an empty iterable and how that differs from an approval policy.
Try
Give Claude Code a small checklist helper to repair in a disposable folder.
Prove it worked
Run six unchanged tests against the baseline and reference repair.
Keep in view
- Reproduce an empty checklist returning True.
- Specify whether strings and numbers count as approval.
- Keep fixed tests for missing, rejected and fully approved decisions.