Skip to content

fix(markdown-format): name the approval marker in POSIX form on Git Bash - #12414

Merged
kyle-sexton merged 1 commit into
mainfrom
host-run/9889-gitbash-suites
Nov 2, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
host-run/9889-gitbash-suites

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #9889

Summary

The six formatter suites #9889 lists already pass on Windows Git Bash at current main: #10896's tr -d '\r' reads and working-strace probe fixed them. The one failure left was markdown-format's "the pre-commit entry names an approval marker in the git directory" case, and the same cause failed two cases in markdown-check.test.sh, along with ten more there from a separate cause.

Fix

  • markdown-gates.sh: Git for Windows prints --git-common-dir as C:/.... The drive-letter branch matched only C:\..., so the marker was named in mixed form. It now matches either separator and converts through cygpath -u.
  • The marker tests compare against the repository's physical path (pwd -P), since Git Bash resolves /tmp to the user temp directory (/c/Users/.../Temp).
  • markdown-check.test.sh builds its no-markdownlint PATH from exec wrapper scripts, the way markdown-format.test.sh already does. Git Bash's ln -s copies the binary away from its DLLs, so bash exited 127 in all ten missing-tool cases.

Verification

Windows 11 Git Bash 5.3.15 (jq 1.8.2, node v24.21.0), on a fresh clone of main 1ee4a3dd9b:

Suite Before After
actionlint/hooks/actionlint-check.test.sh 7 passed, 0 failed (unchanged)
bash-format/hooks/bash-format.test.sh PASS=39 FAIL=0 (unchanged)
biome-format/hooks/biome-format.test.sh PASS=44 FAIL=0 (unchanged)
go-format/hooks/go-format.test.sh PASS=34 FAIL=0 (unchanged)
powershell-format/hooks/powershell-format.test.sh PASS=7 FAIL=0 (unchanged)
typos-format/hooks/typos-format.test.sh PASS=10 FAIL=0 (unchanged)
markdown-format/hooks/markdown-format.test.sh PASS=43 FAIL=1 PASS=44 FAIL=0
markdown-format/git-hooks/markdown-check.test.sh 58 passed, 12 failed 70 passed, 0 failed

The census cases skip on Git Bash: its Cygwin strace fails the working-strace probe. Linux (WSL), same eight suites at this head: all pass, with each census case running. scripts/check-affected.sh --tests on the committed head: 14 passed, 2 skipped.

Related

🤖 Generated with Claude Code

Git for Windows prints `--git-common-dir` as `C:/...`, which the
drive-letter branch in md_trust missed (it matched only `C:\...`), so the
pre-commit entry named the approval marker in mixed form. Normalize either
separator through cygpath.

The marker tests now compare against the repository's physical path, since
Git Bash resolves /tmp to the user temp directory. markdown-check.test.sh
builds its no-markdownlint PATH from exec wrappers instead of symlinks:
Git Bash's ln -s copies the binary away from its DLLs and every case
exited 127.

Refs: #9889

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T16:04:15.743760Z ac103d9 PR opened
ℹ️ 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

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ac103d97e9831dc6715c969f913ba98d7826301e: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #12414, no security issues found

critical-findings: 0

I read all four changed files in full in the diff: the changeset note, markdown-gates.sh, markdown-check.test.sh and markdown-format.test.sh. None of them matches a trusted-path glob, and none is a plugin manifest.

plugins/markdown-format/git-hooks/markdown-gates.sh L289. This is the only runtime change. It sits in md_trust, which decides where the markdownlint code-config approval marker lives. I read the whole function (L261-317):

  • Where the marker lives: the store is still under the git common directory (git rev-parse --path-format=absolute --git-common-dir). The glob now also matches a drive-letter path that uses a forward slash (C:/...), so Git for Windows output is converted to POSIX form through cygpath -u.
  • What gets approved: the signature behind the marker is unchanged. It still hashes the repository root, the config files and the resolved modules.
  • Failure handling: if cygpath fails, base is cleared and the result is MD_TRUST=nostore, so it still fails closed.
  • Linux and macOS: --path-format=absolute always returns a path starting with /, so the new branch never runs there.

The change only rewrites the spelling of the same directory. It widens nothing: it adds no new way to reach the approved state, and no attacker-controlled input reaches cygpath. The only input is git's own path for the repository the hook already runs in.

Test files. Two marker checks now compare against pwd -P, and the no-markdownlint PATH is now built from exec wrapper scripts instead of symlinks. This is test-only code that runs locally or in CI on the author's own tree. It touches no credentials and no trust boundary.

The diff deletes or softens no instruction, changes no trust control or merge hold, and adds no spend.

Embedded text: the PR context contains no directive aimed at this lane.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed ac103d97e9831dc6715c969f913ba98d7826301e: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all four changed files and found nothing to block.

plugins/markdown-format/git-hooks/markdown-gates.sh

  • Pattern: the new pattern [A-Za-z]:[\\/]* now matches both C:\... and C:/..., so the C:/... form that Git for Windows prints for --git-common-dir gets converted by cygpath -u. Before this, the marker was named in mixed form.
  • Existing approvals: the old name and the new name point at the same folder on disk, so markers approved before this change still work.
  • Linux and macOS: nothing changes there. A POSIX --git-common-dir path never matches the drive-letter pattern.
  • Other copies: this is the only copy of markdown-gates.sh in the repo. The pattern now matches the existing drive-letter checks in lib/git-hooks/check-lib.sh:87 and hooks/hook-utils.sh:3486.

Tests

  • Marker checks: the three marker assertions now compare against $(cd "$REPO" && pwd -P). The gate builds root with cd -P ... && pwd -P (markdown-gates.sh:278), so the tests and the gate now compute the path the same way. This is also correct on Linux when the temp directory is a symlink.
  • No-markdownlint PATH: markdown-check.test.sh now uses exec wrapper scripts instead of symlinks. That is the same approach hooks/markdown-format.test.sh:323-327 already uses. Each shebang is an absolute /bin/sh, so the restricted PATH still runs them.

Changelog fragment: bump: patch fits a bug fix with no change to the interface. No plugin manifest changed, so the manifest checks don't apply.

Closing issue #9889: acceptance criteria

  • "The markdown-format approval-marker failure is either fixed or filed separately": met. The PR fixes it. The marker cases in hooks/markdown-format.test.sh and git-hooks/markdown-check.test.sh would fail on Git Bash if the fix broke. On Linux CI they don't run that branch, because the drive-letter check never matches and cygpath isn't present there.
  • "Each listed suite passes, or skips its census case, on Windows Git Bash, with output posted from a run over /fleet:reach": the PR's results table (Windows 11, Git Bash 5.3.15) is author-claimed and not verified. I can't run Git Bash in this environment, and I ran no tests myself. A person or a host-run check has to confirm this before the criterion counts as met.

Embedded text: none in the PR context that tries to steer this review.

Paved paths / path-scoped rules: I didn't look for the repo's standards index or for .claude/rules/ files, so neither was checked.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 49e5a03 Nov 2, 2026
41 checks passed
@kyle-sexton
kyle-sexton deleted the host-run/9889-gitbash-suites branch November 2, 2026 16:24
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.

test: six formatter suites fail on Windows Git Bash from the same jq-CRLF and strace-gate causes as #6531

1 participant