Skip to content

Broken reference paths are reported with a backslash on Windows, inconsistently between commands #442

Closed

Description

@dubadub

On Windows, cook shopping-list and cook doctor validate report the same broken recipe reference differently.

Given @./absent{} in a recipe:

cook doctor validate     →  ❌ Missing reference: ./absent
cook shopping-list …     →  Recipe not found: .\absent

On Unix both report absent / ./absent consistently.

Cause

doctor builds the reference path with an explicit forward slash (reference.path("/")), while the shopping-list expansion joins with std::path::MAIN_SEPARATOR_STR. On Windows that yields .\absent, and the ./-stripping in find::get_recipe only matches the forward-slash form — so the prefix survives into the reported name.

This contradicts an explicit contract in the code, which says the ./ "must not survive into the reported name, or the message names something the caller never asked for".

Scope

Cosmetic only. Resolution is unaffected — Utf8Path::join handles .\sauce natively on Windows — so only the text of the error message differs. The affected surfaces are the RecipeNotFound name, the reference name in errors, and the display path used for a referenced recipe's parse diagnostics.

Suggested direction

Join with a literal "/" in the shopping-list reference builders, matching what doctor already does. Windows accepts forward slashes in join, so resolution is unchanged.

Notes

Found while making cookcli-core's tests portable for the cross-platform CI matrix (#434) — these unit tests had never run on Windows before, because CI only recently began testing the whole workspace. Reported rather than fixed, since that branch is at its merge gate and a behaviour change there wants a deliberate decision.

Activity

  1. added
    help wanted
    on Aug 13, 2026
  2. added 2 commits that reference this issue on Aug 31, 2026
    caad01a
    61bd8ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions