From 901ae507f511eb4f2632f9a82837d778e97ad842 Mon Sep 17 00:00:00 2001 From: sanil-23 Date: Wed, 17 Jun 2026 22:50:58 +0530 Subject: [PATCH] fix(rpc): alias health/health.snapshot/health.status/health.get to health_snapshot (#3566) (#3743) Co-authored-by: Claude --- app/src/services/rpcMethods.ts | 8 +++++++ src/core/legacy_aliases.rs | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/src/services/rpcMethods.ts b/app/src/services/rpcMethods.ts index 7be9a3d93..f149952b7 100644 --- a/app/src/services/rpcMethods.ts +++ b/app/src/services/rpcMethods.ts @@ -114,6 +114,14 @@ export const LEGACY_METHOD_ALIASES: Record = { 'openhuman.providers_list_models': CORE_RPC_METHODS.inferenceListModels, 'openhuman.inference_embed': CORE_RPC_METHODS.embeddingsEmbed, health_snapshot: CORE_RPC_METHODS.healthSnapshot, + // Dotted / bare health probes from older clients and SDK callers (#3566, + // Sentry CORE-2C). No distinct status/get handler exists — the snapshot + // already carries the health verdict — so all four alias to the snapshot. + // Keep in sync with src/core/legacy_aliases.rs (drift guard enforces it). + health: CORE_RPC_METHODS.healthSnapshot, + 'health.get': CORE_RPC_METHODS.healthSnapshot, + 'health.snapshot': CORE_RPC_METHODS.healthSnapshot, + 'health.status': CORE_RPC_METHODS.healthSnapshot, // `openhuman.system_info` was used by older clients / SDK callers before the // method was namespaced as `openhuman.health_system_info`. // Sentry CORE-RUST-G0 — https://sentry.tinyhumans.ai/organizations/tinyhumans/issues/6340/ diff --git a/src/core/legacy_aliases.rs b/src/core/legacy_aliases.rs index c059c9e15..4ab927811 100644 --- a/src/core/legacy_aliases.rs +++ b/src/core/legacy_aliases.rs @@ -154,6 +154,17 @@ const LEGACY_ALIASES: &[(&str, &str)] = &[ // bare `health_snapshot` (no namespace prefix) was used by older clients // before the canonical `openhuman.health_snapshot` form was established. ("health_snapshot", "openhuman.health_snapshot"), + // Dotted / bare health probes from older clients and SDK callers (#3566, + // Sentry CORE-2C). The canonical method is `openhuman.health_snapshot` + // (namespace `health`, function `snapshot`); these legacy spellings fell + // through to the unknown-method path and produced Sentry noise. There is no + // distinct `status`/`get` health handler — the snapshot already carries the + // health verdict (`healthy`/`degraded`/`critical_unhealthy`), so all four + // variants alias to the snapshot. + ("health", "openhuman.health_snapshot"), + ("health.get", "openhuman.health_snapshot"), + ("health.snapshot", "openhuman.health_snapshot"), + ("health.status", "openhuman.health_snapshot"), // `openhuman.system_info` was used by older clients / SDK callers before // the method was namespaced under `health` as `openhuman.health_system_info`. // Sentry CORE-RUST-G0 — https://sentry.tinyhumans.ai/organizations/tinyhumans/issues/6340/ @@ -479,6 +490,35 @@ mod tests { ); } + #[test] + fn resolve_legacy_rewrites_health_probe_variants() { + // #3566 / Sentry CORE-2C: older clients and SDK callers issued the + // health snapshot under several legacy spellings (bare `health`, and + // the dotted `health.snapshot` / `health.status` / `health.get`). + // There is no distinct status/get handler, so every variant must + // resolve to the canonical `openhuman.health_snapshot`. + for legacy in ["health", "health.get", "health.snapshot", "health.status"] { + assert_eq!( + resolve_legacy(legacy), + "openhuman.health_snapshot", + "expected health probe variant {legacy} to resolve to the snapshot method", + ); + } + } + + #[test] + fn resolve_legacy_bare_health_snapshot_regression() { + // Sentry CORE-2C regression guard: bare `health_snapshot` (no + // namespace prefix) must keep resolving to the canonical method. The + // CORE-2C events were stale (release 0.53.43 predated the alias added + // in #2853), but this lock-in proves the alias still fires on the + // exact-match resolver so the bare form can never regress. + assert_eq!( + resolve_legacy("health_snapshot"), + "openhuman.health_snapshot", + ); + } + #[test] fn resolve_legacy_rewrites_system_info() { // Sentry CORE-RUST-G0: older clients called `openhuman.system_info`