wear-facts: Mind::roots_touched, the newest admission per root with a campaign's repos in force, through the MindPort and the wire

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-03 05:11:48 +01:00
commit fbaf9bd33a
10 changed files with 323 additions and 8 deletions

View file

@ -157,6 +157,10 @@ impl TestMind {
Err(refusal) => HuginnMindResponse::Refused(refusal),
},
HuginnMindRequest::Admit(batch) => HuginnMindResponse::Admit(self.mind.borrow_mut().admit(batch, self.now.get())),
HuginnMindRequest::RootsTouched { .. } => match self.mind.borrow().roots_touched() {
Ok(roots) => HuginnMindResponse::RootsTouched(roots),
Err(refusal) => HuginnMindResponse::Refused(refusal),
},
other => panic!("the tests ask nothing else: {other:?}"),
}
}
@ -207,6 +211,11 @@ impl MindPort for TestMind {
Ok(huginn_mind::RepoActivity { head: after.unwrap_or(0), events: vec![], capped: vec![], open_prs: vec![], unseen: vec![], moved: vec![] })
}
/// The roots of this mind as it holds them: the daemon's answer from the same mind, never a stub.
fn roots_touched(&self) -> Result<Vec<huginn_mind::RootTouched>> {
self.mind.borrow().roots_touched().map_err(|_| anyhow!("refused"))
}
fn admit(&self, agent: &str, session: &str, documents: Vec<PipelineDocument>) -> Result<PipelineAdmissionOutcome> {
self.now.set(self.now.get() + Duration::seconds(1));
let batch = PipelineAdmissionBatch {