diff --git a/crates/mind-body/src/control/tests.rs b/crates/mind-body/src/control/tests.rs index 19dcdd2..0f5f37a 100644 --- a/crates/mind-body/src/control/tests.rs +++ b/crates/mind-body/src/control/tests.rs @@ -230,6 +230,7 @@ fn an_old_swarm_store_holding_a_dial_or_a_share_reads_as_held_undecodable_and_is let dir = tempfile::tempdir().unwrap(); let path = released_store(dir.path()); let mut cache = CultCache::new(); + cache.register_entry_type::().unwrap(); cache.register_entry_type::().unwrap(); cache.register_entry_type::().unwrap(); cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(swarm_path(dir.path()))).unwrap(); diff --git a/crates/mind-body/src/heartbeat/tests.rs b/crates/mind-body/src/heartbeat/tests.rs index d7e52fb..20c8773 100644 --- a/crates/mind-body/src/heartbeat/tests.rs +++ b/crates/mind-body/src/heartbeat/tests.rs @@ -288,10 +288,17 @@ fn the_beat_is_the_lower_median_of_the_minds_newest_votes() { rig.pulse(BOB, 100, Some(86_400), None); rig.poll(); assert_eq!(rig.store.traces.borrow().last().unwrap().tempo_s, 60, "the lower median of two votes is the lower"); - // Ann's newest vote replaces her old one; a pulse with no vote keeps it. +} + +#[test] +fn a_minds_newest_vote_replaces_her_old_one_and_a_pulse_with_no_vote_keeps_it() { + let rig = Rig::new(); + rig.turn(ANN, 3000); + rig.turn(BOB, 3000); + rig.pulse(ANN, 100, Some(60), None); rig.pulse(ANN, 50, Some(7200), None); rig.pulse(ANN, 40, None, Some(10)); - rig.advance(1); + rig.pulse(BOB, 100, Some(86_400), None); rig.poll(); let trace = rig.store.traces.borrow().last().cloned().unwrap(); assert_eq!(trace.tempo_s, 7200); diff --git a/crates/mind-body/src/persona/tests.rs b/crates/mind-body/src/persona/tests.rs index 8ce6193..b8d2293 100644 --- a/crates/mind-body/src/persona/tests.rs +++ b/crates/mind-body/src/persona/tests.rs @@ -403,7 +403,7 @@ fn a_reply_is_decoded_as_the_one_type_and_nothing_else_is_scanned() { assert!(decode_reply(&says(&[("swarm", "x")]), &c.rooms).is_ok()); for bad in [ "I will start_self_run now", - r#"{"say":[],"start_self_run":null} and more"#, + r#"{"say":[],"start_self_run":null,"tempo_vote_beat_s":null,"urgency_permille":null} and more"#, r#"{"say":[],"start_self_run":null,"extra":1}"#, "", ] { @@ -477,7 +477,7 @@ fn a_start_outside_the_reply_bounds_fails_the_turn_without_an_admission_or_an_ac fn a_reply_without_start_self_run_is_not_a_reply_though_null_is() { let c = config(); assert_eq!(decode_reply(r#"{"say":[]}"#, &c.rooms), Err(Failure::Undecodable), "the schema requires the field, so does the decoder"); - assert!(decode_reply(r#"{"say":[],"start_self_run":null}"#, &c.rooms).is_ok()); + assert!(decode_reply(r#"{"say":[],"start_self_run":null,"tempo_vote_beat_s":null,"urgency_permille":null}"#, &c.rooms).is_ok()); let rig = Rig::new(vec![operator_says(1, "go")], &[r#"{"say":[{"room":"operator","text":"hi"}]}"#.into()]); let Outcome::Served { failure, .. } = rig.go() else { panic!("served") }; assert_eq!(failure, Some(Failure::Undecodable)); diff --git a/crates/mind-body/src/self_run.rs b/crates/mind-body/src/self_run.rs index 02265b9..e0327ac 100644 --- a/crates/mind-body/src/self_run.rs +++ b/crates/mind-body/src/self_run.rs @@ -391,7 +391,8 @@ pub fn carry(mind: &dyn MindPort, clock: &dyn Clock, lender: &dyn Lender, spawne #[allow(clippy::too_many_arguments, reason = "carry's ports, passed on whole")] fn lend_and_drive(mind: &dyn MindPort, clock: &dyn Clock, lender: &dyn Lender, spawner: &dyn Spawner, run_cap_s: u64, out: &mut dyn Write, run: &PipelineRef, heard: &mut Heard) -> Result { - let request = LeaseRequest { expires_at_unix_ms: unix_ms(clock.now()).saturating_add(run_cap_s.saturating_mul(1000)) }; + let started_ms = unix_ms(clock.now()); + let request = LeaseRequest { expires_at_unix_ms: started_ms.saturating_add(run_cap_s.saturating_mul(1000)) }; let lease = match lender.lend(&request)? { Lent::Granted(lease) => lease, Lent::Refused(refused) if refused.kind == LeaseRefusalKind::Expired => { @@ -401,7 +402,6 @@ fn lend_and_drive(mind: &dyn MindPort, clock: &dyn Clock, lender: &dyn Lender, s Lent::Refused(refused) => return close_refused(mind, clock, run, refused.kind), }; let child = spawner.spawn(&claude_args(session_id(run)), lease.token())?; - let started_ms = unix_ms(clock.now()); drive(mind, clock, child, run, (lease.plan_quota(), started_ms), heard, out) } diff --git a/schemas/cultnet/epiphany.pipeline.finding.v2.schema.json b/schemas/cultnet/epiphany.pipeline.finding.v2.schema.json index aa776ce..b17c4bb 100644 --- a/schemas/cultnet/epiphany.pipeline.finding.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.finding.v2.schema.json @@ -171,7 +171,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" }, diff --git a/schemas/cultnet/epiphany.pipeline.follow_up.v2.schema.json b/schemas/cultnet/epiphany.pipeline.follow_up.v2.schema.json index 5f85ace..8326b68 100644 --- a/schemas/cultnet/epiphany.pipeline.follow_up.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.follow_up.v2.schema.json @@ -65,7 +65,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" }, diff --git a/schemas/cultnet/epiphany.pipeline.question.v2.schema.json b/schemas/cultnet/epiphany.pipeline.question.v2.schema.json index 5e17b04..e9929d4 100644 --- a/schemas/cultnet/epiphany.pipeline.question.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.question.v2.schema.json @@ -35,7 +35,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" }, diff --git a/schemas/cultnet/epiphany.pipeline.resolution.v2.schema.json b/schemas/cultnet/epiphany.pipeline.resolution.v2.schema.json index 6351f76..70419c1 100644 --- a/schemas/cultnet/epiphany.pipeline.resolution.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.resolution.v2.schema.json @@ -30,7 +30,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" }, diff --git a/schemas/cultnet/epiphany.pipeline.ruling.v2.schema.json b/schemas/cultnet/epiphany.pipeline.ruling.v2.schema.json index f1b2641..e587f13 100644 --- a/schemas/cultnet/epiphany.pipeline.ruling.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.ruling.v2.schema.json @@ -68,7 +68,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" }, diff --git a/schemas/cultnet/epiphany.pipeline.run.v2.schema.json b/schemas/cultnet/epiphany.pipeline.run.v2.schema.json index de28923..d8a2bf0 100644 --- a/schemas/cultnet/epiphany.pipeline.run.v2.schema.json +++ b/schemas/cultnet/epiphany.pipeline.run.v2.schema.json @@ -25,7 +25,8 @@ "Instance", "Stewardship", "HandOff", - "Run" + "Run", + "Pulse" ], "type": "string" },