bug: Hardcoded CamelCase RPC method names fail with AxumRpcServer #80
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_compute#80
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?
Problem
AxumRpcServer registers methods in lowercase (e.g.
computeservice.get_vm), but several places in the codebase use CamelCase (e.g.ComputeService.get_vm) in hardcoded RPC calls. These calls silently return "Method not found" errors.The UI RPC proxy was fixed (v0.1.6) by adding
lowercase_method()to the/rpcand/explorer/rpcproxy handlers. But there are other call sites that bypass the proxy and construct RPC bodies directly — these are still broken.Affected Locations
crates/hero_compute_ui/src/server.rsComputeService.node_status/statushealth check handlerexplorer.ExplorerService.get_vmComputeService.get_vmcrates/hero_compute_ui/static/js/dashboard.jsThe browser JS sends CamelCase methods (
ComputeService.node_status,ComputeService.deploy_vm, etc.) through the/rpcproxy. This is already fixed bylowercase_method()in the proxy handler. No JS changes needed.Other crates to audit
Search for any hardcoded
"method":with CamelCase in:crates/hero_compute_server/src/— heartbeat sender constructs RPC bodiescrates/hero_compute_explorer/src/— proxy constructs RPC bodiescrates/hero_compute_examples/— example codecrates/hero_compute/src/— CLISymptoms
403 Forbiddenwith "Method not found"/statusendpoint may report server as unavailable even when it's runningFix
Two approaches (pick one):
Option A: Lowercase all hardcoded method strings
Find-and-replace all hardcoded method names to lowercase:
Simple but fragile — future code might reintroduce CamelCase.
Option B: Lowercase at the transport layer (recommended)
Move
lowercase_method()intohttp_rpc_unix()andhttp_rpc_tcp()so ALL RPC calls are automatically lowercased. No caller needs to worry about case.This is the safest approach — it handles the JS proxy, inline Rust calls, and any future code.
Acceptance Criteria
/statushealth check returns correct server status"method".*"[A-Z]inserver.rsreturns zero matchesRelated
/rpcproxy onlyRecommendation: Option B — lowercase in the transport layer
Move
lowercase_method()intohttp_rpc_unix()andhttp_rpc_tcp()in the SDK. Every RPC call goes through these two functions, so this is a single fix that covers:/rpc,/explorer/rpc)Once this is in the SDK, remove
lowercase_method()from the UI'srpc_proxyhandler — it becomes redundant.Cleanup scope
While fixing this, also clean up outdated code from the AxumRpcServer migration:
SERVER_DOMAINconstant ("cloud") from the SDK — no longer used. The domain was needed byprepend_domain_to_method()which is already deleted."cloud."or"explorer."prefixes in hardcoded method strings — the domain is in the URL path, not the method name.lowercase_method()function fromserver.rsafter moving it to the SDK transport layer.crates/hero_compute_server/src/heartbeat_sender.rs— the heartbeat RPC body uses method names that may need lowercasing.crates/hero_compute_explorer/src/explorer/proxy.rs— the explorer proxy also constructs RPC bodies.403 Forbidden. Return502 Bad Gatewayor500 Internal Server Errorinstead. 403 implies an auth failure which is misleading.Goal: after this issue is closed, there should be zero CamelCase method strings in Rust code, and the transport layer guarantees lowercase for any future calls.