fix(rpc): alias health/health.snapshot/health.status/health.get to health_snapshot (#3566) (#3743)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
sanil-23
2026-06-17 22:50:58 +05:30
committed by GitHub
co-authored by Claude
parent 3623bb7115
commit 901ae507f5
2 changed files with 48 additions and 0 deletions
+8
View File
@@ -114,6 +114,14 @@ export const LEGACY_METHOD_ALIASES: Record<string, CoreRpcMethod> = {
'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/
+40
View File
@@ -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`