Repository navigation
fix(journal): preserve original rows in sealed repair generations (STA-6925) - #19399
brennanb2025 wants to merge 4 commits into
Conversation
|
Validation status for
Not exercised: Linux, Windows, WSL, rendered Electron, real paired SSH, actual folder/worktree UI flows, released client/host version pairings, physical disk exhaustion, or hardware power loss. Existing reset behavior is unit-tested; no wire fields/opcodes changed. Payload clipping, retention, physical capacity policy, and a recovery UI remain outside this slice. No real provider/session/config data was accessed. |
|
Independent review at 903c5f6: changes requested; not CLEAN/READY. P2 — future-version JSON BLOB bypasses read-only admission ( The sealing architecture otherwise removes destructive suffix repair and protects later rollover/replacement. Concrete reuse matches the existing row/session transaction and epoch reset; sealed-history ownership is new. Capacity accounting and reclamation remain separate work. Independently observed: 19 files / 206 tests passed; four disposable manual scenarios at anchor and before/at/after receipt preserved binary bytes, SQLite types and hashes across two repairs, smaller replacement, rollover and reopen; deliberate preservation ablation caused 2 expected failures, exact cp/cmp restoration followed by 15 passing repair/crash tests. Baseline v2 opener module against v3 was read-only and byte-identical. One additional version probe remains failing as above. No rendered Electron UI, actual released client/host pairing, live SSH, Linux/Windows/WSL, real provider profile, hardware power loss or full physical disk was exercised. SQLite page-limit and abrupt process-exit tests do not establish those guarantees. Typechecks were not repeated independently. Reviewed base was 9f04403; remote main subsequently advanced, so integration with newer main is unreviewed. |
|
F1 fix pushed at The shared parser now receives raw SQLite values, decodes valid UTF-8 BLOBs for both admission and replay, and refuses writes for unsupported encodings/types. It never rewrites source bytes or storage types. Future BLOBs at the anchor and behind corruption remain read-only with whole-file identity, including before actual v2 migration. Invalid UTF-8 is deliberately read-only; supported malformed JSON still uses sealed-generation repair. Final validation: 19 files / 216 tests passed; original version probe now passes read-only and whole-file identity; four manual BLOB preservation cases passed through two repairs, replacement, rollover and reopen. Final-head ablation restored the bad raw type assertion and caused both targeted shipping tests to fail (2 failed / 12 skipped); cp restoration, cmp, nonzero decoder grep and the restored full suite passed. Node, web and CLI typechecks passed sequentially on the final head. Initial node errors in recovery-test assertions were fixed; no final diagnostics remain. The standalone body and recovery documentation now describe the representation boundary. No Electron UI/platform/SSH/packaged-version coverage is claimed. Main is |
|
Fresh independent re-review: CLEAN for
Local HEAD, remote PR ref and API agree on the reviewed SHA. Main advanced to |
|
Closing as superseded: a merged PR already covers this change. #24576 (98171a8, Brennan's own) changed open-on-damage: the open now fails through one refusal, every row stays, and a damaged file is kept whole. Repair deletion and the repair marker are gone (deleted the file this draft edits). This draft's goal was to preserve the original (Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.) |
1 similar comment
|
Closing as superseded: a merged PR already covers this change. #24576 (98171a8, Brennan's own) changed open-on-damage: the open now fails through one refusal, every row stays, and a damaged file is kept whole. Repair deletion and the repair marker are gone (deleted the file this draft edits). This draft's goal was to preserve the original (Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.) |
ELI5
Opening a damaged chat journal no longer deletes the unreadable row and everything after it. Orca keeps the original bytes and opens the readable prefix in a new generation, so Orca-only receipts remain available as recovery evidence.
What Changed
Why
The former suffix deletion was irreversible, and provider transcripts cannot reconstruct Orca-only receipts. Sealing removes that destructive repair path while reusing the journal's atomic row/session transaction and FULL-sync durability. Failed admission refuses writable open and preserves the original rows.
Linked Issue
STA-6925
This is the bounded recovery foundation only. Payload clipping (STA-6924), retention and physical capacity budgeting (STA-6837), and a recovery UI remain separate work. Recovery metadata includes logical row counts/bytes; it does not claim a physical quota or reclaim sealed epochs.
Visual Proof
N/A — SQLite storage and recovery changes; no layout or interaction surface changed. Validation used disposable journals without real provider sessions or configuration.
Testing
Validation of the F1 fix at
885bdbb85617ba248c720073678d34e1e14b62b4:pnpm exec vitest run --config config/vitest.config.ts src/main/native-chat/agent-session-journal src/main/native-chat/agent-session-wire/agent-session-journal-recovery.test.ts --maxWorkers=2— 19 files / 216 tests passed after exact ablation restoration.cp;cmp, nonzero decoding-code match and empty source diff confirmed exact restoration.npx tsc --noEmit -p config/tsconfig.node.json, thenconfig/tsconfig.tc.web.json, thenconfig/tsconfig.tc.cli.json. Initial node failures in three recovery-test assertions were fixed by handling raw values; final checks have no diagnostics. Commit lint/format hooks passed.max_page_countexhaustion, migration, repair markers and immutable evidence. Process exits are not hardware power loss; page limits are not host-volume exhaustion.No Electron rendering/build, real provider sessions/profiles, Linux, Windows, WSL, live SSH, folder/worktree UI journey, mobile or packaged client/host version pairings were exercised. No transport behavior changed. Main advanced to
588240043e84b1f8e58013298e692e7a57ba8ad5; merging was prohibited, so integration with that main is unvalidated.Review
Draft for a fresh independent architectural and implementation review; no readiness claim. Please challenge whether sealing plus prefix publication removes the data-loss mechanism and whether preservation survives every later epoch replacement.
Agent skill upstream boundary