Repository navigation
fix(#1064): preserve heredoc commit subjects in the pre-tool commit validator - #1088
Merged
admarble merged 1 commit intoSep 18, 2026
Conversation
7 tasks
admarble
deleted the
feature/1064-bug-hooks-commit-validator-strips-from-a-git-commi
branch
September 18, 2026 23:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1064. The commit-message validator in
pre-tool.shranstrip_commentsover the whole command before extracting a heredoc subject, so ingit commit -F - <<'EOF'everything from the#infix(#497): …onward was blanked as a "comment" and everytype(#N):subject sent via stdin was blocked (Got: fix().commit_message_fromnow keeps two views of the command: the comment-sanitizedsstill drives command recognition and the flag scan (so data can never match a flag), while the rawrawstring — same length, same offsets — is whatheredoc_first_linereads the subject from.message_atthreadsrawthrough all three call sites. Applied to all three mirrors; five new integration cases × three copies.The implementation commit (
819d30c0) was produced by the Codex driver during the #1060 gate run; its QA under Codex found AC-1…AC-5 met and no implementation defect, failing only on this PR's missing evidence. The evidence below was re-run independently.AC coverage
-t "1064"→Tests 15 passed | 336 skipped (351)-t "1064 blocks"→Tests 3 passed | 348 skipped (351)-t "1064 pins"→Tests 9 passed | 342 skipped (351)shasum … | sort -u | wc -l→1Tests 351 passed (351)Mutation verification
Mutation-verified: AC-1 — reverted
heredoc_first_line(raw, start)toheredoc_first_line(s, start)inhooks/pre-tool.sh;1064: allows a -F - heredoc subject containing #failed (1 failed, 14 passed — only the mutated copy); restored.Mutation-verified: AC-2 — removed the final
if (line != "") print lineinhooks/pre-tool.shso the validator prints nothing for-F -;1064 blocks a non-conventional -F - heredoc subjectfailed (1 failed, 14 passed); restored.Worktree clean after each restore;
-t "1064"back to 15/15.Hook precedence
Hook precedence: both copies run — Claude Code does not pick one. With the sequant plugin enabled (
"sequant@sequant": true), a session registers"$CLAUDE_PROJECT_DIR"/.claude/hooks/pre-tool.shfrom.claude/settings.jsonand"${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool.sh"(cache~/.claude/plugins/cache/sequant/sequant/2.15.1/) from the plugin'shooks.json, and executes both on every tool call. Either can block.Settled by the hook's own log routing — the plugin copy runs with
CLAUDE_PLUGIN_DATAset and logs to~/.claude/plugins/data/sequant-sequant/logs/, the repo copy without it and logs to~/.sequant/logs/. I noted bothclaude-timing.logline counts, made a singleReadtool call from a live Claude Code session in this repo, and diffed:One tool call, two hook executions 8 ms apart. Consequence for this fix — the form-A command from #1064 fed to each copy from a temp repo with a staged change:
So merging this unblocks form A only once the plugin cache also carries the fix: until
claude plugin update sequantpulls a version with it, the 2.15.1 plugin copy keeps exiting 2 and still blocks the commit even though the repo copy allows it.Test plan
npx vitest run __tests__/pre-tool-hook.integration.test.ts— 351/351-t "1064"/"1064 blocks"/"1064 pins"— 15 / 3 / 9🤖 Generated with Claude Code