Skip to content

A use case's scenario executes against the real tool in a disposable repository, every step's exit code and output are asserted, and the normalised evidence is what the site shows

A use case carries a scenario: a prepared repository and real invocations of

declared statusdeclared status: guaranteed Declared deterministic and blocking, implemented, and naming the behavioural test that is to prove it. Whether a recorded run supports it is the evidence verdict, shown beside it.

recorded evidencerecorded evidence: not run Declared guaranteed, and not supported by a recorded run: the test is named, and no passing run of the current inputs is recorded. how evidence is recorded

majordomus usecase run writes .ai/local/evidence/use-cases/<id>.json; scripts/generate-site-data runs the same scenarios and embeds the evidence into site/data/generated/catalogue.json, so --check proves the pages show what the tool did. Paths, timestamps, ids, hashes and durations are normalised; nothing behavioural is.

What it means

A use case carries a scenario: a prepared repository and real invocations of bin/majordomus with their expected exit codes and output. majordomus usecase run executes it, step by step, in a temporary repository the setup script prepared, and records every step's command, exit code, output and assertions as evidence under the local half. The site generator runs the same scenarios and embeds the evidence, so a page that shows what a command printed shows what the tool did when the page was made, and scripts/generate-site-data --check proves it again in CI.

How it works

mj_uc_run_one in lib/usecase.sh creates the repository, sources the setup script from the fixtures (shared with the command demonstrations), runs each step with argv from the file (never a shell string), captures the combined output, asserts the exit code and every stdout_contains, stdout_not_contains, files_exist and files_contain expectation, normalises the output (the repository's path, the tool's path, the home directory, timestamps, task and session ids, record hashes, durations) and writes .ai/local/evidence/use-cases/<id>.json. The generator drops the timings and embeds the rest in site/data/generated/catalogue.json; the page template renders it.

How to see it

majordomus usecase run                          # every scenario; exit 10 on a failed step
majordomus usecase run prove-a-rule-is-enforced --keep
majordomus usecase show prove-a-rule-is-enforced   # the file and its last evidence
jq '.steps[] | {command, exit, result}' .ai/local/evidence/use-cases/prove-a-rule-is-enforced.json

What it does not cover

Evidence proves the scenario's assertions, nothing more: a scenario that asserts little proves little. Normalisation replaces values that vary by machine and time; a behaviour that differs by machine is not hidden by it and fails the check.

Why it exists

A pasted transcript in documentation is fiction the day after it is pasted. Evidence generated by executing the scenario, and checked against a clean regeneration, cannot drift from the tool.

Detail rendered from docs/claims/use-case-evidence.md.

From the statement to the proof

  1. 1 · the public statement

    A use case's scenario executes against the real tool in a disposable repository, every step's exit code and output are asserted, and the normalised evidence is what the site shows

    Made on Use cases, Doctor.

  2. 2 · the canonical claim

    use-case-evidencedeclared status: guaranteed in docs/CLAIMS.yaml

    Defined in read it on this site · docs/USE_CASES.md

  3. 3 · the implementation

    lib/usecase.sh · majordomus usecase

  4. 4 · the test and the scenarios

    Test: test/cases/94_use_cases.sh

  5. 5 · the recorded runs

    recorded evidence: not run how evidence is recorded

Verify it yourself

The test runs in a disposable temporary repository and asserts the behaviour, not a string in the source.

from a clone of the repository
bash test/run.sh 94_use_cases

Where this claim is used

Related claims same implementation

The moments this answers

Searches the titles and descriptions of every page this site publishes.