From 37755c3c109c8e8fe8a4d8b87629e1148f5e71ff Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 15 Jul 2026 12:37:49 -0700 Subject: [PATCH] Fix staged amendment checks for large specs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read binding types directly from the index so an early grep match cannot turn a valid large corpus amendment into a pipefail rejection. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code --- tools/design_amendment_gate.sh | 2 +- tools/test_design_amendment_gate.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/design_amendment_gate.sh b/tools/design_amendment_gate.sh index 82d844ca..de1cfd20 100755 --- a/tools/design_amendment_gate.sh +++ b/tools/design_amendment_gate.sh @@ -33,7 +33,7 @@ is_binding_page() { if [ "$mode" = index ]; then git cat-file -e ":$path" 2>/dev/null || return 1 - git show ":$path" | grep -qE '^Type: (law|spec)$' + git grep --cached -qE '^Type: (law|spec)$' -- "$path" else [ -f "$path" ] && grep -qE '^Type: (law|spec)$' "$path" fi diff --git a/tools/test_design_amendment_gate.sh b/tools/test_design_amendment_gate.sh index 1161bc8b..b5cf2707 100755 --- a/tools/test_design_amendment_gate.sh +++ b/tools/test_design_amendment_gate.sh @@ -57,6 +57,18 @@ Type: knowledge EOF expect_pass "index reads staged binding type" $'crates/game/lib.rs\nwiki/process/law.md' --index +# A large binding page with its Type header near the top must not fail under +# `set -o pipefail` when the matcher exits before a staged blob finishes +# streaming. This reproduces the old `git show | grep -q` SIGPIPE boundary. +{ + printf '# Large spec\nType: spec\n' + for ((i = 0; i < 20000; i++)); do + printf 'binding detail %05d\n' "$i" + done +} > "$tmp/wiki/process/large.md" +git -C "$tmp" add wiki/process/large.md +expect_pass "large staged binding page" $'crates/game/lib.rs\nwiki/process/large.md' --index + # Conversely, a staged deletion is not an amendment merely because an # unstaged file with the same path exists in the worktree. git -C "$tmp" rm --cached -fq wiki/process/law.md -- 2.51.2