diff --git a/crates/agent-core/src/helper_reconcile.rs b/crates/agent-core/src/helper_reconcile.rs index 5b4f0a9..c760aad 100644 --- a/crates/agent-core/src/helper_reconcile.rs +++ b/crates/agent-core/src/helper_reconcile.rs @@ -204,6 +204,10 @@ impl HelperSync { self.lease = None; self.capture = None; } + /// Read-only bound of the existing confirmed lease; creates no readiness. + pub fn validity_deadline(&self) -> Option> { + self.lease.as_ref().map(|lease| lease.until) + } pub fn active_generation(&self) -> Option { self.lease.as_ref().map(|lease| lease.generation) } diff --git a/crates/agent-core/tests/helper_reconcile.rs b/crates/agent-core/tests/helper_reconcile.rs index 19349ab..df507a4 100644 --- a/crates/agent-core/tests/helper_reconcile.rs +++ b/crates/agent-core/tests/helper_reconcile.rs @@ -984,11 +984,13 @@ fn clean_ready_shared_lock_and_reopen_start_closed() { let mut f = Fixture::new(); let mut sync = f.sync(); assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot)); + assert_eq!(sync.validity_deadline(), None); let snapshot = f.snapshot(&mut sync, 1); let raw = f.request(&snapshot); let d = f.decision(&snapshot, &raw, 1, true); let applied = f.apply(&mut sync, &d, &raw).unwrap(); assert!(applied.ready); + assert_eq!(sync.validity_deadline(), Some(d.valid_until)); assert_eq!(sync.active_generation(), Some(1)); assert_eq!(applied.snapshot.previous_decision_id, Some(d.decision_id)); assert!(applied.unlocked_grants.is_empty()); @@ -1004,6 +1006,7 @@ fn clean_ready_shared_lock_and_reopen_start_closed() { .is_err() ); sync.close(); + assert_eq!(sync.validity_deadline(), None); assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot)); } #[test]