Skip to content

fix(account): fold the Windows profile directory to one separator style - #131

Open
ziyaad-mallick wants to merge 1 commit into
RunanywhereAI:mainfrom
ziyaad-mallick:fix/profile-dir-separators
Open

ziyaad-mallick wants to merge 1 commit into
RunanywhereAI:mainfrom
ziyaad-mallick:fix/profile-dir-separators

Conversation

@ziyaad-mallick

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

Copy link
Copy Markdown
Contributor

Follow-up to #58. account::ProfileDirectory() builds the Windows profile path
by appending "/RunAnywhere/Wally" to LOCALAPPDATA (or USERPROFILE) exactly
as the environment returns it, which is backslash-separated:

#if defined(_WIN32)
    const std::string home = HomeDirectory();
    return home.empty() ? std::string() : home + "/RunAnywhere/Wally";

So the two places that print it show a mixed path:

  • wally account logincloud session stored in C:\Users\<user>\AppData\Local/RunAnywhere/Wally
  • wally uninstall → the config row of its "will delete" list

That is the same thing #58 fixed for resolve_home() and state_dir().

Change

Pass the base through paths::normalize_dir(), the existing helper #58
introduced, so the account path follows the same / convention as
resolve_home() and state_dir(). It's one line plus a two-line comment, and adds
#include "config/cli_paths.h" (same wally_core library, so no new link
dependency).

Behaviour notes:

  • The directory on disk doesn't change. Win32 accepts either separator,
    credentials.cpp, model_cache.cpp and preferences.cpp all reach it
    through std::filesystem, and DPAPI takes no path-based entropy, so an
    existing credentials.dat still loads.
  • A WALLY_PROFILE_DIR / RCLI_PROFILE_DIR override is still returned exactly
    as given. It's the user's own string.
  • The files under the directory (CredentialsPath() and friends) are built with
    fs::path(directory) / kFileName, so their last separator is still native.
    None of them is printed today, so I left them alone.
  • If you'd rather Windows paths be all-backslash, the alternative is
    (fs::path(home) / "RunAnywhere" / "Wally").string(). I went with / to
    match fix(paths): stop emitting mixed separators in Windows paths #58.

Test

A new Windows-only case in tests/test_wally_account.cpp,
profile_directory_uses_one_separator_style, sets
LOCALAPPDATA=C:\wally-local with the profile overrides unset and expects
C:/wally-local/RunAnywhere/Wally. It sits beside the existing Windows-only
credentials_reject_a_document_they_cannot_unlock and is registered in the
same #else block.

Tested

Windows 11 Pro x64, MinGW-w64 g++ 15.2.0. Full ctest was not run: the
build needs the pinned SDK kit, which is not on this machine. Instead,
Env, EnvWithLegacyFallback, HomeDirectory, ProfileDirectory and
normalize_dir were extracted verbatim, once from main and once from this
branch, into two throwaway harnesses (-Wall -Wextra, no warnings). A diff
of the two generated sources differs only in the changed lines. The harness
driver runs the new test's case plus the neighbouring branches. Run from
PowerShell:

=== before (main 02d8d06)
real env:        [C:\Users\<user>\AppData\Local/RunAnywhere/Wally]
test case:       [C:\wally-local/RunAnywhere/Wally] -> FAIL
override:        [D:\custom\profile]
USERPROFILE only:[C:\Users\<user>/RunAnywhere/Wally]
nothing set:     []
=== after (this branch)
real env:        [C:/Users/<user>/AppData/Local/RunAnywhere/Wally]
test case:       [C:/wally-local/RunAnywhere/Wally] -> PASS
override:        [D:\custom\profile]
USERPROFILE only:[C:/Users/<user>/RunAnywhere/Wally]
nothing set:     []

UNVERIFIED:

  • the new test under MSVC and in the CI Windows jobs (no MSVC or SDK kit here);
  • wally account login / wally uninstall output end to end (no full build);
  • the non-Windows branch, which is unchanged and compiled out of the harness.

🤖 Generated with Claude Code


Summary by cubic

Fixes Windows profile directory output showing mixed path separators, so wally account login and wally uninstall no longer print paths like C:\Users\...\AppData\Local/RunAnywhere/Wally.

Folds HomeDirectory()'s result through paths::normalize_dir() before appending the /RunAnywhere/Wally suffix, matching the separator style resolve_home() and state_dir() already use. The directory on disk is unchanged since Win32 accepts either separator, and a WALLY_PROFILE_DIR / RCLI_PROFILE_DIR override is still returned exactly as given. Adds a Windows-only test asserting LOCALAPPDATA plus the suffix produces a single-separator path.

Written for commit ca2a91a. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • On Windows, profile directory paths now consistently use forward slashes, preventing mixed path separators.
  • Tests

    • Added Windows coverage to verify consistent profile directory formatting.

ProfileDirectory() joins "/RunAnywhere/Wally" onto LOCALAPPDATA (or
USERPROFILE) as the environment hands it over, backslash-separated, so
`wally account login` reports "cloud session stored in
C:\Users\...\AppData\Local/RunAnywhere/Wally" and `wally uninstall` lists
the same mixed path. Run the base through paths::normalize_dir, the fold
cli_paths already applies to resolve_home and state_dir (RunanywhereAI#58). Win32 accepts
either separator and every consumer goes through std::filesystem, so the
directory on disk is unchanged. A WALLY_PROFILE_DIR override is still
returned as given.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ziyaad-mallick
ziyaad-mallick requested a review from a team as a code owner September 22, 2026 15:06
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 67863eea-f7a4-47db-834f-6ddf2b554a10

📥 Commits

Reviewing files that changed from the base of the PR and between ff54394 and ca2a91a.

📒 Files selected for processing (2)
  • src/account/credentials.cpp
  • tests/test_wally_account.cpp

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


📝 Walkthrough

Walkthrough

The Windows profile directory construction now normalizes the home path before adding the Wally profile suffix. A Windows-only test verifies that the result uses one separator style.

Changes

Profile directory normalization

Layer / File(s) Summary
Normalize and validate the Windows profile path
src/account/credentials.cpp, tests/test_wally_account.cpp
Windows profile directory construction normalizes HomeDirectory() before appending RunAnywhere/Wally. A Windows-only test verifies the normalized result and registers it in the test runner.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: siddhesh2377

Merge Risk: ⚪ Minimal · up to ca2a9

Windows profile paths now use consistent separators without changing their location, addressing mixed-path display behavior. The change is mergeable with no identified current production risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 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: standardizing Windows profile directory separators.
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 a new PR

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.

This branch has not been deployed

No deployments
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