You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doctor validate reports 'N error(s) found in 0 recipe(s)' for broken references #437
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.
Activity
fix(doctor): attribute a broken reference to the recipe that wrote it