Fix sed entity decode order and grep portability across hooks #66
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom!66
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "65-hook-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes three issues found during QA of PR #64: sed
&decode ordering bug that could cause double-decoding, GNU-specific grep\|syntax that fails on non-GNU systems, and missing documentation for hardcoded fields in check-phase-template.sh.Changes
hooks/check-issue-template.sh— moved&decoding to last position in sed chainhooks/check-note-template.sh— moved&decoding to last position in both sed chainshooks/check-phase-template.sh— moved&decoding to last position, replacedgrep -qiwithgrep -Eqiand\|with|for POSIX portability, added comment explaining why field checks are hardcodedhooks/check-pr-template.sh— moved&decoding to last position in sed chainhooks/session-start-context.sh— moved&decoding to last position in both sed chains (was first, which was a real double-decode bug)Test Plan
bash -npasses on all modified hooks (done pre-commit)\|in grep patterns (scanned, none found)Review Checklist
&last to prevent double-decoding-Eflag with|instead of BRE\|bash -nsyntax check passes on all modified filesRelated
plan-2026-03-07-note-hierarchy-conventions, Phase 4-1PR #66 Review
BLOCKERS
None.
NITS
None.
Code Review
Fix 1: sed ampersand decode ordering -- Verified across all 5 files (7 sed chains total). Every chain now places
s/&/\&/gas the last substitution. This is correct: if&is decoded first, subsequent<-><replacements would turn any literal&lt;in the source into<then<, causing double-decoding. By decoding&last, the other entity names are consumed first and the ampersand substitution only touches true remaining&literals.Fix 2: grep -E portability -- All 4 grep alternation patterns in
check-phase-template.sh(lines 62-64, 79) now usegrep -Eqiwith|instead of BRE\|. Scanned the entire hooks directory -- no remaining instances of\|in grep patterns. Other hooks already used-Eor-qEconsistently.Fix 3: Hardcoded fields comment -- The 4-line comment at lines 45-49 of
check-phase-template.shexplains whyGoal:,Owner:,Repo:,Depends on:are hardcoded rather than dynamically extracted. The reasoning is sound: phase templates use<strong>tags, not markdown###headings, so the extraction approach used by check-issue-template.sh and check-note-template.sh does not apply.Scope check -- No unrelated changes. The diff is exactly 5 files, +16/-12 lines, all within the stated scope. No new functionality, no behavioral changes beyond the bug fixes.
No secrets -- No
.envfiles, credentials, or sensitive data in the diff.SOP COMPLIANCE
65-hook-hardeningreferences issue #65)plan-2026-03-07-note-hierarchy-conventions, Phase 4-1)VERDICT: APPROVED