feat(server): wire collection.* and rpc.examplesPath in JSON-RPC dispatch #48

Merged
mik-tf merged 1 commit from development_mik into development 2026-05-10 00:21:53 +00:00
Owner

Closes the dispatcher-vs-schema gap surfaced during session 85's hero_slides#47 validation.

Bug

The OpenRPC schema (openrpc.json), generated client, and JS dashboard all referenced collection.list/get/register/unregister/rescan and rpc.examplesPath, but crates/hero_slides_server/src/rpc.rs's match req.method.as_str() had no arms for them. Result: every collection-CRUD entry point in the UI ("Open Example Deck", "+ New Collection", Rescan, Unregister) silently no-op'd because the JS catch swallowed the -32000 Method not found error.

Fix

Added six handlers wired to the existing state.registry (CollectionRegistry) plus the hero_slides_lib::scan_collection / deck_info helpers:

Method Behavior
rpc.examplesPath Resolves bundled examples via HERO_SLIDES_EXAMPLES_DIR env var, then a CARGO_MANIFEST_DIR-relative fallback.
collection.list name + root + registered_at (epoch seconds parsed from the registry's RFC3339) + deck_count; per-row warning when scan fails.
collection.get Same shape plus decks: [DeckSummary].
collection.register Wraps registry.register_collection, returns resulting deck list.
collection.unregister Wraps registry.unregister_collection, returns { removed: bool }.
collection.rescan Looks up registered root and re-scans, no registry write.

Verification

Full stack-up validated locally: proc → router → db → mycelium → aibroker → slides.

  • All 5 collection.* methods + negative case smoke clean via curl on rpc.sock.
  • Hero Browser MCP smoke against http://127.0.0.1:9988/hero_slides/admin:
    • Before fix: "Open Example Deck" button silently failed; Collections counter stayed at 0.
    • After fix: Collections 0→1, hero_slides_examples registered with 2 decks (hero_slides_intro + sample_deck), navigation to deck route works, all dashboard counters update (Decks 2, Slides Total 12 / Generated 6 / Pending 6), console 0 messages.

No schema changes, no breaking changes — wires up methods the schema already declared.

Refs:

Closes the dispatcher-vs-schema gap surfaced during session 85's hero_slides#47 validation. ## Bug The OpenRPC schema (`openrpc.json`), generated client, and JS dashboard all referenced `collection.list/get/register/unregister/rescan` and `rpc.examplesPath`, but `crates/hero_slides_server/src/rpc.rs`'s `match req.method.as_str()` had no arms for them. Result: every collection-CRUD entry point in the UI ("Open Example Deck", "+ New Collection", Rescan, Unregister) silently no-op'd because the JS catch swallowed the `-32000 Method not found` error. ## Fix Added six handlers wired to the existing `state.registry` (`CollectionRegistry`) plus the `hero_slides_lib::scan_collection` / `deck_info` helpers: | Method | Behavior | |---|---| | `rpc.examplesPath` | Resolves bundled examples via `HERO_SLIDES_EXAMPLES_DIR` env var, then a `CARGO_MANIFEST_DIR`-relative fallback. | | `collection.list` | name + root + registered_at (epoch seconds parsed from the registry's RFC3339) + deck_count; per-row `warning` when scan fails. | | `collection.get` | Same shape plus `decks: [DeckSummary]`. | | `collection.register` | Wraps `registry.register_collection`, returns resulting deck list. | | `collection.unregister` | Wraps `registry.unregister_collection`, returns `{ removed: bool }`. | | `collection.rescan` | Looks up registered root and re-scans, no registry write. | ## Verification Full stack-up validated locally: proc → router → db → mycelium → aibroker → slides. - All 5 `collection.*` methods + negative case smoke clean via curl on `rpc.sock`. - Hero Browser MCP smoke against `http://127.0.0.1:9988/hero_slides/admin`: - **Before fix**: "Open Example Deck" button silently failed; Collections counter stayed at 0. - **After fix**: Collections 0→1, `hero_slides_examples` registered with 2 decks (`hero_slides_intro` + `sample_deck`), navigation to deck route works, all dashboard counters update (Decks 2, Slides Total 12 / Generated 6 / Pending 6), console 0 messages. No schema changes, no breaking changes — wires up methods the schema already declared. Refs: - https://forge.ourworld.tf/lhumina_code/hero_slides/issues/47 - https://forge.ourworld.tf/lhumina_code/home/issues/230
feat(server): wire collection.* and rpc.examplesPath in JSON-RPC dispatch
Some checks failed
Test / test (pull_request) Failing after 16s
Test / test (push) Failing after 20s
025b4eddd2
The OpenRPC schema (openrpc.json), generated client
(openrpc.client.generated.rs), and JS dashboard all referenced
collection.list / collection.get / collection.register /
collection.unregister / collection.rescan and rpc.examplesPath, but
the dispatcher in rpc.rs had no match arms for them. Result: every
collection-CRUD entry point in the UI ("Open Example Deck",
"+ New Collection", Rescan, Unregister) silently no-op'd because the
JS catch swallowed the -32000 "Method not found" error.

Adds:

- rpc.examplesPath — returns the bundled examples directory. Resolves
  via HERO_SLIDES_EXAMPLES_DIR env var (operator override) then a
  CARGO_MANIFEST_DIR-relative path.
- collection.list — returns name + root + registered_at (epoch
  seconds, parsed from the registry's RFC3339) + deck_count, with a
  per-collection `warning` field when scan fails.
- collection.get — same shape plus the full DeckSummary list.
- collection.register — wraps registry.register_collection and returns
  the resulting deck list.
- collection.unregister — wraps registry.unregister_collection,
  returns { removed: bool }.
- collection.rescan — looks up the registered root and re-scans, no
  registry write.

Verified end-to-end on the local stack:

  service_proc → service_router → service_db → service_mycelium →
  service_aibroker → service_slides

Hero Browser MCP smoke against http://127.0.0.1:9988/hero_slides/admin
(Open Example Deck → Collections counter 0→1, hero_slides_examples
appears with 2 decks, console clean, all five collection.* methods
return correct shapes).

Refs:
- #47

Signed-off-by: mik-tf
mik-tf merged commit 3c77efc455 into development 2026-05-10 00:21:53 +00:00
mik-tf deleted branch development_mik 2026-05-10 00:21:53 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_slides!48
No description provided.