Verse run: the driver labels a world ScopeChanged refusal ScopeMoved

One fact, one label across lanes (ruling unsent-awaiting-row-is-awaiting).
RefusalReason::ScopeMoved's doc names the unsent-awaiting state. Builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-11 15:22:22 +02:00
commit 706d0c3792
2 changed files with 33 additions and 5 deletions

View file

@ -30,7 +30,8 @@ use crate::cover::{
Cell, CellId, Constituent, CoverBudget, CoverBudgetError, TickIndex, derive_cover,
};
use crate::{
AgencyGraph, CommandId, DecisionOpportunity, MailboxError, OperatorEvent, RenderPath,
AgencyGraph, CommandId, DecisionOpportunity, KernelError, MailboxError, OperatorEvent,
RenderPath,
SubjectId, SubmitReceipt, TickMinutes, WorldId, WorldMailbox, WorldSnapshot,
};
use chrono::Utc;
@ -94,10 +95,12 @@ pub enum RefusalReason {
WorldRejected,
/// The cell's subject no longer holds an opportunity.
OpportunityGone,
/// The cell's in-flight work was bound to a scope that has since moved,
/// so it is refused before any inference. A cell whose command already
/// committed does not end this way: the controller answers it with its
/// receipt whatever the scope has done since.
/// The cell's work was bound to a scope that has since moved. Work still
/// reasoning is refused before any inference. Work whose submission body
/// was persisted but never sent is submitted and refused by the world with
/// `ScopeChanged`. A cell whose command already committed does not end
/// this way: the controller answers it with its receipt whatever the scope
/// has done since.
ScopeMoved,
}
@ -595,6 +598,9 @@ fn classify(error: &ControllerError) -> CellEnd {
CellEnd::Budget
}
_ if error.requires_quarantine() => CellEnd::Fatal("controller_quarantined"),
ControllerError::World(KernelError::ScopeChanged { .. }) => {
CellEnd::Refused(RefusalReason::ScopeMoved)
}
ControllerError::World(_) => CellEnd::Refused(RefusalReason::WorldRejected),
ControllerError::NoOpportunity { .. } | ControllerError::AmbiguousOpportunity => {
CellEnd::Refused(RefusalReason::OpportunityGone)

View file

@ -979,6 +979,28 @@ fn an_error_ends_a_cell_as_the_run_must_treat_it() {
));
}
/// One fact, one label: the world refusing a body whose scope moved is
/// `ScopeMoved`, the same label the controller's own refusal of in-flight work
/// carries, and not the catch-all `WorldRejected`.
#[tokio::test]
async fn a_world_refusal_for_a_moved_scope_is_scope_moved() {
let (_dir, verse) = Harness::fresh().await;
let opportunity = verse.mailbox.snapshot().await.unwrap().opportunities[0].clone();
let moved = ControllerError::World(KernelError::ScopeChanged {
scope: opportunity.scope.clone(),
expected: opportunity.scope_digest.clone(),
actual: opportunity.scope_digest.clone(),
});
assert!(matches!(
classify(&moved),
CellEnd::Refused(RefusalReason::ScopeMoved)
));
assert!(matches!(
classify(&ControllerError::World(KernelError::AffordanceDenied)),
CellEnd::Refused(RefusalReason::WorldRejected)
));
}
/// A recording port over the harness's call store for `sequence` under `cap`,
/// and a runner on it.
fn port_and_runner(