Skip to content

Add Codex historical pace with risk forecasting and backfill + follow-ups for historical pace hardening#482

Open
ratulsarna wants to merge 6 commits intomainfrom
codex/pr-438-audit
Open

Add Codex historical pace with risk forecasting and backfill + follow-ups for historical pace hardening#482
ratulsarna wants to merge 6 commits intomainfrom
codex/pr-438-audit

Conversation

@ratulsarna
Copy link
Collaborator

Supersedes #438.

Includes targeted follow-up fixes from the audit:

  • Gate menu-bar pace computation by display mode.
  • Resolve lint by splitting UsageStore support declarations.
  • Centralize clamping via shared Double.clamped(to:).
  • Make historical pace test helpers timezone-deterministic.
  • Remove unused MenuBarDisplayText.displayText parameters and update call sites/tests.

Credit to @tristanmanchester for the original implementation and foundation. Thank you.

@ratulsarna ratulsarna changed the title Audit follow-ups for historical pace hardening Add Codex historical pace with risk forecasting and backfill + follow-ups for historical pace hardening Mar 5, 2026
@ratulsarna ratulsarna marked this pull request as ready for review March 5, 2026 17:54
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f08efa15b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +163 to +167
guard coverageStart <= windowStart.addingTimeInterval(Self.coverageTolerance) else {
return existingDataset
}
guard coverageEnd >= calibrationEnd.addingTimeInterval(-Self.coverageTolerance) else {
return existingDataset

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle zero-usage boundary days during history backfill

These coverage guards make backfill bail out unless the first and last usageBreakdown entries are close to the current window boundaries, but the dashboard scraper only emits days with positive credits (it skips v <= 0), so zero-usage days at the start or end of the week are omitted. In that common case, coverageStart/coverageEnd drift away from windowStart/calibrationEnd, this function returns early, and historical pace never gets seeded (the app stays on linear fallback). Please treat missing boundary days as zero-usage coverage (or synthesize empty days) before enforcing these checks.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants