From b1f0654f54c6b3ac81f81b414f1fffe088aa9800 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 1 Nov 2026 05:42:47 +0100 Subject: [PATCH] tests: blocked tells a second run's question from the first; a free brief writes no closing note Co-Authored-By: Claude Sonnet 5.5 --- crates/eureka-state/tests/cli.rs | 50 ++++++++++++++++--------- crates/mind-body/src/heartbeat/tests.rs | 2 +- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/crates/eureka-state/tests/cli.rs b/crates/eureka-state/tests/cli.rs index 3cfde97..eb973ed 100644 --- a/crates/eureka-state/tests/cli.rs +++ b/crates/eureka-state/tests/cli.rs @@ -856,27 +856,41 @@ fn blocked_names_the_questions_that_hold_a_spec_as_the_gate_reads_them() { held("A").out ); - let question = format!("{CAMPAIGN}:question:fork"); + // A second run claims B, and a second question is raised in it: it holds B and never A. + let other_claim = PipelineRef { kind: PipelineKind::CutSpec, id: Short(spec_id("B")) }; admit( - "question.json", - json!([value(PipelineDocument::Question(PipelineQuestion { - campaign: slug(CAMPAIGN), - label: "fork".into(), - title: "A fork".into(), - question: "Which?".into(), - options: ["reopen", "retire"] - .iter() - .map(|name| QuestionOption { - label: (*name).into(), - text: "an option".into() - }) - .collect(), - recommended: "reopen".into(), - depends: vec![], - raised_in: Some(run), - asked_on: Date("2026-10-10".into()), + "other.json", + json!([value(PipelineDocument::Run(PipelineRun { + instance: slug(INSTANCE), + label: "other".into(), + operated_by: RunOperator::Mind, + turn: RunTurn::SelfRun, + host: "test".into(), + started_on: Date("2026-10-10".into()), + budget_usd: "0".into(), + claims: vec![other_claim], + campaigns: vec![slug(CAMPAIGN)], }))]), ); + let other = PipelineRef { kind: PipelineKind::Run, id: Short(format!("{INSTANCE}:run:other")) }; + admit("other-ended.json", json!([resolution(&other, ResolutionOutcome::Recorded { reason: "unit not active".into() })])); + let ask = |label: &str, raised_in: PipelineRef| { + value(PipelineDocument::Question(PipelineQuestion { + campaign: slug(CAMPAIGN), + label: label.into(), + title: "A fork".into(), + question: "Which?".into(), + options: ["reopen", "retire"].iter().map(|name| QuestionOption { label: (*name).into(), text: "an option".into() }).collect(), + recommended: "reopen".into(), + depends: vec![], + raised_in: Some(raised_in), + asked_on: Date("2026-10-10".into()), + })) + }; + admit("other-question.json", json!([ask("fork2", other)])); + let other_question = format!("{CAMPAIGN}:question:fork2"); + let question = format!("{CAMPAIGN}:question:fork"); + admit("question.json", json!([ask("fork", run)])); let shown = held("A"); assert_eq!(shown.code, 0, "{}", shown.err); assert!( diff --git a/crates/mind-body/src/heartbeat/tests.rs b/crates/mind-body/src/heartbeat/tests.rs index 1c4a486..8ef4e43 100644 --- a/crates/mind-body/src/heartbeat/tests.rs +++ b/crates/mind-body/src/heartbeat/tests.rs @@ -1098,7 +1098,7 @@ fn a_beat_with_no_held_brief_writes_no_held_note() { brief_by(&rig, ANN, crate::persona::AGENT, "free", &source); rig.poll(); let notes: Vec = rig.store.traces.borrow().iter().flat_map(|trace| trace.instances.iter().map(|instance| instance.note.clone())).collect(); - assert!(notes.iter().all(|note| !note.contains("held")), "{notes:?}"); + assert!(notes.iter().all(|note| !note.contains("held") && !note.contains("closing")), "{notes:?}: a free brief and no dead holder write no note"); } /// Her Self run in force whose unit is gone, claiming `claims`, admitted `ago` seconds before now.