fix(scripts): make the specifier audit path-separator agnostic - #6355
Conversation
Review round: isGeneratedPath split the repo-relative path on '/', but
path.relative returns backslashes on Windows, so '.source' and 'node_modules'
never matched a segment and generated output was treated as source. The repo
does support Windows dev — scripts/setup branches on win32.
The finding named one site; there were three. isCompiledSource compared against
'apps/sim/scripts/' with the same assumption, and workspaceFor matched
`${w.dir}/`, which on Windows never matches an absolute path and would have
dropped every file out of its own workspace — silently disabling tsconfig paths
resolution rather than erroring.
Normalized behind a repoPath() helper, with workspaceFor using path.sep against
absolute paths. Reported paths now go through it too, so output is identical on
either platform. spec.split('/') is left alone: import specifiers are always
'/'-separated regardless of host.
Verified by simulating win32 separators through the same predicates, and posix
behaviour is unchanged at 37,437 specifiers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview A
Reviewed by Cursor Bugbot for commit d15cf1d. Configure here. |
|
@cursor review |
Greptile SummaryThis PR makes the import-specifier audit path-separator agnostic.
Confidence Score: 5/5The PR appears safe to merge with no actionable regressions identified. The changed path comparisons preserve POSIX behavior while correctly normalizing Windows-relative paths and using the native separator for absolute workspace matching.
|
| Filename | Overview |
|---|---|
| scripts/check-import-specifiers.ts | The path normalization and workspace-boundary changes consistently handle native absolute paths and normalized repository-relative paths without an identified regression. |
Reviews (1): Last reviewed commit: "fix(scripts): make the specifier audit p..." | Re-trigger Greptile
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d15cf1d. Configure here.
Summary
Follow-up to #6351. Cursor Bugbot raised this on that PR after it had already merged, so it lands separately.
isGeneratedPathsplit the repo-relative path on/, butpath.relativereturns backslashes on Windows — so.sourceandnode_modulesnever matched a segment and generated output was treated as scannable source. The repo does support Windows development (scripts/setup/*branches onwin32).The finding named one site; there were three
isGeneratedPath— the reported one.isCompiledSourcecompared against'apps/sim/scripts/'with the same assumption, so the test/script exclusions silently stopped applying.workspaceFormatched`${w.dir}/`against an absolute path. On Windows that never matches, dropping every file out of its own workspace — which disables tsconfigpathsresolution entirely rather than erroring, so@/…specifiers would be reported as unverifiable instead of being checked. That is the worst of the three: a guard that quietly stops guarding.Changes
All path comparisons go through a
repoPath()helper that normalizes to/;workspaceForusespath.sepagainst absolute paths. Reported paths use it too, so output is byte-identical on either platform.spec.split('/')is deliberately left alone — import specifiers are always/-separated regardless of host.Type of Change
Testing
biome checkcleanNo Windows machine was available to run this end-to-end, so the verification is at the predicate level rather than a real win32 run.
Checklist