Skip to content

Allow token usage statistics to be unavailable - #279

Open
zahidgh wants to merge 1 commit into
WordPress:trunkfrom
zahidgh:fix/nullable-token-usage
Open

Allow token usage statistics to be unavailable#279
zahidgh wants to merge 1 commit into
WordPress:trunkfrom
zahidgh:fix/nullable-token-usage

Conversation

@zahidgh

@zahidgh zahidgh commented Aug 21, 2026

Copy link
Copy Markdown

Closes #158

Allows providers to omit token usage statistics without manufacturing zero values. TokenUsage fields and accessors now accept null, GenerativeAiResult can carry a null usage object, array and JSON schema transformations preserve the absence, and unit coverage documents the behavior.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: zahidgh <zahidui@git.wordpress.org>
Co-authored-by: JasonTheAdams <jason_the_adams@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.51%. Comparing base (a31b0ec) to head (4353dbe).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #279      +/-   ##
============================================
+ Coverage     86.49%   86.51%   +0.02%     
- Complexity     1327     1331       +4     
============================================
  Files            68       68              
  Lines          4295     4302       +7     
============================================
+ Hits           3715     3722       +7     
  Misses          580      580              
Flag Coverage Δ
unit 86.51% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeffpaul
jeffpaul requested a review from a team August 26, 2026 13:52
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.

Improve handling of unprovided usage statistics

1 participant