Add native AI Credits parsing helpers#135
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR lays groundwork for supporting “native” AI Credits billing exports by adding parser-level helpers and tests, while ensuring the upload pipeline still rejects native AI Credits reports before any aggregation occurs.
Changes:
- Added a native AI Credits date normalization helper to convert slash-form dates (e.g.,
5/29/26) into ISO format. - Added a native AI Credits row parsing helper and accompanying unit tests.
- Updated pipeline tests to assert native AI Credits reports fail fast with
UnsupportedNativeAiCreditsReportErrorand do not invoke aggregator hooks.
Show a summary per file
| File | Description |
|---|---|
src/pipeline/runPipeline.test.ts |
Strengthens regression coverage that native AI Credits uploads are rejected before any aggregation processing begins. |
src/pipeline/parser.ts |
Introduces native AI Credits parsing/date normalization helpers for future integration. |
src/pipeline/parser.test.ts |
Adds test coverage for the new native helper behavior (date normalization + alias/fallback behavior). |
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: 1
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
Native AI Credits report support needs parser-level groundwork without changing the live upload behavior. This PR adds focused native parsing helpers and tests while keeping native reports rejected by the upload pipeline until UI and aggregation support are ready.
feat: add native AI Credits parsing helpersfix: keep native AI Credits fields authoritativeChanges
5/29/26to ISO dates such as2026-05-29.quantity,gross_amount,discount_amount, andnet_amountas the usage and cost fields, while exposing those values through AIC alias fields for compatibility.aic_net_amountpreserves native discounts fromnet_amount.UnsupportedNativeAiCreditsReportErrorbefore aggregator headers or rows are processed.Testing
npm testnpm run lintnpm run buildChecklist
npm run lint)