Skip to content

refactor(coderd): add budget.CurrentPeriod for [start, end) windows#26972

Open
ssncferreira wants to merge 1 commit into
mainfrom
ssncf/ai-budget-period-helper
Open

refactor(coderd): add budget.CurrentPeriod for [start, end) windows#26972
ssncferreira wants to merge 1 commit into
mainfrom
ssncf/ai-budget-period-helper

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Extracts the AI budget period computation into a shared budget.CurrentPeriod helper. Pure refactor with no wire-value changes.

Changes

  • Add budget.CurrentPeriod(now, period) returning a PeriodWindow{Start, End} in UTC. Unknown periods return an error, matching the pattern used by ResolveUserAIBudget for unknown policies.
  • Update the callers and respective tests to use CurrentPeriod.

Note

Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira

ssncferreira commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@ssncferreira ssncferreira force-pushed the ssncf/ai-budget-period-helper branch from 15239d1 to 2551b28 Compare July 2, 2026 17:29
@linear-code

linear-code Bot commented Jul 2, 2026

Copy link
Copy Markdown

AIGOV-472

@ssncferreira ssncferreira force-pushed the ssncf/ai-budget-period-helper branch from 2551b28 to 143991c Compare July 2, 2026 17:35
@ssncferreira ssncferreira marked this pull request as ready for review July 2, 2026 17:36

@evgeniy-scherbina evgeniy-scherbina 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.

LGTM

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