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:
2026-10-26 16:26:15 -04:00
co-authored by Claude Opus 5.5
parent db2427a3dc
commit 83cb6420e2
4 changed files with 54 additions and 11 deletions
+17
View File
@@ -90,6 +90,23 @@ def test_after_write_names_what_bash_just_wrote_then_stays_quiet_until_the_next_
assert seen[0]["exclude_derive"] == ["dup:483a"]
assert set(seen[0]["shapes"][0].split(",")) == {"css:log-empty", "css:other"}
def test_after_write_records_every_definition_for_the_turn_but_queries_only_the_first_four_files(tmp_path):
"""The end-of-turn ledger hears every file and every definition a Bash call
wrote; the prior-art arms stay bounded to four files and twelve names."""
with http_sink(SINK_REPLY) as (port, seen):
env = _env(tmp_path, url=f"http://127.0.0.1:{port}")
repo = _repo(tmp_path, env)
for n in range(6):
body = "".join(f"def f{n}_{i:02d}():\n return {i}\n\n" for i in range(15))
(repo / f"gen{n}.py").write_text(body)
_run(repo, env, session="s-many")
ledger = (tmp_path / "grimoire-priorart" / "s-many.written.ids").read_text().splitlines()
assert len(ledger) == 6 * 15
assert "gen5.py\tsym\tf5_14" in ledger
assert len(seen) == 4
assert all(len(q["shapes"][0].split(",")) == 12 for q in seen)
def test_after_write_is_silent_where_it_has_nothing_to_say(tmp_path):
env = _env(tmp_path)
repo = _repo(tmp_path, env)