bug: context.add RPC does not update in-memory dispatch state #47
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_rpc#47
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?
Summary
context.add persists a new context to the registry file but does not update the in-memory context_names vec or type_dispatch map in UnifiedServerBuilder. Contexts added at runtime via RPC silently do not work — requests for the new context are filtered out and fall back to root.
Root cause
In crates/server/src/server/unified_server.rs, context_names and type_dispatch are built once at serve() time. The context.add RPC handler only writes to the registry — type_dispatch and context_names are NOT updated.
The context resolution in dispatch_rpc filters hero_context_name against state.context_names — which never got the new entry — and falls through to integer lookup, landing on root.
Impact
No error is returned. Data silently comes back from the wrong context. The server must be restarted with the new context in the --contexts flag for it to take effect.
Discovered via
Debugging context switching in hero_biz — contacts appeared identical across all contexts despite correct header forwarding all the way through.
Fix options