Skip to content

fix(config): add XDG fallback to resolve_config_path for ACP IDE launch context#1947

Merged
bug-ops merged 3 commits intomainfrom
1945-acp-xdg-config-fallback
Mar 17, 2026
Merged

fix(config): add XDG fallback to resolve_config_path for ACP IDE launch context#1947
bug-ops merged 3 commits intomainfrom
1945-acp-xdg-config-fallback

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 17, 2026

Summary

  • Extends resolve_config_path() from 3 to 4 resolution steps: CLI flag → ZEPH_CONFIG env → config/default.toml (CWD, if exists) → ~/.config/zeph/config.toml (XDG fallback)
  • Step 3 is now conditional — only returned when the file exists, so the chain continues to step 4 when launched from an IDE workspace directory
  • tracing::debug! emitted at each step with resolved path and source
  • 4 unit tests added using an injected get_env closure (no set_var, no side effects)

Fixes #1945

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — 0 warnings
  • cargo nextest run --workspace --features full --lib --bins — 6121/6121 passed
  • Unit tests cover all 4 branches: CLI flag, env var, CWD default, XDG fallback
  • Existing resolve_config_path_cli_override and resolve_config_path_default tests in bootstrap/tests.rs still pass

bug-ops added 2 commits March 17, 2026 16:05
Extend the config resolution chain from 3 to 4 steps:
1. --config CLI flag (unchanged)
2. ZEPH_CONFIG env var (unchanged)
3. config/default.toml relative to CWD (only when the file exists)
4. ~/.config/zeph/config.toml XDG fallback (always returned as final default)

Each step emits a tracing::debug! message indicating the resolution path.
Add unit tests covering all four branches without unsafe set_var usage.

Closes #1945
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 17, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 17, 2026 15:31
@bug-ops bug-ops merged commit 3e066bd into main Mar 17, 2026
20 checks passed
@bug-ops bug-ops deleted the 1945-acp-xdg-config-fallback branch March 17, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(config): default config/default.toml not found when launched from IDE (ACP CWD mismatch)

1 participant