heartbeat tests, tempo tests, golden for Pulse (tests WIP)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-31 05:28:36 +01:00
commit b264865be4
4 changed files with 250 additions and 1142 deletions

View file

@ -335,10 +335,7 @@ impl fmt::Display for Outcome {
}
struct Turn {
label: String,
admitted: DateTime<Utc>,
/// When it was resolved, and whether the resolution withdrew it unrun.
resolved: Option<(DateTime<Utc>, bool)>,
}
fn parse_time(text: &str) -> Result<DateTime<Utc>> {
@ -398,16 +395,14 @@ fn recent_turns(mind: &dyn MindPort, instance: &Slug) -> Result<Vec<Turn>> {
};
let mut turns = Vec::new();
for run in runs {
let PipelineFacts::Run { label, .. } = &run.facts else {
if !matches!(run.facts, PipelineFacts::Run { .. }) {
continue;
};
let ending = latest_resolution(mind, &run.id)?
.map(|(at, outcome)| (at, matches!(outcome, ResolutionOutcome::Withdrawn { .. })));
turns.push(Turn {
label: label.0.clone(),
admitted: parse_time(&run.admission.admitted_at)?,
resolved: ending,
});
}
// A turn withdrawn unrun never happened: it neither resets her wait nor counts as her last turn.
if let Some((_, ResolutionOutcome::Withdrawn { .. })) = latest_resolution(mind, &run.id)? {
continue;
}
turns.push(Turn { admitted: parse_time(&run.admission.admitted_at)? });
}
Ok(turns)
}

File diff suppressed because it is too large Load diff

View file

@ -110,6 +110,11 @@ impl TestMind {
this
}
/// The next admission lands exactly at `when`.
pub(crate) fn admit_at(&self, when: DateTime<Utc>) {
self.now.set(when - Duration::seconds(1));
}
/// Admits as Hands, one second after the last admission.
pub(crate) fn put(&self, documents: Vec<PipelineDocument>) -> PipelineAdmissionOutcome {
self.now.set(self.now.get() + Duration::seconds(1));