Skip to content

fix(config): log RPC URL and core mode as strings, not object wrappers#2459

Merged
senamakel merged 7 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/config-persistence-rpc-url-log
May 23, 2026
Merged

fix(config): log RPC URL and core mode as strings, not object wrappers#2459
senamakel merged 7 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/config-persistence-rpc-url-log

Conversation

@M3gA-Mind
Copy link
Copy Markdown
Contributor

@M3gA-Mind M3gA-Mind commented May 21, 2026

Summary

  • storeRpcUrl: change console.debug('[configPersistence] Stored RPC URL:', { url: url.trim() }) → log url.trim() directly so the value appears as a readable string rather than [object Object].
  • storeCoreMode: same fix — { mode }mode.
  • Add regression test asserting no object argument appears in the storeRpcUrl debug call.

Problem

configPersistence.ts logged wrapper objects { url: '...' } and { mode } in its debug lines. In browser DevTools (and in CEF renderer logs) these print as [object Object], actively hiding the stored value from diagnostic output. This was flagged as sub-issue B in #2437 as the cause of masked root-cause investigation: the log line Stored RPC URL: [object Object] hid the fact that no cloud RPC URL had been stored, making the remote-core connection failure harder to triage.

Solution

Log the scalar values directly. One-line fix per site; no behaviour change.

Submission Checklist

  • Tests added: regression test 'logs the URL string directly, not an object wrapper' in configPersistence.test.ts
  • Diff coverage ≥ 80% — single-line change, test covers the affected branch
  • Coverage matrix updated — N/A: logging-only change
  • No new external dependencies
  • Manual smoke checklist — N/A
  • Linked issue: Refs #2437 (sub-issue B)

Impact

  • Frontend only. No Rust, no Tauri shell changes.
  • Logging output only — no runtime behaviour change.

Related


AI Authored PR Metadata

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/config-persistence-rpc-url-log
  • Commit SHA: 20844b9

Validation Run

  • pnpm --filter openhuman-app format:check — clean
  • pnpm --filter openhuman-app compile — 0 errors
  • pnpm --filter openhuman-app lint — 0 new errors
  • Focused tests: pnpm debug unit configPersistence — 68 tests pass (1 new)
  • Rust fmt/check — N/A

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended: debug log emits the URL/mode string directly
  • User-visible: diagnostic log lines now show the actual value, aiding remote-core troubleshooting

Parity Contract

  • Legacy behavior preserved: localStorage read/write semantics unchanged; only the console.debug argument format changed

Duplicate / Superseded PR Handling

  • Duplicate PR(s): N/A
  • Canonical PR: this one
  • Resolution: N/A

Summary by CodeRabbit

  • Tests

    • Added unit tests verifying debug logs emit plain string values (ensuring no object-style outputs) for RPC endpoint and core mode.
  • Refactor

    • Updated debug logging to output primitive/string values directly for RPC endpoint and core mode instead of wrapping them in objects.

Review Change Stack

M3gA-Mind added 2 commits May 21, 2026 22:20
storeRpcUrl logged { url: '...' } and storeCoreMode logged { mode }
causing "[object Object]" in diagnostic output and hiding the actual
value in user-reported logs. Log the string values directly.

Adds a regression test asserting no object argument appears in the
debug log call for storeRpcUrl.

Refs tinyhumansai#2437 (sub-issue B)
@M3gA-Mind M3gA-Mind requested a review from a team May 21, 2026 16:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Warning

Review limit reached

@senamakel, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 4 reviews/hour. Refill in 7 minutes and 37 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 22cd72bf-f1f6-4046-8bc7-4470075e0084

📥 Commits

Reviewing files that changed from the base of the PR and between abb0006 and f52607d.

📒 Files selected for processing (1)
  • app/src/lib/i18n/chunks/de-5.ts
📝 Walkthrough

Walkthrough

Updated storeCoreMode to log the primitive mode string directly; added a unit test that spies on console.debug, ensures no non-null object is logged, and asserts the logged string is 'cloud'.

Changes

Debug Logging Simplification

Layer / File(s) Summary
storeCoreMode debug call
app/src/utils/configPersistence.ts
console.debug in storeCoreMode now logs the mode string directly instead of an object ({ mode }).
Test for storeCoreMode debug output
app/src/utils/__tests__/configPersistence.test.ts
Adds a test that spies on console.debug, scans call args to ensure no non-null object is logged, and asserts the logged string equals 'cloud'.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudge a log to speak plain and loud,
No hidden objects in the debugging crowd.
"cloud" hops out, a tidy, honest cheer,
Tests guard the voice so prints are clear.

🚥 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 accurately summarizes the main change: converting object-wrapped debug logs to direct string logging in configPersistence for RPC URL and core mode.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 21, 2026
Copy link
Copy Markdown
Contributor

@graycyrus graycyrus left a comment

Choose a reason for hiding this comment

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

Clean, focused fix — nice work. Both storeRpcUrl and storeCoreMode changes are correct; the object-wrapper { url: url.trim() } / { mode } was indeed printing [object Object] in non-DevTools contexts (CEF logs, production consoles). Test covers the storeRpcUrl path well.

[minor] The storeCoreMode fix (line 258) is identical in nature but has no corresponding test. Not blocking since it's a trivial one-line change and the pattern is proven by the existing test, but worth adding for completeness if you're doing a follow-up.

File Change
configPersistence.ts:88 { url: url.trim() }url.trim()
configPersistence.ts:258 { mode }mode
configPersistence.test.ts +1 regression test for object-wrapper logging

LGTM — moving to approved queue.

…ycyrus review)

Add regression test verifying storeCoreMode logs the mode string directly
rather than an object wrapper, mirroring the existing storeRpcUrl test.
Requested in reviewer comment: "not blocking since it's a trivial one-line
change and the pattern is proven by the existing test, but worth adding."
@M3gA-Mind
Copy link
Copy Markdown
Contributor Author

Thanks @graycyrus! Added the storeCoreMode log test in d0dce05 — same pattern as the existing storeRpcUrl test, verifies the mode string is logged directly and not wrapped in an object.

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/utils/__tests__/configPersistence.test.ts`:
- Around line 433-443: The test "logs the mode string directly, not an object
wrapper" currently spies on console.debug but only calls spy.mockRestore() at
the end, which can leak the spy if an assertion throws; update this test to wrap
the assertions and any call to spy.mock.calls in a try/finally block so that
spy.mockRestore() is always executed. Specifically, inside the test that calls
storeCoreMode('cloud') and inspects spy.mock.calls, move the assertions into a
try block and put spy.mockRestore() in the finally block to guarantee cleanup
even on failure.
🪄 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: 2d76c217-bd05-4c56-a481-2123e4adcee4

📥 Commits

Reviewing files that changed from the base of the PR and between 271d476 and d0dce05.

📒 Files selected for processing (1)
  • app/src/utils/__tests__/configPersistence.test.ts

Comment thread app/src/utils/__tests__/configPersistence.test.ts
…bit)

Ensure mockRestore() always runs even when an assertion throws, preventing
console.debug spy from leaking into subsequent tests. Applied to both the
storeRpcUrl and storeCoreMode log-format tests.
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 21, 2026
# Conflicts:
#	app/src/utils/configPersistence.ts
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 23, 2026
senamakel added 2 commits May 22, 2026 17:55
…erge

The merge with main re-introduced the duplicate keys that tinyhumansai#2495 had
already removed, because the PR branch and main both held copies in
different chunk positions. Drop the second occurrence to restore Type
Check green.
@senamakel senamakel merged commit 333bd52 into tinyhumansai:main May 23, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants