Skip to content

refactor(config): fold require_user_config_path into require_config_path#2872

Merged
max-sixty merged 1 commit into
mainfrom
nix-flake-test-isolation
May 21, 2026
Merged

refactor(config): fold require_user_config_path into require_config_path#2872
max-sixty merged 1 commit into
mainfrom
nix-flake-test-isolation

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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.

`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>
@max-sixty max-sixty merged commit d1f65ec into main May 21, 2026
36 checks passed
@max-sixty max-sixty deleted the nix-flake-test-isolation branch May 21, 2026 21:01
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>
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.

2 participants