58 lines
2.8 KiB
Markdown
58 lines
2.8 KiB
Markdown
# 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
|
||
|
||
- [x] `bindings::BINDINGS` is the only encoding of key → action → description.
|
||
`help.rs` contains no hardcoded key names or binding descriptions other
|
||
than the usage paragraph; key labels come from `bindings::key_label`.
|
||
- [x] The old `match (app.focus, key.modifiers, key.code)` in `main.rs` is
|
||
fully replaced by `bindings::lookup` + `App::dispatch`. No key handling
|
||
remains in `main.rs` besides translating `KeyEvent` → `Action` and
|
||
honoring `DispatchResult::Quit`.
|
||
- [x] Behavior parity: every binding that existed before the refactor
|
||
(main.rs match arms at the pre-change commit) maps to a `BINDINGS` entry
|
||
triggering the same underlying call. Cross-check arm by arm.
|
||
|
||
## Modality
|
||
|
||
- [x] While `show_help` is true, only `Scope::Help` entries dispatch; `q`
|
||
closes the modal and does not quit the app.
|
||
- [x] `Scope::Help` entries never dispatch while the modal is closed.
|
||
- [x] The overlay is drawn last in `App::render` and uses ratatui's `Clear`
|
||
before drawing the popup, so pane content never bleeds through.
|
||
|
||
## No panics on user input (AGENTS.md hard rule)
|
||
|
||
- [x] All `todo!()` stubs from api-design are gone from `bindings.rs`,
|
||
`help.rs`, and `App::dispatch`.
|
||
- [x] `lookup`, `key_label`, `dispatch`, and `help::render` cannot panic for
|
||
any `KeyEvent` or any frame size (including 1×1); no `unwrap`/`expect`
|
||
/indexing on user-driven paths. Unknown keys are ignored (`None`), not
|
||
errors.
|
||
- [x] Channel send failures in `dispatch` are ignored (`let _ =`), matching
|
||
the existing module convention — no `unwrap` on `tx.send`.
|
||
|
||
## Robust key matching
|
||
|
||
- [x] `lookup` ignores `SHIFT` when comparing `KeyCode::Char` chords and
|
||
requires exact matches for all other modifiers (`Ctrl+n` ≠ `n`).
|
||
- [x] Key events with `kind != KeyEventKind::Press` are still filtered out
|
||
before lookup (existing behavior preserved).
|
||
|
||
## Code quality
|
||
|
||
- [x] Public items in `bindings.rs` and `help.rs` keep doc comments that match
|
||
the implemented behavior (update them if implementation details shift).
|
||
- [x] No new external dependencies in `cbd-tui/Cargo.toml`.
|
||
- [x] `devenv shell -- cargo fmt --check`, `cargo clippy` (no new warnings,
|
||
no dead-code warnings remaining for `bindings`/`help`), and
|
||
`cargo test -p cbd-tui` all pass.
|
||
- [x] The `TODO(api-design)` marker on the `LibraryQueueNext` description is
|
||
resolved: the wording matches what `MessageFromUi::QueueTracks` actually
|
||
does server-side.
|