fix(hooks): atomic writes for prune/settings/githooks state; single-parse prune transcript (#191 #188)#212
Merged
Merged
Conversation
…arse prune transcript
reliability-008/009/010 route bare open('w') writers through _hooklib.write_text_atomic
(temp + os.replace); the SessionStart settings-heal now reloads-before-save with a
per-call temp so concurrent sessions can't clobber each other. #188: hook_run threads
its single transcript read+parse through run() instead of re-reading it.
reliability-016 (write_provenance) was already atomic since PR #197.
Claude-Session: https://claude.ai/code/session_01PVTCDji6bEuf9SifQ8tfsa
…parse) Version bump + README badge sync for the crash-atomic state writers (#191) and the single-parse prune-transcript fix (#188). Claude-Session: https://claude.ai/code/session_01PVTCDji6bEuf9SifQ8tfsa
write_in_place opens the transcript one extra time on POSIX (os.replace/verify), so the no-duplicate baseline is 5 on Windows / 6 on POSIX; the hardcoded <=5 red on ubuntu/macos CI. Bound raised to 6 — still catches the +2 duplicate-read regression on either platform. The platform-independent single-parse proof is the sibling load_lines-count-1 test. Claude-Session: https://claude.ai/code/session_01PVTCDji6bEuf9SifQ8tfsa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lane E2 — reliability + performance from the tribunal audit.
What
open('w')state writers through_hooklib.write_text_atomic(unique-per-call temp +os.replace) so a torn/interrupted write leaves the prior file intact:_prunelib.save_state(reliability-008),_githooks.install's shim (reliability-010 — a partial shim can no longer silently disable the [P1] Shell indirection bypasses pre-bash commit, push, staging, and security gates #161 git-enforce backstop), andwire-statusline.py'ssave_settings(reliability-009 — no more fixed-.tmpcollision between concurrent sessions).write_provenance) was already atomic since PR fix(plugins): tribunal quick-kills: atomic writes, typed spawn opts, fail-closed CI #197 — left untouched.hook_runnow threads its single read+parse throughrun(). Byte-identical pruning behavior (a consistency improvement — the settle check and prune now see the same snapshot).Verification
test_atomic_writes.py,test_prune_single_parse.py); TDD-verified red→green (reverting the impl corrupts state / double-parses);py_compileclean; LF._githooksshim atomicity (backstop preserved), the settings-heal concurrency correctness (no clobber, no wedge), single-parse parity, and thewire-statuslinesys.path insert resolving only its trusted hooks dir. 2 no-action LOWs (benign 0711 shim perms; inert mkstemp-leak-on-SIGKILL).Bumps ca 2.8.6 → 2.8.7.
Closes #191
Closes #188
https://claude.ai/code/session_01PVTCDji6bEuf9SifQ8tfsa