fix(#322): the third reader of the same marker, and a freeze guard that outlived its claim - #329
Conversation
…at outlived its claim Co-Authored-By: Max <noreply>
Code reviewNo blocking issues. One non-blocking finding, filed as #330 rather than held against this PR. The byte-identity pin on the per-tool-call path is gone, and the three substring checks that replace it can be walked around — Checked and clean: the two Adjacent, already open: #326 names 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…he hook reads (#331) #327 asked for one 10# in 50-git-backup.sh. The sweep found six sinks across the two git hooks: the backup cooldown marker, the restore hook's two fetch-state reads, and all four consecutive-failure counters, whose failing increment abandons the branch holding the ERROR log. #327's severity claim does not hold: measured on bash 3.2.57 in the shape the hook has, the failing arithmetic abandons the if body and the hook exits 0, commits, and re-stamps -- misreports, not fails-to-preserve. Its docstring half was already fixed by #329; that note is updated instead. #324's premise that the test asserts nothing is also wrong -- the #261 legacy carry-forward transports the dotted marker into the state dir before the cooldown block. The test now writes through hook_state anyway, because the shim is not the feature. What was genuinely missing is 08/09 and an assertion on stderr.
Bumps .claude-plugin/plugin.json to 0.18.0 and closes the Unreleased section. Also gives #329 its own entry. Its prose had been appended to #322's bullet inside the already-released 0.17.0 section, so the file claimed work that shipped after the 0.17.0 tag; those two paragraphs are moved out and rewritten as a 0.18.0 entry, with the freeze-guard half of #329 documented for the first time.
Builds on @jmossie82's #325 (merged). Their patch is unchanged — this is the sweep it opened up.
Part of #322
The third and fourth sites
10#landed insave-session.sh.scripts/post-tool-hook.shreads the sametmp/last-save-tsat:335andtmp/no-transcript-noticeat:192, bothcase-guarded since #230, neither carrying10#. So08/09clear the guard and are read as octal, the body is abandoned, and::335—IN_COOLDOWNstays false, the hook forks a save inside the window:192— worse: the abandoned body swallows its ownexit 0, so the line below thefideletes the notice marker on the assumption a transcript was foundBoth tests assert behaviour (
save-session.pidabsent / the notice marker surviving), not just the diagnostic. That mattered: the first draft assertedproc.stderralone and passed against the broken code, because bash's line goes tohook-errors.lograther than stderr on this path.SAVE_COOLDOWNwas left alone, deliberatelyI briefed this as having the same gap. It does not.
LAST_TSis inside$(( ));SAVE_COOLDOWNis the right-hand operand of[ … -lt … ], thetestbuiltin, which parses base 10 and does not evaluate:10#there would be inert and worse than inert — it would advertise a hazard at a site that has none, and its absence elsewhere would then read as a finding. The measurement is in the code comment so it does not get "fixed" later.The judgment call that needs a second opinion
test_the_per_tool_call_path_is_not_touched(#298/#299) assertedpost-tool-hook.shis byte-identical to origin/main. That blocked a correct one-token fix and would block every future edit to the file. It is also self-cancelling: once the edit it objects to lands on main, it compares against the new main and passes. So what it actually asserts is "nobody has touched this file since main" — a different claim from the one its name makes, "the per-tool-call path is still cheap". A check that reads as evidence about the world when it is evidence about the diff.Replaced the
post-tool-hook.sharm with the three properties #298/#299 care about — the divergence library is not sourced,case_divergenceis not called, nogitis spawned — each with its own message. Stronger than byte-equality after this merges, and cannot go vacuous. Thelib-slug.sh/lib-memory-dir.sharms keep their byte compare untouched.If you would rather that were its own PR against #298, say so — but then the third site cannot land at all, because the guard forbids it.
Verification
Their tests against main's
save-session.sh:9 failed, 3 passed(the 3 are the two whitespace controls and the valid-marker case, by design). Their tests with their patch:12 passed. My two, before my10#: red withvalue too great for baseat:325and:186. Full suite1519 passed, 43 skipped.macOS + bash 3.2.57 only. bash 5 unverified — no bash 5 on this machine. CI is the authority.