Skip to content

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

Open
M3gA-Mind wants to merge 4 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/config-persistence-rpc-url-log
Open

fix(config): log RPC URL and core mode as strings, not object wrappers#2459
M3gA-Mind wants to merge 4 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 for the RPC endpoint and core mode (no wrapped object arguments).
  • Refactor

    • Adjusted 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f70d3fec-a414-4972-8301-d839c6e3acd3

📥 Commits

Reviewing files that changed from the base of the PR and between d0dce05 and 1e6f123.

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

📝 Walkthrough

Walkthrough

Console debug calls in config persistence now log primitive/string values directly for RPC URL and core mode; tests were added to verify the direct-string logging and absence of object wrappers.

Changes

Debug Logging Simplification

Layer / File(s) Summary
Debug logging simplification in storeRpcUrl and storeCoreMode
app/src/utils/configPersistence.ts
console.debug calls in storeRpcUrl and storeCoreMode now log primitive/string values directly instead of wrapping them in objects.
Tests verifying direct-string debug logging
app/src/utils/__tests__/configPersistence.test.ts
Added tests that spy on console.debug, assert no object-like argument is logged, and confirm the exact string values (http://localhost:9000/rpc and 'cloud') are emitted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hop through logs with a cheerful grin,
Strings, not objects — let the clean prints in.
RPC and mode, plainly told,
Tests keep watch as tales unfold.
A tiny change, a tidy win!

🚥 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 reflects the main change: converting debug logging from object-wrapped format to direct string logging in configPersistence, addressing the core issue of [object Object] appearing in logs.
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.

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.


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.
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.

2 participants