Back: do not lose a history entry on a kill or failed write (#69) #120
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
schaefera/utStudyBIble!120
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/back-one-transaction"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #69
What
Back no longer loses a history entry on a kill or failed write.
Session::backreads the newest entry withpeek_historyand deletes it withdrop_historyonly once it is placed. An entry this Bible can't place is never deleted, andpop_historyis removed.Blast radius
Tier: trunk
Trunk paths touched:
core/src/db/history.rs,core/src/worker.rs,core/src/worker/session/jump.rsTesting tier: standard
Gate / rollback: revert this merge. There is no schema, migration or QML change. Memory and start-up are unaffected.
Proof
back_keeps_an_entry_this_bible_cannot_place_when_writes_failinjects a failing insert with a SQLite trigger. On base it fails (history_len0, expected 1, and the log shows "can't keep the history entry: injected"). It passes now.peek_leaves_the_entry_and_drop_removes_exactly_that_one.cargo makepasses locally (249 core tests), and CI is green on head89a9113.fix/back-one-transaction@89a911375, checked with ute2e and the journal:Review
Reviewer: a fresh-context review on
89a9113(review 322) found nothing.Review-Confidence: 100/100. The trunk diff was fully reviewed at the head commit and CI is green. The reviewer's report did not state its effort level, so the auditor could not check the "below high" row and applied no deduction for it.
Confidence by part
db/history.rspeek and drop: high, covered by unit tests.jump.rsBack flow: high, covered by the failing-insert test. Ifdrop_historyfails after the entry is placed, Back still moves and only logs the error, so the entry stays and a later Back offers it again. That needs a database write failure.🤖 Generated with Claude Code
Fresh-context review (claude-review)
Level: high (blast radius: trunk)
Reviewed commit:
89a9113754Range: origin/main...HEAD
Files reviewed: core/src/db/history.rs, core/src/worker.rs, core/src/worker/session/jump.rs (plus callers/callees: Session::jump, Session::load, history_event, save_now; docs/04-features.md Back section)
Findings: none (no high, medium or low defects with a concrete failure scenario).
Notes from reading the hunks in context:
pop_historyremain in code (only historical plan/spec docs mention it).drop_historyis a single DELETE statement, so it is atomic, and deleting an already-gone seq is a no-op (covered by the new db test). The worker runs single-threaded, so peek and drop cannot interleave with another push.Db::pophelper keeps the existing ordering/cap tests meaningful.save_nowleaves the entry removed with the old saved position, as it did with the old pop.On the phone: build
fix/back-one-transaction@89a911375is on Plinius and stays installed. It started cleanly: the window loaded after 321 ms and restored BSB Matt 23:3.I checked it myself with ute2e and the journal:
jump from BSB 27182).back to BSB 27182).back to BSB 24916). The entry from before the kill was kept.Nothing visible changed, so there is nothing for you to look at.
🤖 Generated with Claude Code
Gate approval on head
89a9113. The one review round (at this head) has no findings. No commits come after it. CI is green on head (changes, rust, audit, app, e2e, click). The audit gives Review-Confidence 100 with all three trunk files reviewed. Proof has a fails-without-change test and no unrun elevated, maximum or AI-behavior gate. The phone try is done. Not merging; the API reports mergeable=false, so check for a conflict with main before merging.WIP: Back: do not lose a history entry on a kill or failed write (#69)to Back: do not lose a history entry on a kill or failed write (#69)