Menu

#191 tests: assert docs/REASON_CODES.md gives every ReasonCode a real explanation

closed
nobody
2026-08-02
2026-07-30
Anonymous
No

Originally created by: fu351

What

Every BLOCK/AUTH must carry a reason code and a human explanation — issue [#186]'s docs/REASON_CODES.md catalogue is the reference for the second half of that contract. Reason-code explanations in Doberman are inline free text at each call site (there is no central ReasonCode -> explanation map in code), so this issue enforces quality at the documentation layer instead: add a test that parses docs/REASON_CODES.md's table and asserts every ReasonCode member has a row with a non-empty "what it means" cell that isn't a placeholder (e.g. not empty, not just the code name restated, not "TODO"/"TBD").

Difficulty: level-4

Small script/test that reads a markdown table (a simple line-split/regex parse is enough — no markdown library needed) and cross-checks it against list(ReasonCode). Good follow-on from [#186] — that one builds the catalogue this test enforces; do this one after [#186] is merged.

Safety constraints (do not weaken these)

  • The explainability contract: every reason code must remain human-explainable. Do not delete or rename any ReasonCode member to make the test pass — if a gap is found, fix docs/REASON_CODES.md, not the enum.

Starting files

  • docs/REASON_CODES.md — the table this test parses (from issue [#186]).
  • src/doberman/models.pyclass ReasonCode(StrEnum) (line 204), the source of truth for the full code list.
  • New test in tests/unit/ (e.g. test_reason_codes_documented.py).

Acceptance criteria

  • [ ] Test fails if any ReasonCode member is missing from docs/REASON_CODES.md.
  • [ ] Test fails if any row's explanation is empty or a placeholder (equal to the code name, "TODO", "TBD", or similar).
  • [ ] Do not change any explanation text in this issue — a follow-up handles rewording; this issue only adds the check.
  • [ ] Existing behaviour unchanged (no test weakened, no output format broken)
  • [ ] ruff check . && ruff format --check . and lint-imports pass
  • [ ] pytest passes

How to validate

pytest tests/unit/test_reason_codes_documented.py -v

Out of scope

  • Do not touch docs/CLI.md or any other doc page.
  • Do not change any ReasonCode value.

Notes for contributors

New here? Start with CONTRIBUTING.md. Issues are labelled level-1 (docs only) through level-10 (new subsystem) — pick one at your level and climb. Comment to claim an issue before starting.

Related

Tickets: #186
Tickets: #219

Discussion

  • Anonymous

    Anonymous - 2026-07-31

    Originally posted by: Shihasz

    I'm working on this now. Will link a PR shortly once the tests are ready

     
  • Anonymous

    Anonymous - 2026-08-02

    Ticket changed by: fu351

    • status: open --> closed
     

Log in to post a comment.