forked from steipete/CodexBar
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add a core projection model that answers: if the current burn rate continues until reset, what percentage of the quota will be used at the end of the window?
This issue is responsible for the calculation layer only. It must not change menu copy, visibility policy, or progress bar rendering.
Scope
- Introduce a small
QuotaProjection/UsageProjectiontype nearUsagePaceinCodexBarCore. - Inputs:
RateWindow,now. - Outputs should include at least:
actualUsedPercentprojectedUsedPercentAtReset(raw, may exceed100)projectedRemainingPercentAtResetisProjectedToOverflowelapsedSecondsremainingSeconds
- Return
nilwhen required timing information is missing or elapsed time is too small to produce a stable estimate. - This issue is the only place that converts
RateWindowtiming data into forecast math.
Non-goals
- No display clamping.
- No UI strings such as
Forecast 83% at reset. - No row visibility decisions beyond returning
nilwhen projection is not trustworthy.
Files likely involved
Sources/CodexBarCore/UsagePace.swiftor adjacent new fileSources/CodexBarCore/UsageFetcher.swiftTests/CodexBarTests/UsagePaceTests.swiftor adjacent new test file
Acceptance Criteria
- Projection math works from
RateWindow+nowwithout depending on UI code. projectedUsedPercentAtResetis returned as a raw value and is not display-clamped to100.- Callers can distinguish
no forecast availablefromforecast available and >100%. - Missing
resetsAt, missingwindowMinutes, and near-zero elapsed time all suppress projection cleanly. - Unit tests cover zero elapsed, small elapsed, lasts to reset, exact
100%, overrun, and missing timing info.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels