planner: oschema CRUD ergonomics — N+1 workspace load, dead _list stub, stale currency-delete comments #30
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_planner#30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Surfaced as a byproduct of the hero_collab oschema architecture review (2026-06-15). Low priority — planner is shipped and works; these are ergonomics/clarity debt, not functional bugs. Filing so the lessons aren't lost.
Context
The migrated planner makes all 12 entities
[rootobject]. The macro's generated_list/_findreturn sid-string arrays (not full objects) and_findtakes an opaque filter. That's a fine fit for planner's typed-column storage (no data loss), but the workspace-scoped UI pays an ergonomic cost:1. N+1 on every workspace load (perf debt)
crates/hero_planner_web/src/index.html:362-369(listEntities) reconstructs each scoped list via_find(sids) then_getper item — its own comment: "Server*_list_fullstubs return empty, so we reconstruct here." So opening a workspace is 11 entity types x (1_find+ N_get) round-trips. Parallelized, but still N+1 over the socket.2.
_listis a dead stubcrates/hero_planner_server/src/rpc/main_impl.rs:341-343— generated_listreturnsvec![]. Nothing uses it; it's dead surface.3.
_list_fullis mis-scopedmain_impl.rs:345-367— iterates ALL workspaces with no scope param (and is capped at 200). Correct only for the top-levelworkspace_list; useless/footgun for scoped entities.Lesson (transferable from the collab review): where a workspace-scoped full-object list is a primary access pattern, add an explicit custom
entity_list(workspace_sid) -> [Entity]service method rather than relying on generated_find+_get. Removes the N+1. (Likely moot if the Dioxus rewrite #18 reworks this layer — so defer unless that slips.)4. Stale/contradictory comments (cosmetic)
index.html:506-510, 522-523still say currency-delete "cannot work" / "Best-effort". This was already fixed bybdb3935(CurrencyRate.id now in the list output; server deletes by rowid viaparse_sid). The delete works; only the misleading comments remain. Clean them up to avoid confusion.Explicitly NOT recommended
Reversing planner's rootobjects (the collab review's all-custom conclusion) does not apply here: planner stores typed SQL columns (
INSERT INTO swot_items (title, description, kind, ...)), so it has none of collab's blob/array/derived/side-effect/caller_id drivers. Its entities genuinely fit[rootobject]. Leave the data model alone.Ref: hero_collab
docs/superpowers/collab-oschema-review-2026-06-15.md.