feat: ADR-0034 — history journal records err + replay parses/filters the journal

Replay (§3): run_replay parses <ts>|<status>|<source> journal records — runs ok, skips non-ok — while still accepting bare .commands scripts (prefix-detected so a | inside a bare command isn't misread). Fixes replay history.log, which died on line 1.

Journal failures (§1/§2): failed commands are recorded err via a new Action::JournalFailure, emitted by the pure-sync App for both parse failures and worker-execution failures (runtime appends best-effort, never fatal). Hydration reads all records so typo'd/rejected commands are recallable across sessions.

Amendment 1 — replay filters app-lifecycle commands: a working replay history.log exposed that the journal also records save as/load/new/export/import/rebuild/mode (which would panic the worker dispatch or abort replay). Replay now re-applies only schema/data writes and skips every app-lifecycle command + nested replay, classified by entry word so modal/incomplete forms (save as, bare mode) and quit skip uniformly rather than aborting. All skips continue (reversing the nested-replay refusal); import and nested replay warn. replay.error_nested removed; replay.skipped_import/_replay added; ReplayCompleted carries warnings. requirements.md U3/U4 updated; app-command runtime-failure journalling tracked as a follow-up.

1659 passing / 0 failing / 0 skipped / 1 ignored. Clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-24 18:59:06 +00:00
parent 504c24c996
commit e4f2f5fa15
18 changed files with 730 additions and 76 deletions
+25
View File
@@ -155,6 +155,31 @@ fn read_recent_history_returns_appended_entries_in_order() {
);
}
#[test]
fn hydration_reads_both_ok_and_err_records() {
// ADR-0034 §1/§2: failed commands are journalled `err`, and
// input-history hydration reads ALL records (ok + err) so a
// typo'd / rejected command from a previous session is
// recallable after restart — matching the in-session ring's
// "record everything" behaviour.
let tmp = tempdir();
let project = Project::create_temp(tmp.path()).unwrap();
let p = Persistence::new(project.path().to_path_buf());
p.append_history("create table A with pk").unwrap();
p.append_history_failure("insert into A (1, 2, 3)").unwrap();
p.append_history("show data A").unwrap();
let entries = p.read_recent_history(10).unwrap();
assert_eq!(
entries,
vec![
"create table A with pk".to_string(),
"insert into A (1, 2, 3)".to_string(), // the err record is recalled
"show data A".to_string(),
],
"hydration includes the err record",
);
}
#[test]
fn seed_history_replaces_in_memory_history() {
let mut app = App::new();