Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@ pub(in super::super) fn turnover_due<E>(
next_act_tokens: Option<usize>,
would_restore: impl FnOnce() -> Result<bool, E>,
) -> Result<Turnover, E> {
// NO GRANT, NO TURNOVER: a turn sized before her served window is known (the spawn's
// placeholder MIN_SERVE_CTX, 2048) allows her view nothing, and turning over against that
// started her view empty; the next act re-appended every item her sources hold (~2,000
// items, 20-56M chars on the M5, 2026-11-02 22:29-22:31Z) and turned over again. Her held
// view is kept; the turn itself is refused for capacity.
if allowed == 0 {
return Ok(Turnover::Keep);
}
if view_tokens > allowed {
return Ok(Turnover::Overflow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,14 @@ fn a_fitting_view_restores_only_when_the_next_act_would_turn_it_over() {
assert_eq!(turnover_due(33_000, 32_000, Some(5_000), never), Ok(Turnover::Overflow), "over its grant: turn over");
assert_eq!(turnover_due(30_000, 32_000, Some(5_000), || Err("mismatch")), Err("mismatch"), "a broken allocation refuses");
}

// what this catches: a turn sized before her window is known (granted nothing) turning her view
// over to an empty start, after which the next act re-appends every item her sources hold and
// turns over again (2026-11-02, every M5 resident at boot). With nothing allowed the view is kept.
#[test]
fn a_view_granted_nothing_is_kept_never_started_empty() {
let due = turnover_due::<()>(33_165, 0, Some(10_000), || Ok(true)).expect("pure");
assert_eq!(due, Turnover::Keep, "no grant is not an overflow");
let due = turnover_due::<()>(33_165, 29_000, Some(10_000), || Ok(true)).expect("pure");
assert_eq!(due, Turnover::Overflow, "a real grant it outgrew still turns over");
}
Loading