T09 Deny panic classes
Question
The standard denies, individually, the classes of runtime bug ADR 6/7/8 remove
at compile time: unwrap_used, expect_used, panic, todo, unimplemented,
exit, dbg_macro. Cerebro’s AGENTS.md already says “no unwrap in production”
but enforces it by hand-grep in the pre-PR checklist, not mechanically (~460 raw
matches, fewer in real production code).
Approach per crate (core → mcp → tui → cerebro):
clippy.toml(T02) already permits these in#[cfg(test)].- Convert production aborts to
Result/eyrepropagation. mainreturnsExitCodeinstead ofexit(ADR 6).print_stdout/print_stderrdenied workspace-wide; the binary crates (cerebro,cerebro-mcp,cerebro-tui) carry a crate-level allow for the output they legitimately produce (the library cannot talk to the world, only the binary can, ADR 8).
Exit predicate
cargo clippy --workspace green with the panic classes denied in [workspace .lints.clippy]; production code has no unwrap()/expect()/panic!()/exit()
outside tests and the binary-crate print allows. The AGENTS.md grep step becomes
redundant (T17 removes it).
Resolution
Done 2026-10-31. The panic classes are denied workspace-wide in
[workspace.lints.clippy]: unwrap_used, expect_used, panic, todo,
unimplemented, exit, dbg_macro, print_stdout, print_stderr.
The “~460 backlog” estimate was wrong and the map/fog correction matters:
a grep of the raw text counts test code that clippy.toml exempts and
unwrap_or-shaped calls that no lint fires on. What production actually held:
generators/dashboard.rs: 8writeln!(card, ...).unwrap()on an infallibleStringtarget →let _ =(the Result can never beErr).generators/journal.rs: oneactivity.get(date).unwrap()wheredatescame fromactivity.keys(); restructured to iterate entries, making the total absence of the panic structural rather than asserted.cerebro(the command-line binary): 27 print sites → one crate-root#![allow(print_stdout, print_stderr, reason = "ADR 8")]inmain.rs. A[lints.clippy]per-crate override is impossible withworkspace = true(cargo rejects the merge), discovered the hard way when a manifest error masqueraded as a zero-findings clippy sweep, which is precisely why this ticket’s evidence runsjust qualityand not piped jq-summary one-liners alone.- test code that legitimately prints: two
#[cfg(test)]modules (collectors smoke test, TUI journal smoke test) carry a scoped#[allow(print_stderr, reason=…)];tests/cucumber.rsextends its file allow tounwrap_used/expect_used/panic(BDD steps lack#[test]attributes, so clippy’s test exemptions cannot reach them);tests/integration.rsgets a function-scoped allow on itsgit()helper. exit,todo!,unimplemented!,dbg!: zero findings; the habit was already gone before the deny made it mandatory.
Gate evidence: cargo clippy --workspace --all-targets clean with the panics
denied; just quality green (fmt, clippy, workspace tests, doctests, release
suite, vale 0/0); cucumber 76 scenarios / 409 steps pass; cerebro status
runs. The AGENTS.md hand-grep pre-PR step is now mechanically redundant;
T17 removes it.