cook doctor validate counts broken recipe references into its error total but never into the recipe count, so the summary contradicts itself.
Reproduction
Two recipes each referencing a file that does not exist:
❌ 2 error(s) found in 0 recipe(s)
Two errors were found, in no recipes.
Cause
run_validate increments total_errors once per broken reference, but recipes_with_errors is only incremented while walking recipes that failed to parse. A dangling reference is discovered afterwards, during the reference-resolution pass, and that pass does not touch the recipe counter.
The exit code is consistent with the error count — --strict does fail — so only the wording is wrong.
Impact
Cosmetic, but confusing exactly when someone is trying to work out what to fix: the summary tells them there is nothing to look at.
Suggested direction
Attribute each broken reference to the recipe that contains it, and count that recipe in recipes_with_errors. The referencing recipe's path is already known at the point the reference is found.
Noticed while extracting doctor into a library crate. The behaviour is preserved exactly there — the library keeps broken references out of its diagnostics so the CLI can reproduce its historical arithmetic — so fixing this is a deliberate decision rather than a side effect of the refactor.
cook doctor validatecounts broken recipe references into its error total but never into the recipe count, so the summary contradicts itself.Reproduction
Two recipes each referencing a file that does not exist:
Two errors were found, in no recipes.
Cause
run_validateincrementstotal_errorsonce per broken reference, butrecipes_with_errorsis only incremented while walking recipes that failed to parse. A dangling reference is discovered afterwards, during the reference-resolution pass, and that pass does not touch the recipe counter.The exit code is consistent with the error count —
--strictdoes fail — so only the wording is wrong.Impact
Cosmetic, but confusing exactly when someone is trying to work out what to fix: the summary tells them there is nothing to look at.
Suggested direction
Attribute each broken reference to the recipe that contains it, and count that recipe in
recipes_with_errors. The referencing recipe's path is already known at the point the reference is found.Noticed while extracting
doctorinto a library crate. The behaviour is preserved exactly there — the library keeps broken references out of its diagnostics so the CLI can reproduce its historical arithmetic — so fixing this is a deliberate decision rather than a side effect of the refactor.