feat(slides): implement slide.getIncomingLinks + soften bg.listFolders empty case (closes #60) #61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_mik"
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
Closes #60.
Two unrelated bugs surfaced during s91 reproduction work:
slide.getIncomingLinksnot implemented — UI calls 11x per dashboard load (one per slide) since PR #55 introduced the link-source badge; every call returnedMethod not found. Now implemented: walks every deck under the same collection root, scansmetadata.toml.slides[*].source_link, returns{collection, deck, slide}entries pointing at the queried slide.bg.listFolderserrored on missing backgrounds dir — returned-32000 "Not a directory: …"for any deck without backgrounds. Now returns{folders: [], root_files: []}— "no backgrounds" is the steady state for new decks, not an error.Comparison detail (getIncomingLinks)
source_link.slide_namestores whatever the setLink caller passed assrc_slide_slug. Per the existence check indeck_slide_link_set(usesformat!("{}.md", source_slide)), that value must be the full stem (NN_slug); a bare slug would fail at setLink time. So the handler matches the queried slide name againstlink.slide_namedirectly with no prefix stripping. TheSlideLink.slide_namedocstring inhashing.rsclaiming "slug only" disagrees with the consumer indeck.rs:1646— that latent inconsistency from #54 is out of scope here.Out of scope
legacy_param_shimsynthesizespath = <deck_path>/backgroundsforbg.*methods (rpc.rs:399), but lib helpers appendcontent/background/to whatever they receive. The synthesized path therefore never matches the actual filesystem layout — after this PR allbg.listFolderscalls return empty until the shim mismatch is addressed separately. Filing a follow-up if this surfaces.Test plan
cargo build --release -p hero_slides_serverclean (10 pre-existing warnings, none new).python3 scripts/smoke_openrpc.py— 91 methods, METHOD_MISSING 0 (was 0 already; new method wired). PARAM_MISMATCH still 4 ondeckjobs.*(harness can't synthesizejob_id).bg.listFolderscurl reproducer from the issue body returns{folders: [], root_files: []}instead of-32000.hero_slides_intro/07_s92_link_probe→sample_deck/01_intro,getIncomingLinksreturned the linker, deleted probe after.getIncomingLinksfor an unlinked slide returns{incoming_links: []}.Signed-off-by: mik-tf
`slide.getIncomingLinks`: new RPC that walks every deck under the same collection root, loads `metadata.toml`, and returns every `{collection, deck, slide}` whose `source_link.deck_path` + `source_link.slide_name` point at the queried slide. Eliminates the ~11x-per-dashboard-load `Method not found` log spam since the dashboard introduced the "used as link source in N place(s)" badge in PR #55. Comparison detail: `link.slide_name` stores whatever the setLink caller passed as `src_slide_slug`. Per the existence check in `deck_slide_link_set` (`format!("{}.md", source_slide)`), that value is required to be the full stem (`NN_slug`), not a bare slug — no working caller can pass a bare slug because setLink would error on the missing source `.md` file. The handler therefore matches the queried slide name against `link.slide_name` directly. The `SlideLink.slide_name` docstring in hashing.rs (claiming "slug only, survives renumbering") is currently aspirational and disagrees with the consumer in deck.rs:1646; that's a latent inconsistency from #54 that this PR does not attempt to resolve. `bg.listFolders`: returns `{folders: [], root_files: []}` when the target directory is absent rather than `-32000 "Not a directory: …"`. A deck with no backgrounds is the steady state for new decks; the UI catches the error in try/catch and renders empty anyway, but the server logs every failure on every dashboard load. Note unrelated to #60 scope: `legacy_param_shim` synthesizes `path = <deck_path>/backgrounds` for bg.* methods (rpc.rs:399), but the lib helpers internally append `content/background/` to whatever they receive as `deck_path`. So in steady state the synthesized path never matches the actual filesystem layout, and after this fix all `bg.listFolders` calls return empty until the shim mismatch is addressed. Tracked separately if it surfaces. Verified locally: - `python3 scripts/smoke_openrpc.py` — 91 methods, METHOD_MISSING 0 (slide.getIncomingLinks now wired). PARAM_MISMATCH still 4 on deckjobs.* (smoke harness limitation, not dispatch). - bg.listFolders curl reproducer from the issue body returns `{folders: [], root_files: []}`. - Created a probe link from hero_slides_intro to sample_deck/01_intro, confirmed getIncomingLinks returns the linker, cleaned up after. The generated client `openrpc.client.generated.rs` is regenerated by build.rs from `openrpc.json` and picks up both the new method and a prior `SlideRestoreVersionOutput` shape update from #59 that had not been re-checked in. Both are autogenerated artifacts of the checked-in schema. Closes #60 Signed-off-by: mik-tf <mik-tf@users.noreply.forge.ourworld.tf>