Skip to content

fix: normalize Windows paths in hook syntax checks - #3112

Closed
yuriysan wants to merge 1 commit into
garrytan:mainfrom
yuriysan:fix/windows-hook-check-paths
Closed

yuriysan wants to merge 1 commit into
garrytan:mainfrom
yuriysan:fix/windows-hook-check-paths

Conversation

@yuriysan

Copy link
Copy Markdown
Contributor

Git Bash converts hook entry arguments from /c/... to C:/... before starting native Bun. Successful build rows therefore fail the checker's shell-path lookup and setup refuses valid TypeScript hooks as "bun could not bundle the TypeScript entry".

Normalize Bun's entry, input and diagnostic paths back to shell spelling. Canonicalize Git Bash mount aliases such as /tmp through their native drive path so temporary installations use the same lookup keys. Add a regression that checks a healthy installation with spaces and then injects a syntax error, which must still be rejected with a real diagnostic.

Validation on Windows 11, Git Bash and Bun 1.3.14:

  • All nine shipped hooks pass the real checker (before the change, all six TypeScript-backed hooks failed).
  • Four focused tests pass: shipped hooks, healthy fixture, Windows paths with spaces plus an injected syntax error, and caller config isolation.
  • git diff --check passes.
  • The Windows-wide free suite was attempted but stopped after failures including EPERM on dependency reads/symlink creation and browser/process timeouts. This is not a full-suite pass or release acceptance; logs were retained locally. Draft pending broader CI validation.

Focused command: bun test test/setup-hook-syntax-gate.test.ts --timeout 90000 --test-name-pattern "native Windows drive|every shipped hook|healthy fixture passes|root with spaces".

@trunk-io

trunk-io Bot commented Oct 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Adopted in v1.91.89.0 (e6edff0, #3140). The Bun path mapping and your spaces-plus-syntax-error test landed (the test is adapted to assert the exact file:line). Root canonicalization goes through the shared gstack_path_shell helper. The real Windows CI run passed with your fix. You're credited as co-author on the merged commit. Thanks @yuriysan.

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