Skip to content
Merged
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
54 changes: 51 additions & 3 deletions app/src/services/__tests__/rpcMethods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,48 @@ describe('rpcMethods catalog', () => {
);
});

describe('MCP client legacy alias resolution (Sentry CORE-RUST-DW/DV/DT/DS/DR)', () => {
test('mcp_clients.list resolves to mcp_clients_installed_list', () => {
expect(normalizeRpcMethod('mcp_clients.list')).toBe(CORE_RPC_METHODS.mcpClientsInstalledList);
});

test('openhuman.mcp_clients_list resolves to mcp_clients_installed_list', () => {
expect(normalizeRpcMethod('openhuman.mcp_clients_list')).toBe(
CORE_RPC_METHODS.mcpClientsInstalledList
);
});

test('openhuman.mcp_list resolves to mcp_clients_installed_list', () => {
expect(normalizeRpcMethod('openhuman.mcp_list')).toBe(
CORE_RPC_METHODS.mcpClientsInstalledList
);
});

test('openhuman.mcp_servers_list resolves to mcp_clients_installed_list', () => {
expect(normalizeRpcMethod('openhuman.mcp_servers_list')).toBe(
CORE_RPC_METHODS.mcpClientsInstalledList
);
});

test('openhuman.tool_registry_call resolves to mcp_clients_tool_call', () => {
expect(normalizeRpcMethod('openhuman.tool_registry_call')).toBe(
CORE_RPC_METHODS.mcpClientsToolCall
);
});

test('canonical mcp_clients_installed_list passes through unchanged', () => {
expect(normalizeRpcMethod('openhuman.mcp_clients_installed_list')).toBe(
'openhuman.mcp_clients_installed_list'
);
});

test('canonical mcp_clients_tool_call passes through unchanged', () => {
expect(normalizeRpcMethod('openhuman.mcp_clients_tool_call')).toBe(
'openhuman.mcp_clients_tool_call'
);
});
});

test('catalog canonical methods exist in core schema registry (drift guard)', () => {
const schemaSources = [
fs.readFileSync(
Expand All @@ -75,6 +117,10 @@ describe('rpcMethods catalog', () => {
path.resolve(__dirname, '../../../../src/openhuman/embeddings/schemas.rs'),
'utf8'
),
fs.readFileSync(
path.resolve(__dirname, '../../../../src/openhuman/mcp_registry/schemas.rs'),
'utf8'
),
fs.readFileSync(
path.resolve(__dirname, '../../../../src/openhuman/health/schemas.rs'),
'utf8'
Expand All @@ -93,9 +139,11 @@ describe('rpcMethods catalog', () => {
? 'embeddings'
: methodRoot.startsWith('providers_')
? 'providers'
: methodRoot.startsWith('health_')
? 'health'
: 'config';
: methodRoot.startsWith('mcp_clients_')
? 'mcp_clients'
: methodRoot.startsWith('health_')
? 'health'
: 'config';
const fnName = methodRoot.slice(`${namespace}_`.length);
expect(schemaSources).toContain(`namespace: "${namespace}"`);
expect(schemaSources).toContain(`function: "${fnName}"`);
Expand Down
9 changes: 9 additions & 0 deletions app/src/services/rpcMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ export const CORE_RPC_METHODS = {
embeddingsClearApiKey: 'openhuman.embeddings_clear_api_key',
embeddingsEmbed: 'openhuman.embeddings_embed',
embeddingsTestConnection: 'openhuman.embeddings_test_connection',
mcpClientsInstalledList: 'openhuman.mcp_clients_installed_list',
mcpClientsToolCall: 'openhuman.mcp_clients_tool_call',
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> = {
// MCP clients — old method names that appeared in Sentry (CORE-RUST-DR/DS/DT/DV/DW).
// See src/core/legacy_aliases.rs for the Rust-side mirror of this table.
'mcp_clients.list': CORE_RPC_METHODS.mcpClientsInstalledList,
'openhuman.mcp_clients_list': CORE_RPC_METHODS.mcpClientsInstalledList,
'openhuman.mcp_list': CORE_RPC_METHODS.mcpClientsInstalledList,
'openhuman.mcp_servers_list': CORE_RPC_METHODS.mcpClientsInstalledList,
'openhuman.tool_registry_call': CORE_RPC_METHODS.mcpClientsToolCall,
'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
20 changes: 20 additions & 0 deletions src/core/legacy_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
/// 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)] = &[
// MCP clients — old method names that appeared in Sentry (CORE-RUST-DR/DS/DT/DV/DW).
// Callers used dotted namespace, bare `mcp_list`, `mcp_servers_list`, and
// `mcp_clients_list` before the canonical `mcp_clients_installed_list` was
// introduced in PR #2409. `tool_registry_call` was an early mis-spelling of
// `mcp_clients_tool_call` that shipped in at least one older bundle.
// `mcp_clients.list` sorts before all `openhuman.*` entries (m < o).
("mcp_clients.list", "openhuman.mcp_clients_installed_list"),
(
"openhuman.get_analytics_settings",
"openhuman.config_get_analytics_settings",
Expand All @@ -34,11 +41,24 @@ const LEGACY_ALIASES: &[(&str, &str)] = &[
"openhuman.get_runtime_flags",
"openhuman.config_get_runtime_flags",
),
(
"openhuman.mcp_clients_list",
"openhuman.mcp_clients_installed_list",
),
("openhuman.mcp_list", "openhuman.mcp_clients_installed_list"),
(
"openhuman.mcp_servers_list",
"openhuman.mcp_clients_installed_list",
),
("openhuman.ping", "core.ping"),
(
"openhuman.set_browser_allow_all",
"openhuman.config_set_browser_allow_all",
),
(
"openhuman.tool_registry_call",
"openhuman.mcp_clients_tool_call",
),
(
"openhuman.update_analytics_settings",
"openhuman.config_update_analytics_settings",
Expand Down
Loading