Skip to content

[Bug]: --repo-root is rejected as not-top-level when the Windows drive letter is lowercase #274

Description

@jmvassoler

Archify version or commit

2.17.0-dev.0, at main commit 7a16d30.

Installation method

Git clone

Diagram type

Architecture

Exact command

# Same directory both times. Only the drive letter's case differs.
node archify/bin/archify.mjs deliver architecture c:\work\evidence-repo\minimal.architecture.json ^
  c:\work\evidence-repo\out.html --repo-root c:\work\evidence-repo --json   # exit 1
node archify/bin/archify.mjs deliver architecture C:\work\evidence-repo\minimal.architecture.json ^
  C:\work\evidence-repo\out.html --repo-root C:\work\evidence-repo --json   # exit 0

A lowercase drive letter is what a shell hands you routinely: cd, tab
completion, Git Bash / MSYS cygpath, %CD% after some launchers, and
copy-paste from tooling all produce c:\....

Minimal redacted JSON reproduction

{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Drive-case reproduction",
    "repository": {
      "url": "https://github.com/example/evidence-repo",
      "revision": "7f6a16e90328d2956b508f4070f5d55b75ade2f2"
    }
  },
  "components": [
    { "id": "router", "type": "backend", "label": "Router", "pos": [40, 40], "size": [130, 60],
      "sources": [{ "path": "src/router.js", "line": 1, "end_line": 3 }] },
    { "id": "store", "type": "database", "label": "Store", "pos": [260, 40], "size": [130, 60] }
  ],
  "connections": [{ "id": "read", "from": "router", "to": "store" }]
}

The fixture repository is one commit with a three-line src/router.js and
origin set to https://github.com/example/evidence-repo.git.

Validation receipt or exact error

Verbatim deliver --json receipt for the lowercase run, with the private path
prefix replaced by C:/work. Note that supportedFixes asks for the directory
that was already passed, and that the diagnostic carries the proof of the defect
itself: subject.repoRoot and evidence.gitTopLevel are the same directory in
two spellings.

{
  "schemaVersion": 1,
  "ok": false,
  "command": "deliver",
  "stage": "render",
  "type": "architecture",
  "input": "C:\work\evidence-repo\minimal.architecture.json",
  "output": "C:\work\evidence-repo\out.html",
  "error": "Evidence root must be the Git top-level directory: C:/work/evidence-repo",
  "diagnostics": [
    {
      "code": "repository-evidence/root-not-top-level",
      "severity": "error",
      "message": "Evidence root must be the Git top-level directory: C:/work/evidence-repo",
      "subject": {
        "surface": "repository-evidence",
        "repoRoot": "c:\work\evidence-repo"
      },
      "evidence": {
        "gitTopLevel": "C:/work/evidence-repo"
      },
      "supportedFixes": [
        "pass --repo-root C:/work/evidence-repo"
      ]
    }
  ]
}

The uppercase run on the same directory returns ok: true with
evidence.verified: true and one reference.

Expected behavior

--repo-root identifies a directory. On Windows the volume is
case-insensitive, so c:\work\evidence-repo and C:\work\evidence-repo are the
same directory and both should verify.

Actual behavior

The lowercase form fails with repository-evidence/root-not-top-level and no
artifact is written; the uppercase form verifies. verifyRepositoryEvidence
compares path.resolve(repoRootInput) (which preserves the case the caller
typed) against git rev-parse --show-toplevel (which always reports the
repository's own form) with a strict !==:

https://github.com/tt-a1i/archify/blob/7a16d30/archify/renderers/shared/repository-evidence.mjs#L133

The guard is right; the comparison is not. realpathSync does not normalize the
drive-letter case on Windows, so the two spellings of one directory compare
unequal. The failure is also hard to act on: the diagnostic's own
supportedFixes repeats the path that was just rejected, differing only in a
character whose case Windows does not distinguish.

POSIX is unaffected — paths there are case-sensitive and the strict comparison is
correct.

Environment

Windows 11 Pro (10.0.26200), Node.js 22.22.3, Git Bash and PowerShell, Git
clone of main at 7a16d30. Reproduced from a clean worktree with
npm ci in archify/.

Final checks

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions