From f23c2c42ce85619f289f19ed740822363ed1f515 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 31 Oct 2026 20:56:47 +0100 Subject: [PATCH] self-session-live: tests start from an echoed start message; the public surface drops inbox::close Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/self_run.rs | 4 ++-- crates/mind-body/src/self_run/decide/tests.rs | 4 ++-- crates/mind-body/src/self_run/tests.rs | 6 +++--- crates/mind-body/tests/public_surface.txt | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/mind-body/src/self_run.rs b/crates/mind-body/src/self_run.rs index 5ceb5dc..fa6f038 100644 --- a/crates/mind-body/src/self_run.rs +++ b/crates/mind-body/src/self_run.rs @@ -85,9 +85,9 @@ pub const CEILING_TOKENS: u64 = 300_000; /// The context window the CLI reports for the model a Self runs (`modelUsage.contextWindow` in every result of the /// `claude-2.1.312-live-session-*` fixtures: the default model, `claude-opus-5-5`, 1M). The seed sets no model, so the CLI's default is the model. /// The window under the real subscription is read from a result's `contextWindow` and not otherwise observed here. -pub const SELF_CONTEXT_WINDOW_TOKENS: u64 = 1_000_000; +const SELF_CONTEXT_WINDOW_TOKENS: u64 = 1_000_000; /// What the CLI keeps free below its window before it refuses a prompt (`blocking_limit`): the blocking-limit fixture sends a 990k request and refuses the next. -pub const CLI_BLOCKING_BUFFER_TOKENS: u64 = 10_000; +const CLI_BLOCKING_BUFFER_TOKENS: u64 = 10_000; /// What the prefix may grow by beyond the prefix the flush was asked at before /// the actuator interrupts. Relative to the flush, never an absolute limit. pub const FLUSH_HEADROOM_TOKENS: u64 = 60_000; diff --git a/crates/mind-body/src/self_run/decide/tests.rs b/crates/mind-body/src/self_run/decide/tests.rs index 8da3a5b..67186f0 100644 --- a/crates/mind-body/src/self_run/decide/tests.rs +++ b/crates/mind-body/src/self_run/decide/tests.rs @@ -376,7 +376,7 @@ fn a_child_that_has_exited_is_never_signalled_and_the_run_ends_with_its_stream_o #[test] fn without_a_flush_nothing_is_ever_signalled_and_a_finished_run_decides_nothing_more() { - let quiet = vec![(req("a", 10), 0), (OK, 1), (Event::Tick, 100_000)]; + let quiet = vec![(Event::Echo, 0), (req("a", 10), 0), (OK, 1), (Event::Tick, 100_000)]; assert!(run(quiet).1.iter().all(|action| !matches!(action, Action::Signal(_)))); let (state, actions) = run(vec![(Event::ChildExited(Some(3)), 0), (Event::StdoutEof, 0)]); assert_eq!(actions[1], ended(Cause::Own, Some(3), 0, 0)); @@ -446,7 +446,7 @@ fn play(symbols: &[Sym]) { closed = true; closes += 1; } - Action::Signal(_) => assert!(flushed, "a signal with no flush: {symbols:?}"), + Action::Signal(_) => assert!(state.flush.is_some(), "a signal with no flush asked: {symbols:?}"), Action::None | Action::Finish(_) => {} } assert_eq!(state.written, 1 + writes, "every write is counted once: {symbols:?}"); diff --git a/crates/mind-body/src/self_run/tests.rs b/crates/mind-body/src/self_run/tests.rs index e878fb8..5bc93c1 100644 --- a/crates/mind-body/src/self_run/tests.rs +++ b/crates/mind-body/src/self_run/tests.rs @@ -772,7 +772,7 @@ fn below_the_ceiling_no_flush_is_written_and_at_it_exactly_one() { assert_eq!(flushes(&below), 0); assert_eq!(below.ended().0, Cause::Own); - let at_it = go(vec![Out(at("m1", CEILING_TOKENS - 1)), Out(at("m2", CEILING_TOKENS)), Out(at("m3", CEILING_TOKENS + 10_000))]); + let at_it = go(vec![Out(echo()), Out(at("m1", CEILING_TOKENS - 1)), Out(at("m2", CEILING_TOKENS)), Out(at("m3", CEILING_TOKENS + 10_000))]); assert_eq!(flushes(&at_it), 1, "{:?}", at_it.written()); assert_eq!(at_it.written().len(), 2, "the start and the flush"); assert_eq!(at_it.ended().0, Cause::FlushRequested); @@ -906,7 +906,7 @@ fn a_child_that_ends_before_the_grace_is_never_interrupted() { fn the_grace_is_the_full_grace_from_the_moment_the_flush_was_asked_whichever_request_that_was() { let grace = FLUSH_GRACE_S; // Five requests, time passing before the ceiling, then the flush on the sixth. - let before: Vec = vec![Out(at("m1", 10)), Idle(500), Out(at("m2", 20)), Out(at("m3", 30)), Out(at("m4", 40)), Out(at("m5", 50)), Out(at("m6", CEILING_TOKENS))]; + let before: Vec = vec![Out(echo()), Out(at("m1", 10)), Idle(500), Out(at("m2", 20)), Out(at("m3", 30)), Out(at("m4", 40)), Out(at("m5", 50)), Out(at("m6", CEILING_TOKENS))]; let early = carry_with(&Seen::of(&with_run()), [before.clone(), vec![Idle(grace - 1)]].concat(), Some(0), true); assert_eq!((flushes(&early), early.count(&Event::Stopped(Stop::Interrupt))), (1, 0), "one second short of the grace, flush on request 6"); let on_time = carry_with(&Seen::of(&with_run()), [before, vec![Idle(grace - 1), Idle(1)]].concat(), Some(0), true); @@ -933,7 +933,7 @@ fn a_usage_sum_that_overflows_is_at_or_over_the_ceiling_not_a_panic_or_a_wrap() assert_eq!(read_usage(&request("m", 1, u64::MAX, 1)), Usage::Request { id: "m".into(), prefix: u64::MAX }); // Through the actuator: the flush is asked for, and the headroom beyond a saturated prefix does not overflow // either, and the pass that wrote the flush does not interrupt. - let ran = go(vec![Out(request("m1", u64::MAX, 7, 0)), Out(request("m2", 0, 0, 0))]); + let ran = go(vec![Out(echo()), Out(request("m1", u64::MAX, 7, 0)), Out(request("m2", 0, 0, 0))]); assert_eq!(flushes(&ran), 1); assert_eq!(ran.count(&Event::Stopped(Stop::Interrupt)), 0); } diff --git a/crates/mind-body/tests/public_surface.txt b/crates/mind-body/tests/public_surface.txt index 8424598..9f59920 100644 --- a/crates/mind-body/tests/public_surface.txt +++ b/crates/mind-body/tests/public_surface.txt @@ -258,7 +258,6 @@ mind_body::self_run: struct ClaudeSpawner pub-fields[] mind_body::self_run::decide: impl State mind_body::self_run::inbox: const OWNER : & str mind_body::self_run::inbox: fn backlog (mind : & dyn MindPort) -> Result < Vec < (Brief , String) > > -mind_body::self_run::inbox: fn close (mind : & dyn MindPort , now : DateTime < Utc > , session : & str , briefs : & [(Brief , String)] , reason : & str) -> Result < usize > mind_body::self_run::inbox: fn derive (mind : & dyn MindPort , told : & HashSet < String >) -> Result < Vec < Brief > > mind_body::self_run::inbox: fn render (briefs : & [Brief] , plan : & str) -> String mind_body::self_run::inbox: fn resolving_sentence (id : & str) -> String