Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/services/rpcMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ export const CORE_RPC_METHODS = {
embeddingsClearApiKey: 'openhuman.embeddings_clear_api_key',
embeddingsEmbed: 'openhuman.embeddings_embed',
embeddingsTestConnection: 'openhuman.embeddings_test_connection',
healthSnapshot: 'openhuman.health_snapshot',
} as const;

export type CoreRpcMethod = (typeof CORE_RPC_METHODS)[keyof typeof CORE_RPC_METHODS];

export const LEGACY_METHOD_ALIASES: Record<string, CoreRpcMethod> = {
health_snapshot: CORE_RPC_METHODS.healthSnapshot,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Quote the health_snapshot alias key — the unquoted form breaks the Rust parity test parser.

Unlike every other entry in this table, health_snapshot is added as an unquoted identifier key. The server-side drift guard frontend_legacy_aliases_match_server_alias_table (in src/core/legacy_aliases.rs) parses this file and runs quoted_value() on each alias key. That helper panics with expected quoted value when no '/" is present, so this entry will make the parity test fail in CI rather than pass.

🐛 Proposed fix
-  health_snapshot: CORE_RPC_METHODS.healthSnapshot,
+  'health_snapshot': CORE_RPC_METHODS.healthSnapshot,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/services/rpcMethods.ts` at line 44, The object entry using the
unquoted identifier health_snapshot must be changed to a quoted string key to
match the other alias entries and satisfy the server parity parser; replace the
unquoted key health_snapshot with a quoted key (e.g. "health_snapshot") while
keeping the value CORE_RPC_METHODS.healthSnapshot unchanged so the
frontend_legacy_aliases_match_server_alias_table parsing (which calls
quoted_value() on alias keys) no longer panics.

'openhuman.get_analytics_settings': CORE_RPC_METHODS.configGetAnalyticsSettings,
'openhuman.get_composio_trigger_settings': CORE_RPC_METHODS.configGetComposioTriggerSettings,
'openhuman.get_config': CORE_RPC_METHODS.configGet,
Expand Down
9 changes: 9 additions & 0 deletions src/core/legacy_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/// Order doesn't matter for correctness, but is kept alphabetical by legacy
/// key for easier diffing against the frontend table.
const LEGACY_ALIASES: &[(&str, &str)] = &[
("health_snapshot", "openhuman.health_snapshot"),
(
"openhuman.get_analytics_settings",
"openhuman.config_get_analytics_settings",
Expand Down Expand Up @@ -352,6 +353,14 @@ mod tests {
);
}

#[test]
fn health_snapshot_resolves_to_canonical() {
assert_eq!(
resolve_legacy("health_snapshot"),
"openhuman.health_snapshot"
);
}

#[test]
fn resolve_legacy_passes_through_unknown_methods() {
assert_eq!(
Expand Down