fix(6471): the end-of-turn shape check hears every definition a write made
The write hooks recorded at most 12 definitions per write (alphabetical, so test functions were the ones dropped) and the post-Bash hook stopped after 4 files, so the Stop hook never asked about the rest. The caps bound the prior-art query; the written ledger now gets the full list, up to 40 files per Bash call, while the query stays at 4 files x 12 names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,10 +79,16 @@ fi
|
||||
|
||||
# ARM 1 — BY NAME, LOCALLY: does a definition of this already exist
|
||||
# in the repo? (grimoire_local_dups in grimoire_defs.sh carries the why.)
|
||||
#
|
||||
# `all_names` is every definition the write carries; it feeds the end-of-turn
|
||||
# ledger, which must hear about all of them. `names` is the first twelve, and
|
||||
# bounds the queries below — a git grep and a URL per name.
|
||||
all_names=""
|
||||
names=""
|
||||
if [ -n "$code" ]; then
|
||||
all_names=$(printf '%s' "$code" | grimoire_defs | sort -u || true)
|
||||
# `|| true` inside: an early-exiting `head` must not void its own output.
|
||||
names=$(printf '%s' "$code" | grimoire_defs | sort -u | head -12 || true)
|
||||
names=$(printf '%s\n' "$all_names" | head -12 || true)
|
||||
fi
|
||||
|
||||
local_lines=""
|
||||
@@ -204,10 +210,11 @@ if [ -n "$session_id" ]; then
|
||||
# Write onto a path that does not exist yet creates a file, which may be a
|
||||
# unit in its own right (see grimoire_written_append). Written before any
|
||||
# server call: the ask at the end of the turn must not depend on this
|
||||
# write's hint having been answered.
|
||||
# write's hint having been answered. Every definition, not the capped list
|
||||
# the queries use; an Edit that names none records its enclosing one.
|
||||
fresh=""
|
||||
[ -e "$file_path" ] || fresh="new"
|
||||
printf '%s\n' "$shapes" | grimoire_written_append "$safe_sid" "$rel_path" "$fresh" "$code"
|
||||
printf '%s\n' "${all_names:-$shapes}" | grimoire_written_append "$safe_sid" "$rel_path" "$fresh" "$code"
|
||||
idfile="$state_dir/${safe_sid}.ids"
|
||||
syncfile="$state_dir/${safe_sid}.sync.ids"
|
||||
derivefile="$state_dir/${safe_sid}.derive.ids"
|
||||
|
||||
Reference in New Issue
Block a user