feat(tui): wire Entity screen to storage for CRUD & prompt injection #101
No reviewers
Labels
No labels
area:agents
area:ai
area:config
area:dashboard
area:design
area:design-review
area:devtools
area:entities
area:gallery
area:generate
area:image
area:infra
area:meta
area:model-browser
area:navigation
area:presets
area:security
area:sessions
area:settings
area:sharing
area:test
area:ux
area:webhook
area:workdir
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/loom!101
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tui/entity-wire-90"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
EntitiesScreentoGalleryStorageviaAppCtx::storage()— entities load on screen entry and reload on kind switchacreate,rrename,ddelete — all persisted to SQLite viasave_entity/delete_entityEnterto confirm andEscto cancel (cancelling a create removes the placeholder)Enter/iinjects the selected entity's prompt (or name fallback) into the Generate screen via newAppAction::AppendToPromptScreen::append_to_prompt()default trait method, overridden byGenerateScreento comma-append textTest plan
cargo clippy -p loom-tui -- -D warningscleancargo test -p loom-tui— 119 tests passa, type a name, confirm with Enter — entity persists across kind switchesr, edit name, confirm — rename persistsd— entity removed from list and storageEnter— navigates to Generate with prompt appendedCloses charles/loom#90
🤖 Generated with Claude Code
Review — PR #101: Entity screen wired to storage for CRUD & prompt injection
Solid. CRUD + prompt injection + inline rename all work cleanly. Good test coverage.
Concern: single-key delete without confirmation
Pressing
dimmediately deletes the selected entity from storage. For a destructive operation, consider requiring the confirm dialog (from #42) or addchord like the gallery screen does. Accidental deletion with no undo path is risky.Concern:
load_from_storagecalled in bothhandleandrenderBoth methods check
!self.loadedand callload_from_storage. This is defensive but means ifrenderis called beforehandle(which happens on first paint), storage is read during the render path. The read itself is fast (sqlite), but holdingstd::sync::MutexonGalleryStorageduring render could contend with other screens doing writes. Consider loading only inhandle(or on a dedicatedEvent::Tick) and skipping the render-path load.Nit
Entity::new(String::new(), self.kind)creates an entity with an empty name. If the user pressesathenEnterquickly (empty name), the code removes the placeholder — good. But if they pressathen type a name,Entity::newhas already been called with an empty name, and theidis set at creation time. If the id is a UUID that's fine, but if it derives from the name, the id would be stale. VerifyEntity::newuses UUID-based ids.AppHandle.txchanged topub(crate)— same change appears in PRs #107, #109. Coordinate to avoid merge conflicts.8d0fcad0afto71347afa97