diff --git a/Sources/QuotaCore/ResetAlarmTracker.swift b/Sources/QuotaCore/ResetAlarmTracker.swift index be0a0812..c9b1be44 100644 --- a/Sources/QuotaCore/ResetAlarmTracker.swift +++ b/Sources/QuotaCore/ResetAlarmTracker.swift @@ -571,9 +571,28 @@ public struct ResetAlarmTracker: Sendable { let strongQuotaRestore = reading.flatMap { current in window.lastRemaining.map { current >= $0 + ResetAlarmPolicy.vendorRestoreRise } } ?? false + // A mid-window restore may also roll the window forward: the + // vendor reissues the period instead of holding it where it + // was. The evidence is the same shape the held-end rules + // below trust, sized up — a restore-sized rise that lands + // substantially restored. A rolling slide cannot meet it: + // its climb is gradual, so a single poll's rise past the + // ceiling never carries a 30-point rise with it (CC-215's + // false alerts moved a few points to a few tens of points + // across the boundary, never thirty). Owner 2026-11-07 + // (CC-218): a reset that moved the window end was missed + // entirely by the held-end rules. + let rolledRestore = reading.flatMap { current in + window.lastRemaining.map { + current >= ResetAlarmPolicy.courtesyRestoreCeiling + && $0 <= ResetAlarmPolicy.courtesyRestoreCeiling + && current >= $0 + ResetAlarmPolicy.vendorRestoreRise + } + } ?? false let forwardJump = (jump > required && climbed) || (hasPassed && advancedFullCadence && explicitStartConfirmsPeriod) || (!hasPassed && freshPeriod && strongQuotaRestore) + || (!hasPassed && rolledRestore) if forwardJump { isReset = true // When the window had *not* reached its own scheduled end,