Remove UI /rpc proxy handler — hero_router owns /rpc #5
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?
Context
crates/hero_livekit_ui/src/main.rs:109,264-302definesroute("/rpc", post(rpc_proxy_handler))and a customforward_rpcthat forwards JSON-RPC to the server UDS. Perhero_crates_best_practices_check§Forbidden behaviors andhero_ui_openrpc_proxy, hero_router owns the/rpcpath — individual UIs must not implement their own proxy. The browser should hit/<service>/rpc/through hero_router directly; the Rust backend uses the SDK (#${sdk_issue}) for server-side aggregation.Goals
rpc_proxy_handlerand its/rpcroute incrates/hero_livekit_ui/src/main.rs.forward_rpchelper.templates/JavaScript so any fetch to/rpcis instead/${X-Forwarded-Prefix}/rpc/(hero_router-mediated).Related skills:
hero_ui_openrpc_proxy,hero_router,hero_crates_best_practices_check.Implementation Spec for Issue #5
Objective
Remove the custom /rpc JSON-RPC proxy handler from hero_livekit_ui so that all browser RPC traffic flows through hero_router directly to the server's rpc.sock, in compliance with the rule that hero_router owns the /rpc path.
Requirements
Files to Modify
crates/hero_livekit_ui/src/main.rs- Delete rpc_proxy_handler, forward_rpc, /rpc route, dead imports, update doc-commentcrates/hero_livekit_ui/static/js/dashboard.js- Change fetch URL from "/rpc" to "/rpc/"crates/hero_livekit_ui/templates/base.html- Update comment removing /rpc referencedocs/architecture.md- Update process table and request flow diagramsdocs/ui.md- Remove /rpc route from routes table, update base-path docsImplementation Plan
Step 1: Remove Rust proxy code from main.rs
Files:
crates/hero_livekit_ui/src/main.rsuse tokio::io::{AsyncReadExt, AsyncWriteExt};import.route("/rpc", post(rpc_proxy_handler))from routerDependencies: none
Step 2: Update JavaScript and template
Files:
crates/hero_livekit_ui/static/js/dashboard.js,crates/hero_livekit_ui/templates/base.htmlfetch(BASE + "/rpc", {tofetch(BASE + "/rpc/", {Dependencies: none
Step 3: Update documentation
Files:
docs/architecture.md,docs/ui.mdDependencies: none
Acceptance Criteria
Notes
Test Results
cargo build and cargo test both succeed with no errors.
Implementation Summary
Changes Made
Modified files:
crates/hero_livekit_ui/src/main.rs-- Removed rpc_proxy_handler function, forward_rpc helper, /rpc route, dead AsyncReadExt/AsyncWriteExt imports, and doc-comment reference. All other handlers and imports preserved.crates/hero_livekit_ui/static/js/dashboard.js-- Changed RPC fetch URL from "/rpc" to "/rpc/" for hero_router trailing-slash convention.crates/hero_livekit_ui/templates/base.html-- Updated comment to remove /rpc reference.docs/architecture.md-- Updated process table (removed /rpc passthrough from hero_livekit_ui description) and request flow diagrams (browser now goes directly through hero_router to rpc.sock).docs/ui.md-- Removed POST /rpc row from routes table, updated base-path docs, added clarifying note about RPC going through hero_router.Test Results
All 34 tests pass, 0 failures.
Pull request opened: #21
This PR implements the changes discussed in this issue.