Skip to content

Use rolling 30-day window for annual projections instead of current month#179

Merged
rajbos merged 4 commits intomainfrom
copilot/update-prediction-data-counters
Feb 7, 2026
Merged

Use rolling 30-day window for annual projections instead of current month#179
rajbos merged 4 commits intomainfrom
copilot/update-prediction-data-counters

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Annual projections calculated from current month data are unstable early in the month (e.g., projecting from 2 days of data on Feb 2nd). Changed to use a rolling 30-day window for consistent predictions throughout the month.

Changes

Backend (extension.ts)

  • Added last30Days period to DetailedStats interface
  • Modified calculateDetailedStats() to accumulate stats for sessions within last 30 days
  • Updated file filtering boundary from lastMonthStart to last30DaysStart

Frontend (details/main.ts)

  • Replaced projection formula: (monthValue / currentDay) * daysInYear(last30DaysValue / 30) * 365.25
  • Updated all projection displays (metrics, editor usage, model usage) to use stats.last30Days
// Before: volatile at month start
function calculateProjection(monthValue: number): number {
  const day = now.getDate();  // 1-2 days early in month
  return (monthValue / day) * daysInYear;
}

// After: stable 30-day rolling average
function calculateProjection(last30DaysValue: number): number {
  return (last30DaysValue / 30) * 365.25;
}

This provides stable projections regardless of calendar position while maintaining accurate year-over-year trending.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/github-copilot-token-usage/github-copilot-token-usage/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

update all the prediction data to be using the last 30 days counters instead of the current month counters. that should give us better info during the beginning of the month


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 5, 2026 07:13
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Update prediction data to use last 30 days counters Use rolling 30-day window for annual projections instead of current month Feb 5, 2026
Copilot AI requested a review from rajbos February 5, 2026 07:17
@rajbos rajbos marked this pull request as ready for review February 5, 2026 07:19
@rajbos rajbos enabled auto-merge February 7, 2026 19:30
@rajbos rajbos merged commit 538da1b into main Feb 7, 2026
14 checks passed
@rajbos rajbos deleted the copilot/update-prediction-data-counters branch February 7, 2026 19:44
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

Comments