Skip to content

MISSING_PATH: a version-shaped reference like release/2.1.0 is reported as a missing file #201

Description

@theyashasvipandey

mex check reports a MISSING_PATH error for references shaped
<word>/<version> — git branch names and pinned runtimes, not file paths:

✗ MISSING_PATH:123 Referenced path does not exist: release/2.1.0

src/drift/checkers/path.ts has a guard, isUnrootedReference, whose job is to
treat this kind of token as prose: if nothing by the name of the first segment
exists, it is not a real relative path. The guard never runs here, because it
returns early on anything that looks like it has a file extension:

if (/\.[A-Za-z0-9]+$/.test(trimmed)) return false;

A trailing version number matches that pattern — .1 in 2.1.0 reads as an
extension — so the value skips the prose check and is reported missing.

The inconsistency is visible within a single document. These differ only by a
trailing word:

release/2.1.0      FLAGGED        release/2.1.0-rc   ignored as prose
api/v1.2           FLAGGED        api/v1             ignored as prose
python/3.11        FLAGGED
node/20.11         FLAGGED

release/2.1.0 is the git-flow standard branch name, so this affects any
project that documents a release branch, and python/3.11 or node/20.11 is
the ordinary way to write a pinned runtime in a stack document.

To Reproduce

main already carries a failing case for this, skipped:

src/drift/__tests__/path-false-positives.test.ts
  it.skip("does not claim a version-shaped branch name", …)

Remove the .skip to reproduce.

Expected behavior

A trailing numeric segment is a version, not a file extension, so the value
should reach the existing prose guard and be dropped rather than reported.

One boundary worth knowing

Making the extension check require an alphabetic character is only half of it.
Once the value reaches isUnrootedReference, that guard clears it only if the
first path segment does not exist on disk
. So api/v1.2 in a repository that
really has an api/ directory will still be reported. The skipped test covers
the common case; the narrower one can be left alone or handled separately.

Activity

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

    bugSomething isn't workingcheckerRelated to drift checkersgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions