Skip to content

fix(tui): keep onboarding marker in codewhale home#3302

Draft
nightt5879 wants to merge 3 commits into
Hmbown:mainfrom
nightt5879:nightt5879/fix-3240-onboarding-marker
Draft

fix(tui): keep onboarding marker in codewhale home#3302
nightt5879 wants to merge 3 commits into
Hmbown:mainfrom
nightt5879:nightt5879/fix-3240-onboarding-marker

Conversation

@nightt5879

Copy link
Copy Markdown
Contributor

Summary

  • Keep the onboarding completion marker on the CodeWhale home path for fresh installs (~/.codewhale/.onboarded).
  • Preserve existing legacy ~/.deepseek/.onboarded markers for migrated users, while preferring .codewhale when both exist.
  • Add focused tests for fresh install, legacy marker, and primary-over-legacy behavior.

Root Cause

default_marker_path() only returned the CodeWhale marker when ~/.codewhale/.onboarded already existed. On a fresh install it selected ~/.deepseek/.onboarded, and mark_onboarded() then created the legacy directory at runtime.

Fixes #3240. Reported by @Final527.

Validation

  • cargo fmt --all -- --check
  • cargo test -p codewhale-tui --bin codewhale-tui tui::onboarding::tests::
  • cargo check -p codewhale-tui --all-features --locked
  • cargo clippy --workspace --all-features --locked -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or -A clippy::assertions_on_constants
  • git diff --check

I also attempted cargo test --workspace --all-features --locked locally. The default Windows temp dir is under a host-level C:\.git, which makes unrelated session-manager temp workspaces resolve to the same root repository. Moving TEMP/TMP to D:\codex-temp cleared that local session-scope failure, but the full run still hit host-specific pandoc/SHGetFolderPath and environment-sensitive config failures. The focused regression tests and CI-equivalent lint/check commands above pass locally; CI should provide the isolated full-suite result.

Fresh onboarding previously selected ~/.deepseek/.onboarded whenever ~/.codewhale/.onboarded did not already exist, so marking onboarding complete could recreate the legacy DeepSeek directory on new installs. Prefer ~/.codewhale by default while preserving existing legacy markers for migrated users.

Fixes Hmbown#3240

Reported by @Final527.

Co-authored-by: Final527 <33980030+Final527@users.noreply.github.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@nightt5879 nightt5879 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Self-review:

  • Scope is limited to crates/tui/src/tui/onboarding/mod.rs; no release, package, or provider surfaces changed.
  • Fresh-install path now defaults to ~/.codewhale/.onboarded, so completing onboarding no longer recreates ~/.deepseek/ for #3240.
  • Backward compatibility is preserved: an existing ~/.deepseek/.onboarded marker is still reused, and .codewhale wins when both markers exist.
  • Regression coverage was added for fresh install, legacy marker preservation, and primary-over-legacy behavior.
  • Local checks passed for formatting, focused onboarding tests, cargo check -p codewhale-tui --all-features --locked, CI-equivalent workspace clippy, and git diff --check.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the onboarding marker path logic by introducing helper functions (marker_path_with_home and mark_onboarded_at_home) and adding comprehensive unit tests to verify the behavior of primary (.codewhale) and legacy (.deepseek) marker files. The feedback suggests replacing dirs::home_dir() with crate::config::effective_home_dir() to ensure consistent and robust home directory resolution across the application.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 132 to +134
pub fn default_marker_path() -> Option<PathBuf> {
dirs::home_dir().map(|home| {
let primary = home.join(".codewhale").join(".onboarded");
if primary.exists() {
return primary;
}
home.join(".deepseek").join(".onboarded")
})
dirs::home_dir().map(|home| marker_path_with_home(&home))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure consistency across the application, we should use crate::config::effective_home_dir() instead of dirs::home_dir(). effective_home_dir() is more robust as it checks environment variables like HOME and USERPROFILE before falling back to dirs::home_dir(). This prevents issues where configuration files are loaded from one directory while the onboarding marker is read from or written to another.

Suggested change
pub fn default_marker_path() -> Option<PathBuf> {
dirs::home_dir().map(|home| {
let primary = home.join(".codewhale").join(".onboarded");
if primary.exists() {
return primary;
}
home.join(".deepseek").join(".onboarded")
})
dirs::home_dir().map(|home| marker_path_with_home(&home))
}
pub fn default_marker_path() -> Option<PathBuf> {
crate::config::effective_home_dir().map(|home| marker_path_with_home(&home))
}

Comment on lines 152 to +157
pub fn mark_onboarded() -> std::io::Result<PathBuf> {
let path = default_marker_path().ok_or_else(|| {
let home = dirs::home_dir().ok_or_else(|| {
std::io::Error::new(std::io::ErrorKind::NotFound, "Home directory not found")
})?;
mark_onboarded_at_home(&home)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure consistency across the application, we should use crate::config::effective_home_dir() instead of dirs::home_dir(). effective_home_dir() is more robust as it checks environment variables like HOME and USERPROFILE before falling back to dirs::home_dir(). This prevents issues where configuration files are loaded from one directory while the onboarding marker is read from or written to another.

Suggested change
pub fn mark_onboarded() -> std::io::Result<PathBuf> {
let path = default_marker_path().ok_or_else(|| {
let home = dirs::home_dir().ok_or_else(|| {
std::io::Error::new(std::io::ErrorKind::NotFound, "Home directory not found")
})?;
mark_onboarded_at_home(&home)
}
pub fn mark_onboarded() -> std::io::Result<PathBuf> {
let home = crate::config::effective_home_dir().ok_or_else(|| {
std::io::Error::new(std::io::ErrorKind::NotFound, "Home directory not found")
})?;
mark_onboarded_at_home(&home)
}

The provider registry drift check expects the TUI config layer to spell out the documented Hugging Face env precedence. Check HUGGINGFACE_API_KEY before the HF_TOKEN fallback in the active-provider auth probe.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Address Gemini review feedback by resolving the onboarding marker home through the TUI config home helper instead of dirs::home_dir directly. This keeps onboarding state aligned with the rest of CodeWhale's home-dir resolution.

Copy link
Copy Markdown
Contributor Author

Addressed the Gemini review feedback in fca5e820: onboarding now resolves the marker home through crate::config::effective_home_dir() instead of calling dirs::home_dir() directly, while keeping the injectable helper tests for fresh/legacy marker behavior.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@Hmbown Hmbown added the v0.8.63 Targeting v0.8.63 label Jun 18, 2026
@Hmbown Hmbown added this to the v0.8.63 milestone Jun 18, 2026
@Hmbown

Hmbown commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Marking this as a v0.8.63 candidate from release triage. Please keep the landing criteria strict: green CI, focused scope, and no unrelated cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.8.63 Targeting v0.8.63

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legacy deepseek configuration

2 participants