From 3bee54f47ff14d156318d632143fadb1494f898e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 21 Nov 2026 00:02:51 +0100 Subject: [PATCH] Digest window: at least a day back again (WINDOW_MIN_HOURS, map 16.22.2); her last wake opens it only when it is older Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/projection/domain.rs | 8 ++++++-- crates/mind-body/src/projection/domain/tests.rs | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/mind-body/src/projection/domain.rs b/crates/mind-body/src/projection/domain.rs index ee92bf9..f5a274d 100644 --- a/crates/mind-body/src/projection/domain.rs +++ b/crates/mind-body/src/projection/domain.rs @@ -38,6 +38,8 @@ use crate::queue::{any_of, in_force, of_kind}; /// The window when she has not woken before, and the furthest back it ever reaches. const WINDOW_MAX_DAYS: i64 = 7; +/// The least the window reaches back (map 16.22.2): a day, however recently she woke. +const WINDOW_MIN_HOURS: i64 = 24; /// One page of the forge's pull requests, and how many pages of one repo a read takes: 200 moved in a week is past /// anything the coop has seen, and a repo past it fails the read rather than show part of it. const PULLS_PAGE: usize = 50; @@ -47,10 +49,12 @@ const EVENTS_PAGE: u32 = 200; /// The whole of one forge call. const FORGE_TIMEOUT: Duration = Duration::from_secs(10); -/// Where the window opens: her last wake, at most a week before `now`; a week when she has not woken before. +/// Where the window opens: her last wake, but at least a day and at most a week before `now`; a week when she has not +/// woken before. pub(crate) fn since(last_wake: Option>, now: DateTime) -> DateTime { let earliest = now - chrono::Duration::days(WINDOW_MAX_DAYS); - last_wake.map_or(earliest, |at| at.clamp(earliest, now)) + let latest = now - chrono::Duration::hours(WINDOW_MIN_HOURS); + last_wake.map_or(earliest, |at| at.clamp(earliest, latest)) } /// What moved in her domain, as read: the facts the section is rendered from. A harness fixture carries the same diff --git a/crates/mind-body/src/projection/domain/tests.rs b/crates/mind-body/src/projection/domain/tests.rs index 61b84a4..4ced73c 100644 --- a/crates/mind-body/src/projection/domain/tests.rs +++ b/crates/mind-body/src/projection/domain/tests.rs @@ -129,11 +129,12 @@ fn worked_on() -> TestMind { } #[test] -fn the_window_opens_at_her_last_wake_at_most_a_week_back() { +fn the_window_opens_at_her_last_wake_at_least_a_day_and_at_most_a_week_back() { let now = now(); assert_eq!(super::since(None, now), now - Duration::days(7), "never woken: a week"); assert_eq!(super::since(Some(now - Duration::days(30)), now), now - Duration::days(7)); - assert_eq!(super::since(Some(now - Duration::minutes(10)), now), now - Duration::minutes(10), "her last wake, however recent"); + assert_eq!(super::since(Some(now - Duration::days(2)), now), now - Duration::days(2), "her last wake"); + assert_eq!(super::since(Some(now - Duration::minutes(5)), now), now - Duration::hours(24), "a wake five minutes ago still shows a day (Soul p6)"); } #[test]