From 3d6f9179d01d46be245583774e102465e49ef674 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 26 Oct 2026 14:51:42 +0100 Subject: [PATCH] Aim the read-back fault tests at the last question, not the last pipeline document Co-Authored-By: Claude Sonnet 5.5 --- crates/huginn-mind/src/query.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/huginn-mind/src/query.rs b/crates/huginn-mind/src/query.rs index a8cd344..8a02aa2 100644 --- a/crates/huginn-mind/src/query.rs +++ b/crates/huginn-mind/src/query.rs @@ -2185,14 +2185,13 @@ mod tests { Mind::open_with(store, &slug(INSTANCE))?.read_back() } - /// The stored question the faults land on: the last pipeline document in - /// identity order, so a gate that stops early or samples never reaches it. + /// The stored question the faults land on: the last question in identity + /// order, with more than 100 pipeline documents before it, so a gate that + /// stops early or samples never reaches it. fn last_question(rows: &[cultcache_rs::CultCacheEnvelope]) -> usize { - let pipeline: Vec = - (0..rows.len()).filter(|at| crate::docs::kind_of_type(&rows[*at].r#type).is_some()).collect(); - assert!(pipeline.len() > 130, "the fixture is past any cutoff: {}", pipeline.len()); - let at = *pipeline.last().unwrap(); - assert_eq!(rows[at].r#type, K::Question.type_id(), "the target is a question"); + let at = rows.iter().rposition(|row| row.r#type == K::Question.type_id()).unwrap(); + let before = rows[..at].iter().filter(|row| crate::docs::kind_of_type(&row.r#type).is_some()).count(); + assert!(before > 100, "the fixture is past any cutoff: {before}"); at }