Skip to content

fix(paths): normalize the default Windows home as well - #110

Open
ziyaad-mallick wants to merge 1 commit into
RunanywhereAI:mainfrom
ziyaad-mallick:fix/resolve-home-default-separators
Open

ziyaad-mallick wants to merge 1 commit into
RunanywhereAI:mainfrom
ziyaad-mallick:fix/resolve-home-default-separators

Conversation

@ziyaad-mallick

@ziyaad-mallick ziyaad-mallick commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #58, from CodeRabbit's outside-diff comment there.

#58 made normalize_dir() fold backslashes, but resolve_home() only calls it for the --home flag and RUNANYWHERE_HOME. The default branch returns the SDK's buffer as-is:

    if (rac_desktop_default_base_dir(buffer, sizeof(buffer)) == RAC_SUCCESS) {
        return buffer;
    }

On Windows that buffer is built by windows_app_dir("LOCALAPPDATA") in runanywhere-sdks core/src/desktop/desktop_adapter.cpp:98-113, which trims trailing separators and appends "/RunAnywhere" to the raw environment value. A real LOCALAPPDATA is C:\Users\<user>\AppData\Local, so the default home still comes back as C:\Users\<user>\AppData\Local/RunAnywhere. That's the default path for anyone who hasn't set --home or RUNANYWHERE_HOME.

This returns normalize_dir(buffer), the same as the other two branches. On macOS and Linux normalize_dir only trims a trailing /, which xdg_dir in the SDK already does, so nothing changes there.

Why the existing test didn't catch it

The _WIN32 default case in test_resolve_home_precedence sets LOCALAPPDATA to "C:/wally-local", with forward slashes, which is the one input that can't show the bug. Same blind spot #58 fixed for state_dir(). This adds a second case with "C:\\wally-local" next to it and leaves the existing one alone.

Tested: Windows 11 Pro x64, MinGW-w64 g++ 15.2.0. The full ctest wasn't run, since building the test binary needs the pinned SDK kit, which isn't on this machine. Instead I compiled src/config/cli_paths.cpp against a stub whose rac_desktop_default_base_dir is copied verbatim from desktop_adapter.cpp, and ran both Windows default cases with the same _putenv_s calls EnvVar makes:

on main:

ok    LOCALAPPDATA=C:/wally-local (existing case) -> C:/wally-local/RunAnywhere
FAIL  LOCALAPPDATA=C:\wally-local (new case) -> C:\wally-local/RunAnywhere
FAILED (1)

on this branch:

ok    LOCALAPPDATA=C:/wally-local (existing case) -> C:/wally-local/RunAnywhere
ok    LOCALAPPDATA=C:\wally-local (new case) -> C:/wally-local/RunAnywhere
PASSED (0 failures)

Not verified: the test under MSVC, or a real wally info run. Neither can be built here, so the windows-2022 job is the real check.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Standardized fallback home-directory paths on Windows by converting backslashes to forward slashes and removing trailing separators.
    • Ensured Windows paths consistently resolve to the expected normalized format.
  • Tests

    • Added coverage for resolving Windows-style local application data paths.

resolve_home() folded separators for --home and RUNANYWHERE_HOME but returned
the SDK's default base dir untouched. On Windows that value is LOCALAPPDATA
with "/RunAnywhere" appended, so it still came back mixed. Pass it through
normalize_dir() like the other two branches, and cover it with a backslashed
LOCALAPPDATA case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e75204ab-7307-4dee-ab91-f4dfa1ffee12

📥 Commits

Reviewing files that changed from the base of the PR and between 87a1dbb and 5add26f.

📒 Files selected for processing (2)
  • src/config/cli_paths.cpp
  • tests/test_wally_unit.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The fallback path in resolve_home now uses normalize_dir. A Windows unit test verifies conversion of a backslash-separated LOCALAPPDATA path to the normalized RunAnywhere path.

Changes

Home path normalization

Layer / File(s) Summary
Normalize fallback home paths
src/config/cli_paths.cpp, tests/test_wally_unit.cpp
resolve_home normalizes the fallback directory. The Windows test verifies C:\wally-local becomes C:/wally-local/RunAnywhere.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: siddhesh2377

Merge Risk: ⚪ Minimal · up to 5add2

The change correctly normalizes the Windows fallback path and adds isolated coverage without a concrete merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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: normalizing the default Windows home path. It matches the implementation and test updates.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

1 participant