Skip to content

Fix quota trajectory billing period calculation#325895

Merged
pwang347 merged 4 commits into
microsoft:mainfrom
rfeltis:rfeltis/quota-trajectory-calendar-month
Jul 15, 2026
Merged

Fix quota trajectory billing period calculation#325895
pwang347 merged 4 commits into
microsoft:mainfrom
rfeltis:rfeltis/quota-trajectory-calendar-month

Conversation

@rfeltis

@rfeltis rfeltis commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • compute quota trajectory elapsed days from one calendar month before the reset date
  • clamp month-end reset dates to the last valid day of the previous month
  • add deterministic 31-day billing-cycle coverage

Validation

  • npm run typecheck-client
  • quota trajectory tests: 13 passing in Chromium, WebKit, and Firefox

Follow-up to #320683.

Compute elapsed usage from one calendar month before the reset date instead of assuming every billing period is 30 days.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: aa202495-3a47-4b52-896f-3862c69efd9e
Copilot AI review requested due to automatic review settings July 15, 2026 02:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Corrects quota trajectory calculations to use the prior calendar month rather than a fixed 30-day period.

Changes:

  • Derives and clamps the billing-period start from the reset date.
  • Adds deterministic 31-day-cycle coverage.
Show a summary per file
File Description
chatQuotaNotification.ts Updates billing-period calculation.
chatQuotaNotification.test.ts Stabilizes time and covers a 31-day cycle.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/vs/workbench/contrib/chat/browser/chatQuotaNotification.ts Outdated
Cover March 31 resets in non-leap and leap years so the previous-month day clamp is exercised.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: aa202495-3a47-4b52-896f-3862c69efd9e
Comment thread src/vs/workbench/contrib/chat/browser/chatQuotaNotification.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: aa202495-3a47-4b52-896f-3862c69efd9e
Comment thread src/vs/workbench/contrib/chat/test/browser/chatQuotaNotification.test.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: aa202495-3a47-4b52-896f-3862c69efd9e
@rfeltis
rfeltis marked this pull request as ready for review July 15, 2026 17:42
@pwang347
pwang347 enabled auto-merge (squash) July 15, 2026 18:09
@pwang347
pwang347 merged commit 18b7325 into microsoft:main Jul 15, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.130.0 milestone Jul 15, 2026
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.

5 participants