Menu

#219 test(docs): assert docs/REASON_CODES.md gives every ReasonCode a real explanation (#191)

closed
nobody
None
2026-08-18
2026-07-31
Anonymous
No

Originally created by: Shihasz

Pull Request

Slice

  • Repo: doberman-core
  • Feature / Slice: [#191] — Enforce docs/REASON_CODES.md completeness
  • Plan reference: doberman_implementation_plan.md

What this PR does

Adds a unit test (tests/unit/test_reason_codes_documented.py) that cross-checks docs/REASON_CODES.md against the ReasonCode enum in src/doberman/models.py.

Specifically, it asserts that:

  1. Every ReasonCode member has a corresponding row in the documentation table.
  2. Every explanation cell ("Meaning") is non-empty, does not merely restate the code name, and does not contain placeholder text (e.g., "TODO", "TBD").
  3. No stale/removed reason codes remain in the documentation.

Closes [#191]

Tests added (run in CI)

  • tests/unit/test_reason_codes_documented.py::test_all_reason_codes_are_documented
  • tests/unit/test_reason_codes_documented.py::test_no_extra_unknown_codes_in_docs

Public-release safety (doberman-core only)

  • [x] Contains nothing from the "not allowed" list: no enterprise/hosted code, no proprietary detection, no customer data, no secrets, no commercial-license code
  • [x] Core still builds/tests/runs with NO enterprise package installed

Security checklist

  • [x] Fails closed on error / uncertainty
  • [x] No secret, full file, or unredacted prompt logged or committed
  • [x] Any guardrail/learning change is raise-only (no silent loosening)
  • [x] Every BLOCK/AUTH carries reason codes + a human explanation
  • [x] doberman-core does not import doberman_enterprise

Edge cases covered / Deviations from plan / Risks introduced

  • Parametrizes checks dynamically over ReasonCode to ensure immediate, isolated feedback in pytest output if any specific code fails documentation checks in the future.
  • Uses standard library parsing (Path and string splitting) with zero external markdown dependencies.

AI Assistance

  • AI assistance was used to help ensure the unit tests compliance and verification. All tests were verified locally via pytest and ruff.

Related

Tickets: #191
Tickets: #231

Discussion

  • Anonymous

    Anonymous - 2026-08-02

    Ticket changed by: fu351

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-08-18

    Originally posted by: fu351

    @Shihasz I re-checked REASON_CODES.md against the enum this week: complete, all 56 codes. Your test from this PR is exactly why that stays true.

    Quick community roll-call: are you in the Doberman Discord? If yes, drop your handle here (or DM me there) so I can match the GitHub side of your work to your Discord name. If not, you're warmly invited: https://discord.gg/Sfy5XGNqty

     

Log in to post a comment.