Repository navigation
fix(doctor): canonicalize -b before handing it to core - #733
Closed
drawmeanelephant wants to merge 1 commit into
Closed
drawmeanelephant wants to merge 1 commit into
drawmeanelephant wants to merge 1 commit into
Conversation
The doctor subcommands passed `args.base_path` to core verbatim, so `cook doctor validate -b ./` reached the search layer as `./` and failed with "cannot express bom.cook relative to it" while `cook search -b ./` worked. Run the flag through `resolve_to_absolute_path` like the other commands do. Closes #714
LeMyst
reviewed
Oct 13, 2026
LeMyst
left a comment
Collaborator
There was a problem hiding this comment.
Thanks. The \\?\ concern doesn't apply on Windows: configure_context already canonicalizes ctx.base_path the same way, so -b now just matches the default. Two points:
- The error no longer names the path.
cook doctor validate -b /nonexistentnow prints only "Error: Failed to canonicalize path" (plus an ERROR log line). Before, core said "Cannot search '…': no such directory".shopping-list -bandpantry -balready have the same generic message, becauseutil/mod.rs:202adds no path context.with_context(|| format!("Base path not found: {path}"))there would fix it everywhere. - Overlap with #734. Once #734 lands,
ctx.base_pathis the canonicalized-bfor doctor, and core already defaultsbase_dirtoctx.base_path(crates/core/src/doctor.rs:254). Soscan_dir(src/doctor.rs:206, used at 284/326/372) could simply passbase_dir: None. It might be simplest to fold this into #734.
A regression test for -b ./ would be nice.
🤖 Analysis and recommendations made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst.
Contributor
Author
|
Superseded by #734 per the review suggestion. There, |
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.
Closes #714
cook doctor validate -b ./passed the raw./to core, whose search layer could not express found recipes relative to it (Cannot search './'). All three subcommands now run the flag throughresolve_to_absolute_pathfirst, matching what the other commands do.Test plan
cook doctor validate -b ./and-b .validate the directory's recipescook doctor validate -b /nonexistentstill errors cleanly