feat(deploy): VITE_OPENHUMAN_CORE_RPC_TOKEN build-time override#1337
feat(deploy): VITE_OPENHUMAN_CORE_RPC_TOKEN build-time override#1337CodeGhost21 wants to merge 0 commit intotinyhumansai:mainfrom
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a build-time Vite env var ChangesCore RPC Token Override for Cloud Deployment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. 🔧 Microsoft Presidio Analyzer (2.2.362)app/.env.exampleMicrosoft Presidio Analyzer failed to scan this file Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
4b21d5d to
d8cf53e
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/services/coreRpcClient.ts (1)
80-89: ⚡ Quick winAdd a debug log for the override URL short-circuit branch.
This branch bypasses Tauri URL resolution entirely; adding a branch-decision log here will make routing/auth diagnostics much easier.
Suggested patch
if (CORE_RPC_TOKEN_OVERRIDE) { + coreRpcLog('using build-time core RPC URL because token override is set'); resolvedCoreRpcUrl = CORE_RPC_URL; return resolvedCoreRpcUrl; }As per coding guidelines, "Add substantial, development-oriented logs at entry/exit points, branch decisions, external calls, retries/timeouts, state transitions, and error handling paths; use namespaced
debuglogs in production app code."🤖 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/coreRpcClient.ts` around lines 80 - 89, Add a debug log when the CORE_RPC_TOKEN_OVERRIDE short-circuits URL resolution: inside the branch that checks CORE_RPC_TOKEN_OVERRIDE (where resolvedCoreRpcUrl is set to CORE_RPC_URL and returned), emit a namespaced debug message indicating the override was used and include the resolvedCoreRpcUrl value and token presence (e.g., show whether CORE_RPC_TOKEN_OVERRIDE is set) to aid routing/auth diagnostics; update the branch around the CORE_RPC_TOKEN_OVERRIDE check in coreRpcClient.ts to log before returning.
🤖 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.
Nitpick comments:
In `@app/src/services/coreRpcClient.ts`:
- Around line 80-89: Add a debug log when the CORE_RPC_TOKEN_OVERRIDE
short-circuits URL resolution: inside the branch that checks
CORE_RPC_TOKEN_OVERRIDE (where resolvedCoreRpcUrl is set to CORE_RPC_URL and
returned), emit a namespaced debug message indicating the override was used and
include the resolvedCoreRpcUrl value and token presence (e.g., show whether
CORE_RPC_TOKEN_OVERRIDE is set) to aid routing/auth diagnostics; update the
branch around the CORE_RPC_TOKEN_OVERRIDE check in coreRpcClient.ts to log
before returning.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: aa12ef0c-2139-4535-aa06-b49642344e3b
📒 Files selected for processing (5)
app/.env.exampleapp/src/services/__tests__/coreRpcClient.test.tsapp/src/services/coreRpcClient.tsapp/src/utils/config.tsdocs/CLOUD_DEPLOY.md
✅ Files skipped from review due to trivial changes (1)
- app/.env.example
🚧 Files skipped from review as they are similar to previous changes (3)
- app/src/utils/config.ts
- docs/CLOUD_DEPLOY.md
- app/src/services/tests/coreRpcClient.test.ts
d8cf53e to
c6cdec9
Compare
senamakel
left a comment
There was a problem hiding this comment.
unit tests are breaking bro
c6cdec9 to
ca8e4f6
Compare
Summary
VITE_OPENHUMAN_CORE_RPC_TOKENbuild-time env var so a desktop bundle can authenticate against a remote/cloud-hostedopenhuman-core(paths shipped in feat(deploy): one-click cloud deployment for OpenHuman Core (closes #1280) #1304 /docs/CLOUD_DEPLOY.md) without depending on the embedded Tauri sidecar.coreRpcClient.getCoreRpcToken(): build-time override → Tauricore_rpc_token→null. Override wins because the user explicitly chose a non-default core at build time.VITE_*is baked into the bundle, so a build with this var set carries a secret. Intended for personal/internal builds, not public release artefacts.Problem
After #1304 you can deploy
openhuman-coreto DigitalOcean / Compose / any Docker host, but there is no built-in path for the desktop app onmainto talk to that hosted core:getCoreRpcToken()only resolves via the Tauri-shell-generated sidecar token. The matching client-side wiring lives in #1300, but that PR is scoped to backend-provisioned AWS instances — itsdeployment_get_core_tokenRPC pulls from the hosted backend, which has no record of a manually-deployed DO/Compose core's bearer.This leaves anyone who follows
docs/CLOUD_DEPLOY.mdwith a working hosted core they can only call via curl/scripts, not from the desktop app.Solution
Treat the bearer the same way we already treat
VITE_OPENHUMAN_CORE_RPC_URL: a build-timeVITE_*override that pairs with the URL. When set,coreRpcClient.getCoreRpcToken()returns it before consulting the Tauri sidecar. Empty / whitespace values fall through so default builds are unaffected.This is intentionally minimal and orthogonal to #1300:
The two can coexist; if/when #1300 lands, its localStorage path can take priority over this build-time override (or this can stay as a stable opt-in for builds that don't want to depend on a backend session).
Submission Checklist
docs/TESTING-STRATEGY.mdcoreRpcClient.test.tspass locally.docs/TEST-COVERAGE-MATRIX.md.## Related— N/A: see above.docs/TESTING-STRATEGY.md)docs/RELEASE-MANUAL-SMOKE.md) — N/A: opt-in build-time var, default behaviour unchanged.Closes #NNNin the## Relatedsection — N/A: no linked issue, this is a follow-up surfaced while validating the feat(deploy): one-click cloud deployment for OpenHuman Core (closes #1280) #1304 deploy path against a live DO instance.Impact
config.ts), env example (app/.env.example), anddocs/CLOUD_DEPLOY.md: any build with this var set carries a secret in its JS bundle. Intended for personal/internal builds, not public release artefacts.Test plan
pnpm exec tsc --noEmitcleanpnpm exec eslint src/services/coreRpcClient.ts src/services/__tests__/coreRpcClient.test.ts src/utils/config.tscleanpnpm exec prettier --checkon changed files cleanpnpm exec vitest run src/services/__tests__/coreRpcClient.test.ts— 44/44 pass (3 new for the override)openhuman-core: bearer token override →/rpcreturns 200; same desktop bundle without the override → falls back to local sidecar.Related
Summary by CodeRabbit
New Features
Documentation
Tests