Repository navigation
feat(cli): project the in-force usage term and report amounts in the term's unit [show] - #1615
Merged
Merged
Conversation
…term's unit `checkly account usage projections` now calls `GET /v2/usage/projections`. The term ID argument is optional: without it, the API projects the term in force today, and the CLI names the term it picked. With an ID, the ID goes in the `usageTermsId` query parameter. Usage v2 amounts are now in each term's `unit` (`credits` for contracts, `usdCents` for self-service plans). The REST types and formatters read `unit`, `unitBudget`, `unitsUsed`, `unitsRemaining` and the other `units*` fields instead of the deprecated `credit*` fields. Human output labels amounts in credits or USD and prints cents as dollars. The series JSON envelope also includes `unit`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f-service rule keys On a usdCents term, pricing-rule rates and calculation daily rates were labelled as credits and printed as raw cents. They now read as a price in dollars (for example `Price: $0.00025` per run). Contract terms keep their credit labels, and the contract-only standard/premium credit conversion rows are hidden on usdCents terms. `--pricing-rule` now accepts `apiAndMultistepChecks` and `browserAndPlaywrightChecks`, the run products of a self-service term, which it previously rejected before sending the request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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
checkly account usage projections [id]now uses the newGET /v2/usage/projectionsendpoint (monorepo #6984, TREE-1280):checkly account usage termsfirst.?usageTermsId=.--as-ofworks as before.NO_USAGE_TERMSnow explains how to find a term ID and pass it./v2/usage/terms/{id}/projections. The plan is to make that public route return410with a message to upgrade, in a separate monorepo PR.Formatters now use the unit fields instead of the deprecated
credit*fields. v2 amounts are in the term'sunit:creditsfor contracts,usdCentsfor Stripe-billed self-service plans. Before this change, the CLI showed self-service cents labelled as credits.unit,unitBudget,unitsUsed,unitsRemaining,budgetedDailyUnits,averageDailyUnits,projectedUnitsAtContractEnd,projectedUnitsRemaining. The deprecatedcredit*fields are removed from the types.usdCentsamounts print as dollars and keep the API's sub-cent precision. Terms showBudgetandUnitinstead ofCredit budget.usdCentsterm they print as a price in dollars (Price: $0.00025per run,Annual price,Applied daily price), and the contract-onlyStandard/Premium credits / unitrows are hidden. Contract terms keep their credit labels. The API field names (credits,annualCredits,appliedDailyCredits*) are unchanged.--pricing-ruleaccepts the self-service run productsapiAndMultistepChecksandbrowserAndPlaywrightChecks(added in #6984). It previously rejected them before sending the request.series --output jsonnow includesunitin its envelope. Other JSON output passes the API response through unchanged.Notes
--as-ofwithout an ID projects the term the API considers in force today, as of that date. That's the backend's behaviour, not the CLI's.Validation against live APIs (read-only)
credits): every command in every output format, plus the error paths. Projections with no ID resolve the in-force term through the new route. After the pricing fix, term detail output is byte-for-byte unchanged.usdCents): every command in every output format. Labels read USD and amounts print as dollars; JSON carries"unit": "usdCents"; pricing rules showPrice: $0.00025/$0.00625;summary --pricing-rule apiAndMultistepChecksworks.Test plan
pnpm lint,tsc --noEmitusdCentsformatting for terms, summary, series, projections, pricing-rule prices and calculation daily rates, and the new--pricing-rulekeysTesting:
Annual % of budget: #%
USD at contract end: $#.##
Remaining USD at contract end: $#.##
% at contract end: #%
Weeks until exhausted: -
…
--pricing-rule
Before
After
Errors