Skip to content
Merged
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
19 changes: 19 additions & 0 deletions Sources/QuotaCore/ResetAlarmTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
jaywedgeworth22 marked this conversation as resolved.
Resolved
let forwardJump = (jump > required && climbed)
|| (hasPassed && advancedFullCadence && explicitStartConfirmsPeriod)
|| (!hasPassed && freshPeriod && strongQuotaRestore)
|| (!hasPassed && rolledRestore)
Comment thread
jaywedgeworth22 marked this conversation as resolved.
Resolved
Comment thread
jaywedgeworth22 marked this conversation as resolved.
Resolved
if forwardJump {
isReset = true
// When the window had *not* reached its own scheduled end,
Expand Down
Loading