Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/drift/__tests__/path-false-positives.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ describe("MISSING_PATH false positives", () => {
).toEqual([]);
});

// Not part of #143. A trailing version number reads as a file extension to
// the guard above, so `release/2.1.0` never reaches the unrooted check and is
// reported as a missing path. Tracked separately; unskip with the fix.
it.skip("does not claim a version-shaped branch name", () => {
it("does not claim version-shaped branch and runtime references (#201)", () => {
expect(
missingPaths("# Release\n\n- Work landed on `release/2.1.0` and `python/3.11`\n")
).toEqual([]);
Expand Down
2 changes: 1 addition & 1 deletion src/drift/checkers/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function isUnrootedReference(
const trimmed = value.replace(/\/+$/, "");
const isDirectoryRef = trimmed !== value;
if (!trimmed.includes("/") && !isDirectoryRef) return false;
if (/\.[A-Za-z0-9]+$/.test(trimmed)) return false;
if (/\.[A-Za-z][A-Za-z0-9]*$/.test(trimmed)) return false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve real numeric and digit-leading file extensions

When the first directory exists at neither the project nor scaffold root, this guard lets two classes of real filenames reach the unrooted-reference check and disappear from the report: numeric extensions (manuals/mex.1, manuals/admin.8, logs/server.log.1) and extensions that begin with digits but contain letters (backups/release.7z, models/widget.3mf). All five produce MISSING_PATH on the base commit and no issue on this PR.

Reproductions to add to path-false-positives.test.ts, using its existing helper:

expect(missingPaths("# Docs\n\n- See `manuals/mex.1`\n"))
  .toEqual(["manuals/mex.1"]); // actual: []
expect(missingPaths("# Assets\n\n- See `backups/release.7z`\n"))
  .toEqual(["backups/release.7z"]); // actual: []

Please narrow the version exemption to complete version-shaped final components and preserve ordinary file extensions, including those starting with digits. The first-directory check should continue to apply to genuine version references.


const first = trimmed.split("/")[0];
if (!first || first.startsWith("@") || first === "." || first === "..") return false;
Expand Down