Select included-credit policy from report metadata#140
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds infrastructure to choose an “included credits” policy based on report format metadata (and, for native AI Credits, a report period start boundary), then passes the resolved policy into the included-credits allocation step in the pipeline.
Changes:
- Introduces
resolveIncludedCreditsPolicy(...)with transition-period vs native AI Credits (summer promo vs standard) policy selection logic. - Wires
runPipelineto resolve a policy after adapter validation and pass it intocreateAicIncludedCreditsAllocator. - Adds unit tests covering transition reports, native boundary dates, and invalid/missing period defaults.
Show a summary per file
| File | Description |
|---|---|
| src/pipeline/runPipeline.ts | Resolves and passes includedCreditsPolicy into the included-credits allocator after validating report format. |
| src/pipeline/includedCreditsPolicy.ts | Adds policy definitions plus a resolver that selects policy by report format and (for native) report period start date. |
| src/pipeline/includedCreditsPolicy.test.ts | Adds focused tests for resolver behavior across formats and boundary dates. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This prepares included-credit policy selection for reports based on report format metadata and period boundaries, while preserving the current production behavior that native AI Credits uploads are unsupported.
Changes
2026-09-01use the summer promo policy, starts on or after2026-09-01use the standard policy, and missing or invalid native starts default to standard.onHeaderoraccumulate, while preserving transition-period allocation behavior.feat: select included credit policyrefactor: share ISO date validationfix: resolve policy from report periodTesting
npm run lintnpm testnpm run buildChecklist
npm run lint)