fix(server): register MOCK_CONTEXTS by default to prevent silent X-Hero-Context fallback to root #41
No reviewers
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_osis!41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_default_context_register"
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
When
hero_osis --startruns throughhero_proc, the upstreamServerCli::contextsdefaults to"root"and the binary registers only that one context. The hero_os UI shell sendsX-Hero-Context: default(and other space names likegeomind,incubaid, …); those names are not in the registered set, so the dispatcher inhero_rpc::server::unified_serversilently falls back to"root"and every UI tab reads/writes the same store regardless of which space it's in.This change overrides the contexts default in the hero_osis bin to the same
MOCK_CONTEXTSlist the workspaceMakefilealready uses formake mock, so production (hero_osis --start) and dev (make mock) cover the same set out of the box. An explicit--contextsflag orHERO_CONTEXTSenv var continues to take precedence.Related Issue
Closes #40
Changes
crates/hero_osis_server/src/bin/hero_osis.rs— whencli.contextsequals the upstreamServerClidefault of"root", expand it to"root,default,geomind,incubaid,my_context,our_context,threefold,your_context,hero_osis". Explicit overrides untouched.Test Results
cargo check --no-default-features --features all-domains— clean.cargo test --lib --no-default-features --features all-domains— 113 passed, 0 failed.conversation.listagainst~/hero/var/sockets/hero_osis_communication/rpc.sockwith each context in turn:Every registered context returns isolated data. The
bobcase (unregistered name → fallback to root) is the deeper dispatcher-level silent fallback, tracked separately at hero_rpc#36.Caveats
bin/hero_osis.rsis auto-generated byhero_rpc_osis::build. A future schema change or clean build that re-emits the bin will wipe this in-file patch. The proper upstream fix is to add acontexts_default(...)setter onOschemaBuildConfigso the generator emits this default itself — tracked at lhumina_code/hero_rpc#36. This PR is the temporary workaround until that lands.~/hero/var/osisdb/root/. After this fix, the UI'sdefaultrequests start hitting an empty~/hero/var/osisdb/default/store. Nothing is deleted; users who want the old data underdefaultcan copy it manually. Production isn't affected (no production deployments per the no-auth state of the project).Out-of-scope follow-ups
OschemaBuildConfig::contexts_default(...)setter (proper upstream fix; supersedes this PR once landed).rootfor any unregistered context name inhero_rpc::server::unified_server::dispatch_rpc— should either return an error, auto-register, or at minimum log a warning. Worth filing separately against hero_rpc.OServer::registry-backedcontext.listadmin RPC currently still only enumeratesrooteven though per-(context, domain)data stores are isolated — cosmetic, also belongs in hero_rpc.