Files
sisi/verifiers/intent/acceptance-examples.md
T
swaitsandClaude Fable 5.2 2fc1fe9c2d
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s
sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:29:02 -07:00

61 lines
2.6 KiB
Markdown

---
id: acceptance-examples
title: Acceptance examples agreed with the human up front and made executable
answers: Does the program give the exact results the human said they wanted for concrete cases?
rung: 3
section: intent
languages: any
kinds: general, money, parsing
cost: low
detect:
ran_here: no
verified: docs
---
Note: there is no tool. The example runner below is plain test code; it was
not run here as a separate artefact. `verified: docs` reflects that the method
is standard specification by example.
## Use when
- The request is a behaviour in words ("round fees to the nearest cent", "a late invoice gets a reminder"). Words are ambiguous; examples are not.
- The human will not review code but will read a table of inputs and outputs.
- You have to choose between readings of the request and want the human's choice fixed before you build.
## Do not use when
- The claim is "this holds for all inputs". Examples show cases only; use a property or proof (rung 1 or 2).
- The behaviour is visual or tasteful; see `pairwise-comparison`.
## Set up
Write `acceptance/examples.json` and show it to the human once (core rule 5: one
round of confirmation, with your default stated). Edge cases first: zero,
empty, the largest, a tie, a negative, an invalid input and what it must do.
## Minimal example
`acceptance/examples.json`:
[
{"name": "tie rounds to even", "in": {"amount": "2.675", "dp": 2}, "out": "2.68"},
{"name": "zero", "in": {"amount": "0", "dp": 2}, "out": "0.00"},
{"name": "negative", "in": {"amount": "-1.005", "dp": 2}, "out": "-1.00"},
{"name": "bad input", "in": {"amount": "abc", "dp": 2}, "error": "invalid amount"}
]
`acceptance/test_examples.py` loops over the file, calls the product through its
public entry point, and fails with the example's `name`.
## Run
python3 -m unittest discover -s acceptance -v
Passing looks like: one `ok` per example, exit 0. Failure names the example,
the expected and the actual. Never edit an expected value to make a run pass;
a changed expectation goes back to the human as a contract amendment.
## As a contract check
{"id": "acceptance-examples", "claim": "Every example the human agreed gives the stated result", "kind": "general", "rung": 3, "cmd": "python3 -m unittest discover -s acceptance", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 120}
## What a pass does not prove
Only the cases listed. Check that the examples can fail: change the code on
purpose (swap round-half-even for round-half-up) and see at least one fails.
Examples you wrote and the human skimmed are weak; flag which the human
confirmed. Add a property test for the rule behind them where one exists.