4.4 KiB
4.4 KiB
Plan — editable and deletable nodes
Ordered tasks for the implement stage. Inputs: architecture/node-editing.md,
stubs across the workspace, gates in quality/node-editing.md. Tests:
devenv shell -- cargo test --workspace (10 failing at plan time = the
target: 5 in tidaldy, 5 in cbd-tui). Use the session-local CARGO_TARGET_DIR
if target/ contains artifacts owned by the repo owner.
1. Term-list mutations (tidaldy)
- Implement
rename_search_term(old, new): under one write lock, ifnewalready exists remove theoldslot (merge); else ifoldexists replace it in place; else pushnew(stale-client forgiveness). Implementremove_search_term(term):retaineverything butterm. Both poison-tolerant likeregister_search_term, no await under the lock. Verify:rename_replaces_in_place_and_merges_duplicatespasses; gate "lock discipline".
2. Provider rename/delete (tidaldy)
rename_lib_node: trim new title →InvalidInputif empty;parse_path(path)?must beTidalPath::SearchTerm(old)elseNotSupported; decode old term,rename_search_term, returnget_lib_node(join_path(parent, encode_segment(new))). Verify:rename_rejects_empty_titles_and_foreign_pathspasses (validation before any network call).delete_lib_node:parse_path(path)?must beSearchTermelseNotSupported; decode +remove_search_term(idempotent); returnget_lib_node(/tidal/search). Verify:delete_rejects_foreign_pathsanddelete_removes_terms_idempotently_and_returns_the_parentpass.- Flag term children in the
Searcharm ofget_lib_node:is_editable: true, is_deletable: truevia struct update. Verify:search_node_lists_created_termspasses (extended assertion).
3. Server handlers (crabidy-server)
- Replace the
todo!()bodies ofrpc.rs rename_library_node/delete_library_node: record span fields, bounded(1) rendezvous with the matchingProviderCommand, map errors exactly likecreate_library_node(NotSupported→failed_preconditionwith an operation-specific message,InvalidInput→invalid_argument, rest →internal). Verify: gates "error mapping" + "bounded rendezvous";cargo check. (Orchestrator routing and the command-loop arms were finalized at stub time — re-read them against the gate rather than re-doing them.)
4. TUI library accessors + marker (cbd-tui)
- Implement
Library::selected_editable/selected_deletablefromlist_state.selected()+ theUiItemflags. Verify:edit_opens_the_overlay_prefilled_only_on_editable_selections,delete_sends_only_for_deletable_selections,rename_submit_sends_the_trimmed_new_title,rename_cancels_and_emptied_buffers_send_nothingpass (dispatch and overlay logic already landed with the stubs). - Render the
[e]/[d]/[ed]suffix for modifiable items inLibrary::render,COLOR_SECONDARYlike[%]. Verify:modifiable_items_are_marked_and_the_rename_overlay_is_labelledpasses; gate "marked in UI".
5. TUI ↔ server wiring (cbd-tui)
RpcClient::rename_library_node: send the rpc, evict the old path and the parent (crabidy_core::parent_path), insert + return the renamed node.delete_library_node: send the rpc, evict the deleted path and the parent, insert + return the returned parent node. Verify: gate "cache eviction" (read; the cache is private, as with create).main.rs poll: replace thetodo!()arms —RenameNodecallsrename_library_node,DeleteNodecallsdelete_library_node; on successReplaceLibraryNode(node), on failureerror!and leave the UI unchanged. Verify: gate "failures never panic".
6. End-to-end + gates sweep
- Exercise the full path against the live API if the local tidal config is available (create a term, rename it, delete it, confirm the parent listing and that a queued search track still resolves a URL); note the outcome in the summary. If unavailable, rely on the offline tests and say so.
- Sweep: no
todo!()left (workspace grep), fmt + clippy + tests green, everyquality/node-editing.mdbox checked, docs updated where behavior shifted. Append the outcome + deviations toplan/summary.md.