2.8 KiB
2.8 KiB
Quality gates — help modal (cbd-tui)
Checklist for the implement stage. Each gate is pass/fail and verified by
reading the code (the automatic tests live in
cbd-tui/src/app/{bindings,help,mod}.rs #[cfg(test)] modules and must pass
via devenv shell -- cargo test -p cbd-tui).
Single source of truth
bindings::BINDINGSis the only encoding of key → action → description.help.rscontains no hardcoded key names or binding descriptions other than the usage paragraph; key labels come frombindings::key_label.- The old
match (app.focus, key.modifiers, key.code)inmain.rsis fully replaced bybindings::lookup+App::dispatch. No key handling remains inmain.rsbesides translatingKeyEvent→Actionand honoringDispatchResult::Quit. - Behavior parity: every binding that existed before the refactor
(main.rs match arms at the pre-change commit) maps to a
BINDINGSentry triggering the same underlying call. Cross-check arm by arm.
Modality
- While
show_helpis true, onlyScope::Helpentries dispatch;qcloses the modal and does not quit the app. Scope::Helpentries never dispatch while the modal is closed.- The overlay is drawn last in
App::renderand uses ratatui'sClearbefore drawing the popup, so pane content never bleeds through.
No panics on user input (AGENTS.md hard rule)
- All
todo!()stubs from api-design are gone frombindings.rs,help.rs, andApp::dispatch. lookup,key_label,dispatch, andhelp::rendercannot panic for anyKeyEventor any frame size (including 1×1); nounwrap/expect/indexing on user-driven paths. Unknown keys are ignored (None), not errors.- Channel send failures in
dispatchare ignored (let _ =), matching the existing module convention — nounwrapontx.send.
Robust key matching
lookupignoresSHIFTwhen comparingKeyCode::Charchords and requires exact matches for all other modifiers (Ctrl+n≠n).- Key events with
kind != KeyEventKind::Pressare still filtered out before lookup (existing behavior preserved).
Code quality
- Public items in
bindings.rsandhelp.rskeep doc comments that match the implemented behavior (update them if implementation details shift). - No new external dependencies in
cbd-tui/Cargo.toml. devenv shell -- cargo fmt --check,cargo clippy(no new warnings, no dead-code warnings remaining forbindings/help), andcargo test -p cbd-tuiall pass.- The
TODO(api-design)marker on theLibraryQueueNextdescription is resolved: the wording matches whatMessageFromUi::QueueTracksactually does server-side.