Originally created by: fu351
Doberman now has (or will shortly have) four independent --json/--jsonl CLI additions: scan --json (#178), doctor --json (#179), log --jsonl (#180), and policy-history --json (#190) — each independently restates the same contract in its own acceptance criteria ("emit exactly one valid JSON document/line on stdout, no Rich table or heading text mixed in, preserve redaction, deterministic ordering") and each PR will hand-roll its own "parse stdout with json, assert it's clean" test logic. Add (a) a "JSON output conventions" section to docs/CLI.md (#185) that states this contract once — flag naming (--json for a document vs --jsonl for one-object-per-line), the redaction guarantee, and the determinism guarantee — and (b) one shared pytest helper in tests/conftest.py (e.g. assert_json_stdout(result, jsonl=False)) that asserts "stdout is exactly one/N valid JSON value(s) and nothing else," for the four commands' tests to import instead of re-implementing the same parse-and-assert logic.
Requires reading all four sibling issues/PRs carefully enough to state one contract that's actually true of each (a JSON array and a JSON-Lines stream are genuinely different shapes — the helper must handle both without hiding that difference), without changing any of the four commands' behaviour.
docs/CLI.md — from issue [#185]; add a "JSON output conventions" section.tests/conftest.py — add the shared assertion helper here.src/doberman/cli/main.py — scan, doctor, log, policy_history commands, as their JSON flags land.docs/CLI.md documents the shared JSON-output contract in one place (flag naming, array vs JSON-Lines, redaction, determinism).tests/conftest.py gains one reusable assert_json_stdout-style helper covering both the single-document and JSON-Lines cases.scan --json, doctor --json, log --jsonl, policy-history --json) may optionally be updated to use the shared helper, but this issue does not require rewriting PRs that already merged with their own equivalent assertions.ruff check . && ruff format --check . and lint-imports passpytest passespytest tests/ -k "json" -v
--json/--jsonl flag to any command yourself — this issue only documents and provides a shared test helper for flags added by #178/#179/#180/#190.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.
Tickets: #180
Tickets: #185
Tickets: #226
Tickets: #230
Tickets: #297
Tickets: #368
Tickets: #396
Ticket changed by: fu351