Repository navigation
fix(billing): bound the enterprise preflight's workflow run count to the preview budget - #9673
Merged
Merged
Conversation
…the preview budget The enterprise issuance preflight counted the organization's billable workflow runs under the ledger's default 60s bound, the same COUNT DISTINCT the organization detail page already caps at 5s because it can outlast the admin proxy's request timeout on a large payer. The preflight now reads it through getBillingPeriodWorkflowRunCountWithinBudget, which reports null past the shared WORKFLOW_RUN_COUNT_BUDGET_MS, so the preview still loads; the contract already allows null. The over-budget classification moves next to readLedgerBounded as isLedgerReadOverBudget, shared by both callers.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryBounds the enterprise preview’s workflow count to five seconds and returns
Reviews (1) · Last reviewed commit: "fix(billing): bound the enterprise prefl..." · Reviewed by Greptile |
This branch was previously deployed
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
COUNT(DISTINCT execution_id)the organization detail page already caps at 5s, because on a large payer it can outlast the admin proxy's request timeout and fail the whole preview.getBillingPeriodWorkflowRunCountWithinBudget, which returnsnullpastWORKFLOW_RUN_COUNT_BUDGET_MS(5s) so the preview still loads. The preview contract already declaresworkflowRunsnullable, and the admin UI'sformatCountrendersnull.isLedgerReadOverBudget: read deadline orstatement_timeout) move next toreadLedgerBounded, shared by the detail page and the preflight instead of duplicated.Type of Change
Testing
usage-log.integration.ts:reports a workflow run count as unknown once it outlasts the preview budgetcounts runs normally, then returnsnullwhileusage_logis held under an exclusive lock (red without the budget: the read waits out the 20s test timeout). 23/23.usage-log.test.ts,enterprise-provisioning.test.ts,lib/adminunit suites: 95/95Checklist
test-auditauthoring gate)