Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 15: Delegation and Verification

Week 15 / Lesson 2

Verifying work independently

Use evidence that can falsify a producer’s claims.

Section 2.1 1 of 7

Overview

Focus

Use evidence that can falsify a producer’s claims.

Your route through the lesson

  • 2.2 Source checks, calculations, and executable behavior
  • 2.3 Verification against an exact artifact version
  • 2.4 False approvals and bounded correction loops
  • 2.5 Put it into practice
  • 2.6 Guided comparison
  • 2.7 A convincing report with a failing fixture

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 2.2 2 of 7

Source checks, calculations, and executable behavior

Focus

Choose evidence that can contradict a producer rather than repeat its narrative.

Independent verification starts with the requirement and original evidence. Source inspection checks whether a claim matches authoritative inputs. Recalculation reconstructs a numeric result. Executable checks observe what the produced program actually does. Each method can expose different defects; a polished explanation is not a substitute for any of them.

Suppose a function claims to sum a list but returns its length. The input [1, 1] produces 2 under both methods, so a superficial test passes. The input [2, 5] separates them: sum is 7 while length is 2. This is a discriminating test because competing implementations predict different results. Add an empty list and mixed negative and positive values to inspect boundary behavior.

The verifier should calculate expected results from the stated requirement before seeing the candidate's output. Otherwise it may copy the producer's mistake into its expected values. A different agent can help, but independence comes from evidence and method. Testing trusted fixed functions in a local fixture is safe; executing arbitrary agent-generated code requires an actual restricted runtime, not simply a reviewer saying it looks harmless.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A sum function returns len(values). Which case distinguishes it from correct addition?
2. Where should expected outputs come from?
3. A reviewer says arbitrary generated code looks safe. Is that runtime isolation?

Section 2.3 3 of 7

Verification against an exact artifact version

Focus

Bind every verification result to exact artifact and input identities.

A verification result is a statement about a particular artifact under particular inputs. If the artifact changes after testing, the previous pass may no longer apply. Record content digest, contract version, test version, input version, and observed outputs. This turns accepted into a reproducible claim rather than a floating label attached to a filename.

The standard library hashlib computes content digests. sha256 consumes bytes and produces a fixed-size digest; hexdigest renders it as text. Matching digests are useful for detecting changed content, but a digest alone does not establish trust or correctness. A malicious producer can hash malicious bytes just as easily as good bytes.

In the worked fixture, a reviewed result file names corrected. After review, its content changes to changed. The new digest differs, so the old receipt cannot approve the current file. The executor should recheck identity immediately before using an accepted artifact, closing the gap between verification and consumption. If tests themselves change, preserve the new test version and explain why; quietly replacing a failing test destroys the meaning of the earlier acceptance claim.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A file passes tests, then its bytes change. What happens to the old pass?
2. A SHA-256 digest matches a file. What does that alone establish?
3. Which identities belong in a reproducible test receipt?

Section 2.4 4 of 7

False approvals and bounded correction loops

Focus

Limit correction loops and measure false approvals explicitly.

A false approval occurs when a verifier accepts work that violates the requirement. It can arise from weak examples, copied expectations, omitted failure paths, or testing a different artifact from the submitted one. A passing suite is evidence relative to its coverage, not proof that no defect exists.

Use a bounded correction loop: run independent checks, return concrete failures, permit a declared number of corrections, and stop at acceptance or escalation. For a two-attempt budget, the initial candidate and one revised candidate exhaust the budget. Define this counting rule explicitly so attempts cannot be relabeled indefinitely as refinements.

The verifier should distinguish failure to produce an artifact from a produced artifact that fails a check. Preserve observed input, expected output, actual output, and exact candidate identity. A correction should target the failed mechanism without weakening the acceptance condition. If a sum function counts elements, replacing the expected total 7 with 2 makes the test green while leaving the defect intact. The evaluator must remain outside the producer's write authority, or the improvement loop can optimize approval instead of the intended behavior.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A sum implementation returns 2 for [2,5]; expected output is changed from 7 to 2. What happened?
2. A budget allows two total candidates. Initial and revised candidates both fail. Next state?
3. A verifier accepts a defective candidate because its only case is [1,1]. What is this?

Section 2.5 5 of 7

Put it into practice

Focus

Run a deliberately weak check, strengthen it, and stop the correction loop.

Download week15.py, save it in an exercise folder, and run python week15.py --lesson 2. This single practice executes two trusted fixed functions in a temporary workspace. It requires no packages or model and finishes within seconds on a small processor. The wrong function returns list length; corrected returns the sum. No arbitrary generated source is executed.

The initial assertion uses [1, 1], intentionally showing a false approval. The stronger cases are [2, 5] expecting 7, an empty list expecting 0, and [-2, 3] expecting 1. all evaluates whether every case comparison is true. The loop increments attempts, checks each candidate, and uses break to stop immediately after acceptance.

The correct implementation is selected on attempt 2. The script then writes a result artifact, computes its digest, changes the file, and asserts that the digest differs. Expected output states that independent cases rejected count-as-sum, the two-attempt loop stopped, and the changed artifact invalidated review. The exercise combines correction and identity into one workflow rather than adding a separate coding assignment.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. What does all(candidate(values) == expected for ...) require?
2. The second candidate passes and break runs. What does break do here?
3. Why does the fixture change the artifact after computing its digest?

Section 2.6 6 of 7

Guided comparison

Focus

Explain the false approval, repair, and exact-version rejection in the worked run.

The first check is deliberately inadequate: wrong([1, 1]) returns len([1, 1])=2, matching the true sum by coincidence. The stronger first case [2, 5] immediately exposes the defect because length 2 differs from expected sum 7. The mixed-sign case also prevents a simplistic positive-only assumption from defining the entire behavior.

On the second attempt, corrected returns sum(values), producing 7, 0, and 1. All comparisons pass, so the loop accepts corrected and stops. This is evidence for the stated cases, not a proof over every possible Python object. The contract concerns numeric lists; unsupported input types would need an explicit requirement and checks before any broader claim.

The result artifact then changes from corrected to changed. Its digest no longer matches the reviewed one. This demonstrates a different failure class from wrong arithmetic: even good testing becomes irrelevant if the executor consumes another artifact. A robust acceptance record must protect both behavioral expectations and identity. Fixing one class does not eliminate the other, so the worked comparison reports them separately rather than compressing every failure into code quality.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A required sum function instead returns list length. Why does its test [1,1] expecting 2 pass?
2. Corrected passes three numeric-list cases. What scope is supported?
3. A correct function is tested but another file is submitted. Which failure class remains?

Section 2.7 7 of 7

A convincing report with a failing fixture

Focus

Prefer executable counterevidence over a convincing completion report.

A delegate returns a polished report claiming an invoice total function handles every row and all edge cases. It includes diagrams and a confident statement that review passed. An independent fixture sends [4, 9] and receives 2. The required sum is 13. That concrete contradiction outweighs the report's fluency.

The worked reviewer records the exact candidate digest, input [4, 9], expected 13, and actual 2. It classifies the likely mechanism as counting rows instead of summing amounts, then requests a bounded correction. It does not accuse the producer of intent; the useful finding is observable behavior. If the allowed correction budget is exhausted, the result remains unaccepted with a clear failure record.

Reports still have value when they index evidence accurately. A concise report linking to the checked artifact and showing per-case outputs helps an integrator reproduce acceptance. The distinction is whether prose summarizes observations or substitutes for them. A statement that tests passed must identify which tests and which bytes. Without that link, the claim cannot be independently confirmed and should not authorize deployment or further consequential effects.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A polished report claims a sum function works; [4,9] returns 2. Which governs acceptance?
2. Which review finding is actionable?
3. When is a test-passed statement useful?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Integrating and accepting a team result →