fix(auth): update RPC method names for authentication calls#463
fix(auth): update RPC method names for authentication calls#463M3gA-Mind merged 3 commits intotinyhumansai:mainfrom
Conversation
Refactor authentication-related RPC method names to use underscores instead of dots for consistency. Updated methods include `get_state`, `get_session_token`, `clear_session`, and `store_session`. chore: update OpenHuman version to 0.51.19 style: standardize string formatting in quickjs_libs/bootstrap.js and other files - Replace single quotes with double quotes for string literals in various functions. - Ensure consistent formatting across console logging and error handling. fix(config): improve token retrieval logic in ops_core.rs - Enhance the logic for retrieving the active session token from the credentials store, accommodating user-specific directories.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughUpdates Tauri RPC auth method names, adds proxy-route flow documentation, enhances QuickJS OAuth auth-failure detection, and changes credentials-store resolution to prefer a user-scoped directory when present. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ProxyController as Proxy Controller
participant TokenStore as Token Store / Credentials
participant Decrypt as Decryption (X-Encryption-Key)
participant Provider as Upstream Provider
Client->>ProxyController: HTTPS request to /proxy/encrypted/:integrationId/{*path} + X-Encryption-Key
ProxyController->>TokenStore: verify JWT + check integration ownership
ProxyController->>Decrypt: parse & validate X-Encryption-Key
Decrypt-->>ProxyController: decrypted token (or error)
ProxyController->>TokenStore: resolve provider config, attempt token refresh if needed
TokenStore-->>ProxyController: access token (or 401)
ProxyController->>Provider: forward request with access token (axios, timeout)
Provider-->>ProxyController: response (200 / 401 / 403 / network error)
alt 401 from Provider
ProxyController->>TokenStore: force-refresh using encrypted token, retry once
TokenStore-->>ProxyController: refreshed token or failure
ProxyController->>Provider: retry request
Provider-->>ProxyController: response
end
ProxyController-->>Client: mapped response or structured error (includes reconnect/auth hints for 401/403)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/skills/quickjs_libs/bootstrap.js (1)
136-138: Consider migratingvartoconst/letfor consistency.This file uses
varextensively (e.g., lines 136-138, 141, 151, 162, 911-912, 924, etc.). QuickJS supportsconstandlet, and the coding guidelines prefer them overvar. Since this PR already touches string formatting, consider a follow-up to modernize variable declarations.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openhuman/skills/quickjs_libs/bootstrap.js` around lines 136 - 138, The code uses legacy `var` for local variables (e.g., `method`, `headers`, `body` in the HTTP request block) instead of `const`/`let`; update these declarations across bootstrap.js (including other occurrences such as near lines with `method`, `headers`, `body`, and other var usages) to `const` when the variable is never reassigned and to `let` when it is mutated, ensuring no behavior changes; scan functions like the HTTP request handler and other scopes that use `var` and replace them accordingly while keeping scoping semantics the same.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/openhuman/skills/quickjs_libs/bootstrap.js`:
- Around line 136-138: The code uses legacy `var` for local variables (e.g.,
`method`, `headers`, `body` in the HTTP request block) instead of `const`/`let`;
update these declarations across bootstrap.js (including other occurrences such
as near lines with `method`, `headers`, `body`, and other var usages) to `const`
when the variable is never reassigned and to `let` when it is mutated, ensuring
no behavior changes; scan functions like the HTTP request handler and other
scopes that use `var` and replace them accordingly while keeping scoping
semantics the same.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 13201741-2773-4523-93eb-2d1c534a7b4a
⛔ Files ignored due to path filters (1)
app/src-tauri/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
app/src/utils/tauriCommands/auth.tsdocs/proxy-route-flow.mdsrc/openhuman/skills/quickjs_libs/bootstrap.jssrc/openhuman/skills/quickjs_libs/qjs_ops/ops_core.rs
Update stale test expectations for underscore-style auth RPC methods and light-theme OAuth button classes, and make the bypass-login E2E assertion resilient to the current auth persistence model. Made-with: Cursor
Include Prettier formatting adjustments produced by the pre-push hook so the branch can pass repository push checks cleanly. Made-with: Cursor
Refactor authentication-related RPC method names to use underscores instead of dots for consistency. Updated methods include
get_state,get_session_token,clear_session, andstore_session.chore: update OpenHuman version to 0.51.19
style: standardize string formatting in quickjs_libs/bootstrap.js and other files
fix(config): improve token retrieval logic in ops_core.rs
Summary
Problem
Solution
Submission Checklist
app/) and/orcargo test(core) for logic you add or changeapp/test/e2e, mock backend,tests/json_rpc_e2e.rsas appropriate)//////!(Rust), JSDoc or brief file/module headers (TS) on public APIs and non-obvious modules(Any feature related checklist can go in here)
Impact
Related
Summary by CodeRabbit
Documentation
Bug Fixes
Refactor
Tests