Pin Cut 3's adoption rule on the NoPatch path (L1 Cut 4, c4.s1.f1)

The sweep hands step_session an adopted row's own session, so the
adoption rule is reachable with a differing fresh session only through
rows the in-flight listing excludes: ReadyToSubmit and NoPatch. Until
now only the ReadyToSubmit test killed whole-session equality (M3.1).

a_finished_boundary_session_stays_finished_after_the_world_moves ends a
boundary session NoPatch, narrows the weights to a lens it did not draw
(moving the ancestry), and steps the entry again: the row is found by
id, recognised as this answer's row, ends NoPatch with no inference, and
its bytes are unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-16 19:06:52 +02:00
commit 6f35229f24

View file

@ -11543,6 +11543,76 @@ mod tests {
task.await.unwrap();
}
/// The listing holds no `NoPatch` rows either, so a boundary session that
/// ended without a submit is found by its id alone, and Cut 3's adoption
/// rule decides it. The owner narrows the weights to a lens the finished
/// session did not draw, which moves the ancestry and would move a fresh
/// draw; the boundary itself is unchanged, so the claim set's fresh session
/// carries the finished row's id and differs from the row in ancestry and
/// lens. The rule reads what the session answers: the step ends `NoPatch`
/// with no inference, and the row is untouched.
#[tokio::test]
async fn a_finished_boundary_session_stays_finished_after_the_world_moves() {
let (directory, mailbox, task, commons, _roads) = dead_end_world(
crate::tests::stock_weights(),
&["The Unwalked Road"],
Roots::Commons,
0,
)
.await;
let jurisdiction = JurisdictionKey::PlaceSubtree(commons);
let store = Arc::new(
CultCacheControllerWorkStore::open(directory.path().join("controller-work.cc")).unwrap(),
);
let port = Arc::new(SweepPort::new(|call, _| idle_round(call)));
let runner = sweep_runner(&mailbox, port.clone(), store.clone());
assert_eq!(
runner.step_in(jurisdiction).await.unwrap(),
Some(crate::elaboration::ElaborationOutcome::NoPatch)
);
let (command_id, finished) = {
let journal = store.journal.lock().unwrap();
assert_eq!(journal.work.len(), 1);
let (id, work) = journal.work.iter().next().unwrap();
assert!(matches!(
work,
ControllerWork::Elaboration(ElaborationCheckpoint::NoPatch { .. })
));
(*id, recorded_session(work))
};
let finished_bytes = row_payload(&store, command_id).unwrap();
let before = mailbox.snapshot().await.unwrap();
let other = if finished.lens == Lens::Numen {
Lens::Patina
} else {
Lens::Numen
};
mailbox
.submit_fixture(
owner_command(&before, CommandBody::SetLensWeights { weights: only(other) }),
&owner_caller(),
)
.await
.unwrap();
let after = mailbox.snapshot().await.unwrap();
assert_eq!(after.boundaries, before.boundaries, "the owner's change moved the boundary");
assert_ne!(after.last_commit_digest, Some(finished.ancestry.clone()));
assert_eq!(after.lens_weights, only(other));
assert_eq!(
runner.step_in(jurisdiction).await.unwrap(),
Some(crate::elaboration::ElaborationOutcome::NoPatch),
"the finished row was not recognised as this answer's row"
);
assert_eq!(port.calls(), 1, "the finished session ran again");
assert_eq!(store.journal.lock().unwrap().work.len(), 1);
assert_eq!(row_payload(&store, command_id).unwrap(), finished_bytes);
drop(runner);
drop(mailbox);
task.await.unwrap();
}
/// A deficit session the model keeps getting wrong. After its first
/// refusal, five clock ticks each move the ancestry and are each followed by
/// a sweep; every sweep resumes the same session for one more round. The