cook doctor validate reports recipes in a different order on each run, so identical input produces non-identical output.
Cause
run_validate walks cooklang_find's RecipeTree, whose children are stored in a HashMap:
// cooklang-find-0.6.1/src/tree/model.rs:30
pub children: HashMap<String, RecipeTree>,
Rust's default HashMap hasher is seeded randomly per process, so iteration order differs between invocations. The walk emits each recipe's 📄 {path} header in whatever order it encounters them.
Impact
- Output cannot be diffed between runs, so it is hard to tell whether a change to a recipe collection improved or worsened anything.
- Anything comparing
doctor validate output in CI is inherently flaky.
- Repeated runs while fixing recipes shuffle the list, which is disorienting when working through a large collection.
Only visible with more than one recipe carrying errors or warnings, which is likely why it has gone unnoticed.
Suggested direction
Sort by path before reporting. Directory listing order is not a meaningful contract, and a stable order makes the output diffable.
Noticed while extracting doctor validate into a library crate. The extraction sorts by path — a library returning results in random order is worse than a CLI doing so — so this is fixed on that branch as a side effect. Filing separately because it is a pre-existing defect on main and worth recording independently of whether that branch lands.
cook doctor validatereports recipes in a different order on each run, so identical input produces non-identical output.Cause
run_validatewalkscooklang_find'sRecipeTree, whose children are stored in aHashMap:Rust's default
HashMaphasher is seeded randomly per process, so iteration order differs between invocations. The walk emits each recipe's📄 {path}header in whatever order it encounters them.Impact
doctor validateoutput in CI is inherently flaky.Only visible with more than one recipe carrying errors or warnings, which is likely why it has gone unnoticed.
Suggested direction
Sort by path before reporting. Directory listing order is not a meaningful contract, and a stable order makes the output diffable.
Noticed while extracting
doctor validateinto a library crate. The extraction sorts by path — a library returning results in random order is worse than a CLI doing so — so this is fixed on that branch as a side effect. Filing separately because it is a pre-existing defect onmainand worth recording independently of whether that branch lands.