Files
to-do/rollover/review.sh
T
Connor JohnstoneandClaude Opus 5 caa367feb2 Fix review.sh inventing 12 removals that the prune never makes
It round-tripped the pruned text through a shell variable, and command
substitution strips every trailing newline while printf added exactly one
back, so any file whose pruned output ended in more than one blank line
diffed against a reshaped copy of itself. Comparing files directly instead
brings review.sh to 270 removals across 118 files, matching validate.py,
which derives the same number from the drop set rather than from a diff.

The counting was wrong too: a removed `- [x] foo` is `-- [x] foo` in a
unified diff, so the `^-[^-]` pattern skipped every checkbox it was meant
to be counting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PU5ZFfQFtDTFqqhvMTWdGH
2026-09-09 18:35:25 -04:00

28 lines
866 B
Bash
Executable File

#!/bin/sh
# Regenerate the whole-corpus prune diff. The plan gates the timer on reviewing
# this, and the same gate should be re-runnable after any change to the rule.
set -eu
NOTES="${1:-$HOME/docs/notes/todo}"
HERE=$(cd "$(dirname "$0")" && pwd)
OUT="${OUT:-$HOME/todo-prune-review.diff}"
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
: > "$OUT"
files=0
for f in "$NOTES"/*.md; do
# Compare files rather than shell strings: command substitution eats
# trailing newlines and would invent differences that are not there.
python3 "$HERE/prune.py" "$f" > "$tmp"
if ! cmp -s "$f" "$tmp"; then
diff -u --label "$f (now)" --label "$f (pruned)" "$f" "$tmp" >> "$OUT" || true
files=$((files + 1))
fi
done
all=$(grep -c '^-' "$OUT" || true)
hdr=$(grep -c '^--- ' "$OUT" || true)
echo "$OUT: $((all - hdr)) lines removed across $files files"