fix(rpc): register openhuman.system_info and add legacy alias (Sentry CORE-RUST-G0, closes #2871)#2877
Conversation
… (Sentry CORE-RUST-G0, closes tinyhumansai#2871) - Adds `openhuman.health_system_info` controller to the `health` domain, returning app version, OS, architecture, and PID via `std::env::consts` and `CARGO_PKG_VERSION`. - Adds legacy alias `openhuman.system_info` → `openhuman.health_system_info` to both `src/core/legacy_aliases.rs` and `app/src/services/rpcMethods.ts` so older clients resolve without error. - Adds `healthSystemInfo: 'openhuman.health_system_info'` to `CORE_RPC_METHODS`. - Unit tests: `handle_system_info_returns_json_object` in `health/schemas.rs`; `system_info_returns_non_empty_version/os/pid` in `health/ops.rs`; `resolve_legacy_rewrites_system_info` in `legacy_aliases.rs`; targeted alias test in `rpcMethods.test.ts`.
single_log wraps the result as {"result":…,"logs":[…]}; the three
ops-layer tests and the schemas handler test all expect the SystemInfo
fields at the top level (json["version"], json["os"], json["pid"]).
The tracing::debug! call already records the request for observability,
so the redundant RPC log is dropped: switch to RpcOutcome::new(info, vec![]).
|
Warning Review limit reached
More reviews will be available in 41 minutes and 55 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
Comment |
Summary
Rebased and fixed version of #2872 by @graycyrus, plus one additional commit to make the 4 failing tests pass.
What changed from #2872:
fix(health): use empty-log RpcOutcome so system_info returns bare value—single_logwraps the outcome as{"result":…,"logs":[…]}, but the four tests (system_info_returns_non_empty_version,system_info_returns_known_os,system_info_returns_non_zero_pid,handle_system_info_returns_json_object) all access fields directly at the top level (json["version"],json["os"],json["pid"]). Thetracing::debug!call already handles observability logging, so the redundant RPC log entry is dropped:RpcOutcome::new(info, vec![])returns the bareSystemInfoJSON.upstream/mainto resolve the stale base.All other changes are identical to #2872.
Closes #2872, closes #2871.
Original summary from @graycyrus:
openhuman.health_system_infocontroller to thehealthdomain, returning app version, OS, CPU architecture, and PID.openhuman.system_info→openhuman.health_system_infoinsrc/core/legacy_aliases.rsandapp/src/services/rpcMethods.ts.healthSystemInfo: 'openhuman.health_system_info'toCORE_RPC_METHODS.Test plan
cargo test --lib openhuman::health— 19 passed, 0 failed (includes all 4 previously failing tests)frontend_legacy_aliases_match_server_alias_tablesatisfiedfrontend_core_rpc_methods_exist_in_core_schema_registrysatisfiedcargo fmt --checkclean