wave: drop the unread per-node cell count; pin node reports against surviving mutants
This commit is contained in:
parent
66d76af0b2
commit
91296c0863
2 changed files with 93 additions and 5 deletions
|
|
@ -9,7 +9,7 @@ use crate::cover::derive_cover;
|
|||
use crate::controllers::{CellRun, ConstituentRefusalReason, ControllerError};
|
||||
use crate::cover::CellId;
|
||||
use crate::wave::{CellEnd, absorb, classify, pending_code, refreshed};
|
||||
use crate::{Cell, CoverBudget, CoverBudgetError, SubmitReceipt};
|
||||
use crate::{Cell, CoverBudget, CoverBudgetError, EntityId, SubmitReceipt};
|
||||
use crate::tests::stock_weights;
|
||||
use crate::verse::{
|
||||
CallRecordStore, CreateVerseWorldIntent, RecordingInferencePort, ReplayInferencePort,
|
||||
|
|
@ -3025,3 +3025,95 @@ async fn a_v1_tick_or_run_row_is_refused_by_name() {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_wave_that_stops_reports_only_the_nodes_it_reached() {
|
||||
let (_dir, verse) = Harness::fresh().await;
|
||||
let mut reports = Vec::new();
|
||||
let ended = verse
|
||||
.run_under(fault_at(1), u64::MAX, deep_config(1), |report| {
|
||||
reports.push(report.clone());
|
||||
ControlFlow::Continue(())
|
||||
})
|
||||
.await;
|
||||
assert!(matches!(ended.record.status, RunStatus::Failed { .. }));
|
||||
let [report] = reports.as_slice() else {
|
||||
panic!("the open tick is reported")
|
||||
};
|
||||
assert_eq!(report.nodes.len(), 1, "the second node was never reached");
|
||||
assert_eq!(report.acts().count(), 1);
|
||||
assert_eq!(report.nodes[0].acts.len(), 1);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_node_that_ran_and_committed_nothing_is_still_reported() {
|
||||
let (_dir, verse) = Harness::fresh().await;
|
||||
let config = deep_config(1);
|
||||
let mut tick = opened_tick(&verse, &config).await;
|
||||
let gone = SubjectId::issue();
|
||||
let third = NodeId::of(tick.world_id, &NodeAnchor::Subject(gone));
|
||||
tick.cells.push(FrozenCell {
|
||||
id: tick.cells[0].id,
|
||||
group: false,
|
||||
members: vec![gone],
|
||||
node: third,
|
||||
distance: 3,
|
||||
});
|
||||
verse.runs.put_tick(&tick).unwrap();
|
||||
let mut reports = Vec::new();
|
||||
verse
|
||||
.run_under(ScriptedPort::speaking(), u64::MAX, config, |report| {
|
||||
reports.push(report.clone());
|
||||
ControlFlow::Continue(())
|
||||
})
|
||||
.await;
|
||||
let [report] = reports.as_slice() else {
|
||||
panic!("one tick reported")
|
||||
};
|
||||
assert_eq!(report.nodes.len(), 3);
|
||||
let last = &report.nodes[2];
|
||||
assert!(last.acts.is_empty());
|
||||
assert_eq!(last.refusals.len(), 1);
|
||||
assert_eq!(last.distance, Some(3));
|
||||
assert_eq!(last.label, "-", "the world holds no node for that anchor");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_node_is_labelled_by_what_it_stands_on() {
|
||||
let (_dir, verse) = Harness::fresh().await;
|
||||
let mut snapshot = verse.mailbox.snapshot().await.unwrap();
|
||||
let mut hierarchy = verse.mailbox.hierarchy().await.unwrap();
|
||||
let world = snapshot.world_id;
|
||||
let (tap, cellar) = (EntityId::issue(), EntityId::issue());
|
||||
snapshot.places = ["Cellar", "Tap-room"]
|
||||
.into_iter()
|
||||
.zip([cellar, tap])
|
||||
.map(|(label, id)| crate::PlaceSnapshot {
|
||||
id,
|
||||
label: label.into(),
|
||||
container: None,
|
||||
})
|
||||
.collect();
|
||||
let place = NodeId::of(world, &NodeAnchor::Place(tap));
|
||||
hierarchy.nodes.insert(
|
||||
place,
|
||||
crate::Node {
|
||||
id: place,
|
||||
anchor: NodeAnchor::Place(tap),
|
||||
parent: Some(hierarchy.root()),
|
||||
children: Vec::new(),
|
||||
voice: None,
|
||||
loose: Vec::new(),
|
||||
},
|
||||
);
|
||||
assert_eq!(node_label(place, &snapshot, &hierarchy), "Tap-room");
|
||||
assert_eq!(node_label(hierarchy.root(), &snapshot, &hierarchy), "world");
|
||||
let faction = verse.subject("Adrasteia").await;
|
||||
let institution = NodeId::of(world, &NodeAnchor::Institution(faction));
|
||||
assert_eq!(node_label(institution, &snapshot, &hierarchy), "Adrasteia");
|
||||
assert_eq!(
|
||||
node_label(NodeId::of(world, &NodeAnchor::Place(cellar)), &snapshot, &hierarchy),
|
||||
"-",
|
||||
"a node the hierarchy does not hold has no label"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -666,8 +666,6 @@ pub enum WaveStop {
|
|||
pub struct NodeOutcome {
|
||||
pub node: NodeId,
|
||||
pub distance: u8,
|
||||
/// Frozen cells of the node the wave reached.
|
||||
pub cells: u32,
|
||||
/// Every command the node's cells hold a receipt for, in cell order. A
|
||||
/// decline is a commit, so it is listed.
|
||||
pub committed: Vec<CommandId>,
|
||||
|
|
@ -709,7 +707,6 @@ pub async fn run_frozen_cells(
|
|||
nodes.push(NodeOutcome {
|
||||
node: frozen.node,
|
||||
distance: frozen.distance,
|
||||
cells: 0,
|
||||
committed: Vec::new(),
|
||||
refusals: Vec::new(),
|
||||
unattributed: Vec::new(),
|
||||
|
|
@ -719,7 +716,6 @@ pub async fn run_frozen_cells(
|
|||
}
|
||||
};
|
||||
let node = &mut nodes[slot];
|
||||
node.cells += 1;
|
||||
let fresh = match mailbox.opportunities().await {
|
||||
Ok(fresh) => fresh,
|
||||
Err(_) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue