Files
coder/scripts/metricsdocgen/scanner
Nick Vigilante d031680ff2 fix(scripts/metricsdocgen/scanner): normalize package keys to slash paths (#30360)
Fixes the Windows failures in `TestBuildPrefixIndex` and `TestExcluded`
(ENG-3443). The scanner keyed package directories with `filepath.Dir`,
which uses `\` on Windows, but compared them against keys derived from
Go import paths and against `excludeDirs`, which always use `/`.
Prefixes never reached imported packages, and excluded subtrees weren't
skipped.

Each parsed file now records its directory once in slash form
(`packageDir`), and the `prefixIndex` doc states the key rule.
`excluded` normalizes its input because `scanDirectory` passes it native
`filepath.WalkDir` paths. Generated output on Linux is unchanged.

PR CI only runs `./cli/... ./enterprise/cli/... ./agent/...` on Windows,
so I dispatched [`nightly-gauntlet` on this
branch](https://github.com/coder/coder/actions/runs/37316261411). On
`windows-2022`, both `scripts/metricsdocgen` and
`scripts/metricsdocgen/scanner` pass. That run tested `c5462169cd`. The
only later commit drops an unused field and rewords comments, so the
result still applies.

<details>
<summary>Unrelated failures in the gauntlet run</summary>

The Windows job still fails on `TestWorkspaceToolsGolden`,
`TestEditMessageCancelsToolCallsOnAgent`, and
`TestTools/WorkspaceExecute`. These fail the same way in [main's
2026-10-05
nightly](https://github.com/coder/coder/actions/runs/37262889155),
together with the scanner failures this PR fixes.
`TestAcquirer_MatchTags` also failed once, in provisioner code that this
PR doesn't touch.

</details>

---

🤖 Generated by Coder Agents on behalf of @nickvigilante.
2026-10-06 14:53:20 -04:00
..