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 / UsageProjection type near UsagePace in CodexBarCore.
- Inputs:
RateWindow, now.
- Outputs should include at least:
actualUsedPercent
projectedUsedPercentAtReset (raw, may exceed 100)
projectedRemainingPercentAtReset
isProjectedToOverflow
elapsedSeconds
remainingSeconds
- Return
nil when required timing information is missing or elapsed time is too small to produce a stable estimate.
- This issue is the only place that converts
RateWindow timing data into forecast math.
Non-goals
- No display clamping.
- No UI strings such as
Forecast 83% at reset.
- No row visibility decisions beyond returning
nil when projection is not trustworthy.
Files likely involved
Sources/CodexBarCore/UsagePace.swift or adjacent new file
Sources/CodexBarCore/UsageFetcher.swift
Tests/CodexBarTests/UsagePaceTests.swift or adjacent new test file
Acceptance Criteria
- Projection math works from
RateWindow + now without depending on UI code.
projectedUsedPercentAtReset is returned as a raw value and is not display-clamped to 100.
- Callers can distinguish
no forecast available from forecast available and >100%.
- Missing
resetsAt, missing windowMinutes, 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.
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
QuotaProjection/UsageProjectiontype nearUsagePaceinCodexBarCore.RateWindow,now.actualUsedPercentprojectedUsedPercentAtReset(raw, may exceed100)projectedRemainingPercentAtResetisProjectedToOverflowelapsedSecondsremainingSecondsnilwhen required timing information is missing or elapsed time is too small to produce a stable estimate.RateWindowtiming data into forecast math.Non-goals
Forecast 83% at reset.nilwhen projection is not trustworthy.Files likely involved
Sources/CodexBarCore/UsagePace.swiftor adjacent new fileSources/CodexBarCore/UsageFetcher.swiftTests/CodexBarTests/UsagePaceTests.swiftor adjacent new test fileAcceptance Criteria
RateWindow+nowwithout depending on UI code.projectedUsedPercentAtResetis returned as a raw value and is not display-clamped to100.no forecast availablefromforecast available and >100%.resetsAt, missingwindowMinutes, and near-zero elapsed time all suppress projection cleanly.100%, overrun, and missing timing info.