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
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>
57 lines
2.6 KiB
Markdown
57 lines
2.6 KiB
Markdown
---
|
|
id: domain-evidence-report
|
|
title: Printing the domain's own reports as evidence a behaviour change is right
|
|
answers: Do the numbers a domain expert would read (trial balance, P&L, balance sheet) come out right after my change?
|
|
rung: 3
|
|
section: intent
|
|
languages: any
|
|
kinds: money, general
|
|
cost: low
|
|
detect:
|
|
ran_here: no
|
|
verified: docs
|
|
---
|
|
|
|
Note: modelled on how a reference project (an accounting program)
|
|
shows its books after each change. Not run here.
|
|
|
|
## Use when
|
|
- You changed behaviour whose correctness a domain expert judges by a standard report: accounting (trial balance, P&L, balance sheet), inventory (stock on hand), billing (statement), scheduling (calendar).
|
|
- The human cannot read the diff but can read the report.
|
|
- A bug fix must be shown to correct the figure the user complained about.
|
|
|
|
## Do not use when
|
|
- The report is generated by the same code you changed and you have no independent expectation. Then it shows what the code does, not what it should do.
|
|
|
|
## Set up
|
|
Build a small, fixed scenario (a few entries or orders) whose correct report you
|
|
can compute by hand or already know. Keep the inputs in the repository.
|
|
|
|
## Minimal example
|
|
Scenario: a $100 sale and a $40 expense in the same period. Expected, by hand:
|
|
revenue 100.00, expense 40.00, net income 60.00, and a trial balance whose debit and
|
|
credit totals both equal 140.00.
|
|
|
|
$ product report trial-balance --period 2026-01 > out/tb.txt
|
|
$ grep -E "^(TOTAL|Net income)" out/tb.txt
|
|
TOTAL 140.00 140.00
|
|
Net income 60.00
|
|
|
|
## Run
|
|
product report trial-balance --period 2026-01 | diff -u expected/tb.txt -
|
|
product report profit-and-loss --period 2026-01 | diff -u expected/pl.txt -
|
|
|
|
Passing looks like: empty diff, exit 0. Failure is a diff showing which line
|
|
differs. Print the report in the final answer so the human can read it. The
|
|
expected file must come from hand calculation or an independent source, and the
|
|
check that the report foots (debits equal credits; assets equal liabilities plus equity) is a built-in test of itself.
|
|
|
|
## As a contract check
|
|
{"id": "tb-expected", "claim": "The trial balance for the fixed scenario matches the hand-computed report", "kind": "money", "rung": 3, "cmd": "product report trial-balance --period 2026-01 | diff -u expected/tb.txt -", "expect": {"exit": 0}, "timeout_s": 60}
|
|
|
|
## What a pass does not prove
|
|
Only the scenario. Include the cases that change the report: a reversal, a
|
|
period boundary, a rounding tie. An expected file generated by running the
|
|
product proves nothing; say how you derived it. For money cores, pair with a
|
|
property or proof that the invariants hold for all inputs.
|