self-session-live tests: a stale spool is wiped at start; the pre-compact block says why

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-31 16:18:46 +01:00
commit 4decf9e79c
2 changed files with 12 additions and 0 deletions

View file

@ -1633,6 +1633,16 @@ fn near_the_cap_an_idle_session_closes_for_rotation_and_a_working_one_is_asked_f
assert_eq!(flushes(&before), 0);
}
#[test]
fn a_session_starts_with_an_empty_spool_whatever_an_earlier_one_left() {
let hooks = test_hooks();
inbox::spool(&hooks.spool, &[Brief { id: "eureka-body:follow_up:stale".into(), campaign: "eureka-body".into(), repo: "GameCult/Huginn".into(), item: "Stale.".into(), ordinal: 1 }]).unwrap();
let mind = with_run();
let ran = carry_hooked(&Seen::of(&mind), vec![Out(result_line())], (Some(0), None, NO_SIGNALS, false), hooks);
assert!(!inbox::pending(&ran.hooks.spool).unwrap(), "the stale entry is gone");
assert_eq!(ran.written().len(), 1, "and was never told: {:?}", ran.written());
}
#[test]
fn a_pre_compact_block_leaves_a_marker_and_the_session_asks_for_the_flush_once() {
let hooks = test_hooks();

View file

@ -74,6 +74,8 @@ fn inject_prints_the_spooled_briefs_as_hook_context_and_blocks_a_compaction() {
};
let blocked = inject(&["--pre-compact"], "{}");
assert_eq!((blocked.status.code(), blocked.stdout.is_empty()), (Some(2), true));
assert!(String::from_utf8_lossy(&blocked.stderr).contains("compaction blocked"), "the block says why");
assert!(inject(&[], "{}").stderr.is_empty(), "a tell prints nothing on stderr");
let printed = inject(&[], r#"{"hook_event_name":"PostToolBatch"}"#);
assert_eq!(printed.status.code(), Some(0));
let text = String::from_utf8_lossy(&printed.stdout);