5.4 KiB
5.4 KiB
Quality gates — queue selection, visual mode, and the register
Criteria an implementation of architecture/queue-register.md must satisfy.
Automated coverage lives in cbd-tui/src/app/list.rs
(carry_marks_tests), cbd-tui/src/app/register.rs,
cbd-tui/src/app/mod.rs (dispatch), and the mirrors of those in
cbd-web/src/state.rs.
Data safety (highest priority)
- G1 — A delete never removes an unmarked track. The positions sent
to
Removeare computed from the newest queue snapshot, never from an index remembered across an update. (tests: thecarry_markssuite plusdeleting_marked_rows_sends_their_current_positions.) - G2 — Marks follow their track across a snapshot. Append,
removal before a mark, removal of the marked track, streaming resolve,
duplicate paths, wholesale replacement, empty queue, and a first snapshot
all behave as the
carry_markstests state. Divergence clears rather than guesses. - G3 — No panic on any mark bookkeeping. Mismatched lengths, an
empty queue, a cursor past the end, and marks on a filtered-out row are
all handled without indexing panics. (test:
a_short_mark_vector_is_tolerated, plus the empty-queue dispatch tests.) - G4 —
c/Cwrite the register before clearing. Clearing 200 tracks is recoverable with onep. (tests:clear_fills_the_register_with_what_it_dropped.)
Register semantics
- G5 — Only
y,d,c,Cwrite the register. Marking (s), visual mode, cursor movement,a/L/Enter,w/W, and every playback action leave it untouched. (test:marking_and_queueing_do_not_touch_the_register.) - G6 — A write overwrites. One slot, no history, no numbered registers. An empty write clears it.
- G7 — Paste leaves the register intact, so the same yank can be
pasted repeatedly. (test:
pasting_twice_inserts_twice.) - G8 —
pinserts after the cursor,Pbefore it, anddfollowed byPrestores the deleted rows to their original positions. (tests:paste_after_and_before_use_the_right_position,delete_then_paste_before_restores_the_positions.) - G9 — Paste on an empty register is a no-op, not an empty
Insertround trip. (test:pasting_an_empty_register_sends_nothing.) - G10 — The register holds paths, and only labels for display. No
label ever reaches the server;
Insertcarries paths in yank order.
Selection and visual mode
- G11 — The queue's
s,v,Vbehave exactly as the library's:vandVare the same action, entering anchors at the cursor and marks it, movement paints the anchored range so moving back reverses,Escand any non-movement action leave visual mode while keeping the marks. (tests: the queue mirrors of the library's visual-mode suite.) - G12 — Every queue row is markable; the library's
is_queablegate does not leak into the queue (queue rows carryis_queable: false). Conversely the library still refuses to mark an unqueueable row. - G13 — Marks live on the full list. A marked row hidden by the
/filter still counts foryandd. (test:a_filtered_out_marked_row_is_still_deleted.) - G14 —
yanddconsume the marks they acted on (the pane comes back unmarked), as queueing already does. - G15 — With nothing marked,
y/dact on the cursor row only — today'sdbehaviour is preserved. - G16 — Mark and visual logic exists once per client.
LibraryandQueueboth go throughMarkedPane; no second copy of the paint rule.
Both clients
- G17 —
cbd-webreaches parity in the same change: library visual mode (which it lacks today), queue marks, queue visual mode,y,p,P, andc/Cfilling the register. - G18 — The web client's queue marks reconcile by the same rule. It owns no queue list, so its marks sit beside the server signal; the reconciliation cases from G2 are tested there too.
- G19 — Both key tables and both help overlays list the new keys,
and
cbd-web's keymap tests keep their lockstep with itsHELPtable. - G20 — The TUI's binding table stays the single source of truth for its help modal (no hand-maintained duplicate list).
Documentation
- G21 —
p's changed meaning is documented as a change, in the book's TUI page, the web page, and the README walkthrough: it pastes the register, and the browse→insert-here flow is nowythenp. - G22 — The register's limits are stated: per client, in memory, one slot, and paste re-resolves so a stale path may not come back.
- G23 — Key tables match the code. Every new binding appears in
docs/src/clients/tui.md,docs/src/clients/web.mdwhere it lists keys, and the README's usage section.
Hard rules
- G24 — No panics on user input or empty state anywhere in the new
paths;
todo!()/unimplemented!()from the stub stage are all gone. - G25 — No new server surface. No
.protochange, no new RPC, no change tocrabidy-server. The feature is two clients and the two existing calls (Insert,Remove). - G26 — Clippy clean under
-D warningsforcbd-tuiand forcbd-webon both the native andwasm32-unknown-unknowntargets (mod apponly compiles for wasm), and the trunk bundle still builds.