Skip to content

test(ruff-format): pass ruff-format's hook suites on Windows Git Bash - #10011

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/ruff-format-test-windows-git-bash
Oct 25, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/ruff-format-test-windows-git-bash

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #6531

Summary

plugins/ruff-format/hooks/ruff-format.test.sh failed 4 cases on Windows Git Bash, and ruff-format-end-of-turn.test.sh failed 1. Both causes are in the tests, not the hooks.

Fix

  • Probe-gate (3 cases). A Windows jq.exe ends each line with CRLF, and read -r keeps the CR. Every SessionStart argument read from hooks.json therefore carried a trailing \r, and node reported Cannot find module '...\lib\prerequisites.mjs' for a file that exists. A traced re-run showed ARG[...prerequisites.mjs^M]. Fix: | tr -d '\r' on both jq reads.
  • Spawn budget (1 case in each suite). Both suites gated on command -v strace, but Git Bash ships Cygwin's strace, which has no -s, so scripts/hook-census.sh exited 1. Both suites now gate on a working Linux strace with the probe plugins/autonomy/hooks/lane-stop-gate.test.sh:1320 already uses (strace -qq -o /dev/null -e trace=execve true).
  • .changes/ruff-format/: fragment, bump none (test only).

Verification

  • Linux (WSL2): bash plugins/ruff-format/hooks/ruff-format.test.sh gives PASS=40 FAIL=0. The spawn-budget case still runs and passes.
  • Windows 11 Git Bash (melo-desk-001, reached over /fleet:reach): GNU bash 5.3.15 (Cygwin build), node v24.21.0, ruff 0.17.0, Python 3.14.8.
    • Before, at origin/main 9965f0c07: PASS=36 FAIL=4.
    • After, with this patch applied: PASS=39 FAIL=0, both plain and with MSYS=winsymlinks:nativestrict. The census case prints its skip note.
    • ruff-format-end-of-turn.test.sh: 8 passed, 1 failed before; 8 passed, 0 failed after. On Linux: 9 passed, 0 failed.
  • shellcheck is clean, and scripts/check-changelog-fragments.sh --check passes.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01X1zWtmVHsCdqJk7AEeNE2b

kyle-sexton and others added 2 commits October 25, 2026 08:47
A Windows jq.exe ends each output line with CRLF, and read keeps the CR, so
every probe-gate argument in ruff-format.test.sh carried a trailing CR and
node could not find prerequisites.mjs. Strip it. In both ruff-format suites,
gate the spawn-budget census on a working Linux strace (the probe
lane-stop-gate.test.sh already uses), not on any strace on PATH: Git Bash
ships Cygwin's, which has no -s.

Closes #6531

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 25, 2026 13:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T13:44:52.316362Z f04bc39 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed f04bc39da8aff9dacb7e15e0df98a8f9c0e9047e: 0 finding(s), 0 as inline comments.

No security issues found in this pull request.

critical-findings: 0

I read the whole diff (3 files) and the PR context.

  • Changed files: two shell test suites (plugins/ruff-format/hooks/ruff-format.test.sh and ruff-format-end-of-turn.test.sh) and a changelog fragment (.changes/ruff-format/...md, bump: none).
  • Trusted paths: none of the changed files match the listed globs.
  • Plugin manifests: none changed, so there are no manifest <field> lines.
  • Instruction surfaces: no CLAUDE.md, skill, agent body, hook allowlist or block list was deleted or softened. The hooks themselves are untouched.

What the changes do:

  • | tr -d '\r' is added to two jq reads of repo-controlled files (hooks.json and prerequisites.json). It only removes carriage returns from the output. The values still reach the same node and read calls as before, so no new injection surface or trust boundary is added.
  • The strace gate now also runs strace -qq -o /dev/null -e trace=execve true. The command is fixed, takes no external input, and writes to /dev/null. It only decides whether the spawn-budget test runs. A failed probe skips that test and prints a NOTE, which is the intended behavior on Git Bash.

The PR description and issue comments contain no embedded directives aimed at the review.

This run spends no paid or billable resources, so there is no cost hold.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed f04bc39da8aff9dacb7e15e0df98a8f9c0e9047e: 0 finding(s), 0 as inline comments.

No blocking findings. I read the diff, the PR context and the surrounding test code. I did not run the suites, so the PR's Windows and Linux pass counts are author-claimed and unverified.

  • CRLF fix: | tr -d '\r' on both SessionStart jq reads in ruff-format.test.sh (lines 117–118) addresses the reported cause of the three probe-gate failures. read -r keeps a trailing CR, and the filter removes it. The tr sits inside the process substitution, so the loop's variables are unaffected.
  • strace gate: Both suites now require strace -qq -o /dev/null -e trace=execve true to succeed. A Cygwin strace rejects the -e trace=execve form, and a Linux host where ptrace is blocked skips the case too. Both fall back to the NOTE line, whose wording matches the new condition.
  • Closing issue ruff-format.test.sh: 4 failures on Windows Git Bash (probe-gate node loader, finding report shape) #6531: It states no acceptance criteria beyond the suite passing on Git Bash. The "finding report shape" failure it first listed was already gone, per its own comments. The change targets the two remaining causes.
  • Changelog fragment: bump: none fits a test-only change, and there are no plugin manifest changes.
  • Not reported: Line 169 of ruff-format.test.sh and line 39 of ruff-format-end-of-turn.test.sh read jq -r output through sed into mapfile -t, which would also keep a CR on Windows. The PR reports both suites passing on Windows Git Bash. I could not confirm that those reads never feed a path argument, so I did not raise it as a finding. A maintainer could check whether the same tr -d '\r' belongs there.
  • Spend: none.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit c10fbcb Oct 25, 2026
69 checks passed
@kyle-sexton
kyle-sexton deleted the fix/ruff-format-test-windows-git-bash branch October 25, 2026 14:36
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.

ruff-format.test.sh: 4 failures on Windows Git Bash (probe-gate node loader, finding report shape)

1 participant