Skip to content

fix(health): add legacy alias for health_snapshot (#2852)#2883

Closed
YOMXXX wants to merge 1 commit into
tinyhumansai:mainfrom
YOMXXX:fix/2852-health-snapshot-alias
Closed

fix(health): add legacy alias for health_snapshot (#2852)#2883
YOMXXX wants to merge 1 commit into
tinyhumansai:mainfrom
YOMXXX:fix/2852-health-snapshot-alias

Conversation

@YOMXXX
Copy link
Copy Markdown
Contributor

@YOMXXX YOMXXX commented May 29, 2026

Summary

  • Add health_snapshotopenhuman.health_snapshot legacy alias for older clients that call the RPC method without the openhuman. prefix

Changes

  • src/core/legacy_aliases.rs: Added alias entry + unit test
  • app/src/services/rpcMethods.ts: Added matching frontend alias (enforced by frontend_legacy_aliases_match_server_alias_table test)

Test plan

  • health_snapshot_resolves_to_canonical unit test
  • Existing frontend_legacy_aliases_match_server_alias_table parity test covers both sides

Closes #2852

Summary by CodeRabbit

  • Chores
    • Added support for legacy health snapshot method names to ensure backward compatibility with proper RPC method mapping.

Review Change Stack

@YOMXXX YOMXXX requested a review from a team May 29, 2026 01:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

The PR adds legacy alias support for the health_snapshot RPC method across both TypeScript and Rust layers. A new healthSnapshot entry is added to CORE_RPC_METHODS, mapped to openhuman.health_snapshot, with a corresponding legacy alias in the Rust resolver and accompanying unit test for validation.

Changes

Legacy health_snapshot RPC alias support

Layer / File(s) Summary
Legacy alias mapping
app/src/services/rpcMethods.ts, src/core/legacy_aliases.rs
healthSnapshot is added to CORE_RPC_METHODS in TypeScript, mapped to openhuman.health_snapshot, with a corresponding legacy alias entry in the Rust resolver. A unit test validates that resolve_legacy("health_snapshot") returns openhuman.health_snapshot.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • tinyhumansai/openhuman#2853: Adds the same health_snapshot legacy→canonical alias resolving to openhuman.health_snapshot in both TypeScript and Rust, including test coverage.
  • tinyhumansai/openhuman#2865: Adds parser support for tolerating bare health_snapshot: keys in the legacy alias table that this PR populates in src/core/legacy_aliases.rs.
  • tinyhumansai/openhuman#1705: Modifies the server-side legacy RPC alias machinery (src/core/legacy_aliases.rs/resolve_legacy) and its compatibility layer, directly related to the alias resolution surface touched by this PR.

Suggested labels

rust-core, sentry-traced-bug, working

Suggested reviewers

  • graycyrus
  • M3gA-Mind

Poem

🐰 A snapshot so fine, health_snapshot now shines,
From legacy whispers to openhuman lines,
Rust resolves what TypeScript defines,
With tests standing guard, the alias aligns! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a legacy alias for the health_snapshot RPC method, which directly matches the primary objective of the pull request.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #2852: adds health_snapshot legacy alias in both backend and frontend, includes unit test, and maintains consistency via parity test.
Out of Scope Changes check ✅ Passed All changes are directly scoped to adding the legacy alias for health_snapshot as specified in issue #2852; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix/2852-health-snapshot-alias

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. sentry-traced-bug Bug identified via Sentry triage working A PR that is being worked on by the team. labels May 29, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between d9f4139 and f5008fa.

📒 Files selected for processing (2)
  • app/src/services/rpcMethods.ts
  • src/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,
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.

@YOMXXX
Copy link
Copy Markdown
Contributor Author

YOMXXX commented May 29, 2026

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.

@YOMXXX YOMXXX closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. sentry-traced-bug Bug identified via Sentry triage working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing legacy alias for health_snapshot RPC method

1 participant