fix(health): add legacy alias for health_snapshot (#2852)#2883
Conversation
📝 WalkthroughWalkthroughThe PR adds legacy alias support for the ChangesLegacy health_snapshot RPC alias support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches⚔️ Resolve merge conflicts
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@app/src/services/rpcMethods.ts`:
- 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.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7369d4e-9ede-4046-a264-6eef24e1ddd8
📒 Files selected for processing (2)
app/src/services/rpcMethods.tssrc/core/legacy_aliases.rs
| 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, |
There was a problem hiding this comment.
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.
|
Closing — upstream main already contains this exact alias (health_snapshot → openhuman.health_snapshot) with a test. Likely landed via another PR since this branch was created. |
Summary
health_snapshot→openhuman.health_snapshotlegacy alias for older clients that call the RPC method without theopenhuman.prefixChanges
src/core/legacy_aliases.rs: Added alias entry + unit testapp/src/services/rpcMethods.ts: Added matching frontend alias (enforced byfrontend_legacy_aliases_match_server_alias_tabletest)Test plan
health_snapshot_resolves_to_canonicalunit testfrontend_legacy_aliases_match_server_alias_tableparity test covers both sidesCloses #2852
Summary by CodeRabbit