fix(salvage): apoptosis transaction + decompile listener-before-reset + audit regression test#7
fix(salvage): apoptosis transaction + decompile listener-before-reset + audit regression test#7JosephOIbrahim wants to merge 1 commit into
Conversation
PR #4 was closed because master diverged on the banner ('ab57275 lock HARLO banner to ansi_shadow') and tool names ('490e3e0 drop twin_ prefix') in ways that invalidated its docs commits. Three pieces of code in PR #4 were independent of those decisions and remain valuable on master; they're re-applied here on a clean branch. * crates/hippocampus/src/store.rs — wrap chunked apoptosis DELETEs in a single rusqlite::Transaction. A mid-loop failure cannot leave traces deleted but their graph_edges still pointing at orphan ids. VACUUM runs after commit (it cannot execute inside an open transaction). Uses unchecked_transaction() because microglia_apoptosis takes &Connection (no enclosing tx possible). * python/harlo/motor/motor_cerebellum.py — reorder _decompile so on_decompile fires BEFORE the success_count=0 reset. The listener payload now observes the pre-reset count (the Rule 32 audit trail contract), while external readers still see 0 (Rule 32 literal). Replace bare `except: pass` with logger.exception() so listener errors are diagnosable; fire-and-forget control flow preserved. * tests/test_motor/test_motor.py — new test_decompile_listener_sees_prior_success_count locks in the ordering: listener captures success_count=42; post-call read sees 0. Verified: 42 cargo tests pass (apoptosis chunk-boundary + transaction behavior preserved); 15 motor tests pass (10 baseline + 5 new from review-driven enhancements, all green). Constitutional greps still zero. https://claude.ai/code/session_017arHKzx5mTUFiry7JhhRPs
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces two independent improvements: batching SQL deletions in a single transaction within the storage layer, and refactoring decompile listener notification to fire before success_count reset with proper exception logging. ChangesStorage Transaction Batching
Decompile Listener Ordering and Error Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Three correctness fixes salvaged from the now-closed PR #4. PR #4 was closed because master diverged on the banner (
ab57275) and tool names (490e3e0) in ways that invalidated its docs commits — but these three code changes are independent of those decisions and remain valuable on master.crates/hippocampus/src/store.rsrusqlite::Transactionmakes per-chunk DELETEs atomic; commit before VACUUM (which can't run inside an open tx).on_decompilelistener fires beforesuccess_countresetpython/harlo/motor/motor_cerebellum.pysuccess_count == 0(post-reset) — the audit trail loses the prior count. Reordering so the listener fires BEFORE the Rule 32 reset means observers capture the pre-reset value while external readers still see 0. Bareexcept: passreplaced withlogger.exception()so listener errors are diagnosable; fire-and-forget control flow preserved.tests/test_motor/test_motor.pytest_decompile_listener_sees_prior_success_countregisters a listener that capturespattern.success_countat notification time, sets up a pattern withsuccess_count=42, callsrecord_failure, and asserts (a) the listener saw 42 (audit) and (b) post-call read sees 0 (Rule 32 literal).What's intentionally NOT here
ab57275locked the banner to ansi_shadow and490e3e0dropped thetwin_prefix; the cosmic banner andtwin_*tool names in PR style(branding): Pentagram-aesthetic refresh — banner3 figlet + two-tone-orange README + v6.0-MOTOR docs #4's docs would conflict._engine_locktimeout, HotStore commit). Those are tracked separately in fix(constitutional): S7 formula + Checkpoint TOCTOU + engine-lock timeout + HotStore commit handling #6.Test plan
cargo test -p hippocampus— 42 passed, 0 failed (apoptosis chunk-boundary + transaction behavior preserved)pytest tests/test_motor/— 15 passed, 0 failed (10 baseline + 5 review-driven, including the new prior-count regression)sleep(,while True,DELETE.*audit,float32,cosine,reasoning_traceinelenchus/verifier.py) — all zerohttps://claude.ai/code/session_017arHKzx5mTUFiry7JhhRPs
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Chores