Skip to content

fix(scripts): make the specifier audit path-separator agnostic - #6355

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/specifier-audit-windows-paths
Aug 7, 2026
Merged

fix(scripts): make the specifier audit path-separator agnostic#6355
waleedlatif1 merged 1 commit into
stagingfrom
fix/specifier-audit-windows-paths

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #6351. Cursor Bugbot raised this on that PR after it had already merged, so it lands separately.

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 scannable source. The repo does support Windows development (scripts/setup/* branches on win32).

The finding named one site; there were three

  • isGeneratedPath — the reported one.
  • isCompiledSource compared against 'apps/sim/scripts/' with the same assumption, so the test/script exclusions silently stopped applying.
  • workspaceFor matched `${w.dir}/` against an absolute path. On Windows that never matches, dropping every file out of its own workspace — which disables tsconfig paths resolution 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 /; workspaceFor uses path.sep against 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

  • Bug fix

Testing

  • Simulated win32 separators through the same predicates:
"apps\docs\.source\server.ts"        -> generated: true
"apps\sim\lib\x.ts"                  -> generated: false
"packages\utils\node_modules\y.ts"   -> generated: true
scripts filter on "apps\sim\scripts" -> true
  • posix behaviour unchanged: 37,437 first-party specifiers across 11,243 files still resolve clean
  • biome check clean

No 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

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Relevant tests are passing
  • No new warnings introduced

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.
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 7, 2026 12:19am

Request Review

@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are limited to the dev-only import-specifier audit script; no runtime app, auth, or data paths are affected.

Overview
On Windows, path.relative uses backslashes while the audit script compared paths with /, so several guards behaved incorrectly or silently stopped working.

A repoPath() helper normalizes repo-relative paths to forward slashes. isGeneratedPath and isCompiledSource now use it so generated output (e.g. .source, node_modules) and script exclusions match on win32. Violation output uses the same helper so reported paths stay consistent across platforms.

workspaceFor now checks file.startsWith(w.dir + sep) instead of a hardcoded /, so files stay tied to the correct workspace and tsconfig paths resolution (including @/…) still runs on Windows instead of failing quietly.

Reviewed by Cursor Bugbot for commit d15cf1d. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the import-specifier audit path-separator agnostic.

  • Normalizes repository-relative paths to forward slashes for classification and reporting.
  • Uses the host separator when associating absolute file paths with workspaces.
  • Restores Windows handling for generated paths, script exclusions, and tsconfig path resolution.

Confidence Score: 5/5

The 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.

Important Files Changed

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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.

@waleedlatif1
waleedlatif1 merged commit de02bc6 into staging Aug 7, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/specifier-audit-windows-paths branch August 7, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant