fix(account): fold the Windows profile directory to one separator style - #131
ziyaad-mallick wants to merge 1 commit into
Conversation
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>
|
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 configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe 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. ChangesProfile directory normalization
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Follow-up to #58.
account::ProfileDirectory()builds the Windows profile pathby appending
"/RunAnywhere/Wally"toLOCALAPPDATA(orUSERPROFILE) exactlyas the environment returns it, which is backslash-separated:
So the two places that print it show a mixed path:
wally account login→cloud session stored in C:\Users\<user>\AppData\Local/RunAnywhere/Wallywally uninstall→ theconfigrow of its "will delete" listThat is the same thing #58 fixed for
resolve_home()andstate_dir().Change
Pass the base through
paths::normalize_dir(), the existing helper #58introduced, so the account path follows the same
/convention asresolve_home()andstate_dir(). It's one line plus a two-line comment, and adds#include "config/cli_paths.h"(samewally_corelibrary, so no new linkdependency).
Behaviour notes:
credentials.cpp,model_cache.cppandpreferences.cppall reach itthrough
std::filesystem, and DPAPI takes no path-based entropy, so anexisting
credentials.datstill loads.WALLY_PROFILE_DIR/RCLI_PROFILE_DIRoverride is still returned exactlyas given. It's the user's own string.
CredentialsPath()and friends) are built withfs::path(directory) / kFileName, so their last separator is still native.None of them is printed today, so I left them alone.
(fs::path(home) / "RunAnywhere" / "Wally").string(). I went with/tomatch 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, setsLOCALAPPDATA=C:\wally-localwith the profile overrides unset and expectsC:/wally-local/RunAnywhere/Wally. It sits beside the existing Windows-onlycredentials_reject_a_document_they_cannot_unlockand is registered in thesame
#elseblock.Tested
Windows 11 Pro x64, MinGW-w64 g++ 15.2.0. Full
ctestwas not run: thebuild needs the pinned SDK kit, which is not on this machine. Instead,
Env,EnvWithLegacyFallback,HomeDirectory,ProfileDirectoryandnormalize_dirwere extracted verbatim, once frommainand once from thisbranch, into two throwaway harnesses (
-Wall -Wextra, no warnings). Adiffof 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:
UNVERIFIED:
wally account login/wally uninstalloutput end to end (no full build);🤖 Generated with Claude Code
Summary by cubic
Fixes Windows profile directory output showing mixed path separators, so
wally account loginandwally uninstallno longer print paths likeC:\Users\...\AppData\Local/RunAnywhere/Wally.Folds
HomeDirectory()'s result throughpaths::normalize_dir()before appending the/RunAnywhere/Wallysuffix, matching the separator styleresolve_home()andstate_dir()already use. The directory on disk is unchanged since Win32 accepts either separator, and aWALLY_PROFILE_DIR/RCLI_PROFILE_DIRoverride is still returned exactly as given. Adds a Windows-only test assertingLOCALAPPDATAplus the suffix produces a single-separator path.Written for commit ca2a91a. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests