refactor(config): fold require_user_config_path into require_config_path#2872
Merged
Conversation
`require_config_path()` and `require_user_config_path()` both just wrapped `config_path()`. Delete the bin-crate `require_user_config_path()` and point `config create` / `config show` at the lib-crate `require_config_path()`. The two wrapper tests go with it: one tested a trivial wrapper; the other guarded a divergent-resolver regression (#1134) that is now structurally impossible, since `config create` / `show` resolve through `config_path()` itself. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
May 21, 2026
max-sixty
added a commit
that referenced
this pull request
May 23, 2026
…ath (#2872) `require_config_path()` (added in #2862) and the older `require_user_config_path()` in `src/commands/config/state.rs` both just wrapped `config_path()` with a `Result`. Two functions, two slightly different error messages, one purpose. This deletes `require_user_config_path()` and points its four callers — `config create` (×2) and `config show` (×2) — at the lib-crate `require_config_path()`. The two wrapper tests in `config/mod.rs` are removed with it. `test_require_user_config_path_returns_ok` tested a trivial wrapper. `test_require_user_config_path_matches_config_path` guarded issue #1134 (config-create resolving a *different* path than config-loading) — that regression is now structurally impossible: `config create` / `show` resolve through `require_config_path()`, which is `config_path()` itself, so there is no separate resolver left to diverge. One behavior delta: when no config directory can be resolved, `config create` / `config show` now error `Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME` instead of `Cannot determine config directory`. No snapshot test references either string. Follow-up to #2862. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
require_config_path()(added in #2862) and the olderrequire_user_config_path()insrc/commands/config/state.rsboth just wrappedconfig_path()with aResult. Two functions, two slightly different error messages, one purpose.This deletes
require_user_config_path()and points its four callers —config create(×2) andconfig show(×2) — at the lib-craterequire_config_path().The two wrapper tests in
config/mod.rsare removed with it.test_require_user_config_path_returns_oktested a trivial wrapper.test_require_user_config_path_matches_config_pathguarded issue #1134 (config-create resolving a different path than config-loading) — that regression is now structurally impossible:config create/showresolve throughrequire_config_path(), which isconfig_path()itself, so there is no separate resolver left to diverge.One behavior delta: when no config directory can be resolved,
config create/config shownow errorCannot determine config directory. Set $HOME or $XDG_CONFIG_HOMEinstead ofCannot determine config directory. No snapshot test references either string.Follow-up to #2862.