feat(quota): add includeAllowance option to Wafer checker#523
Merged
Conversation
Adds an opt-out toggle for the Wafer Pass quota meter, useful for accounts that only use the PAYG (serverless) billing model. When disabled, the checker skips the quota endpoint entirely and returns no meters — preventing a zeroed-out allowance from triggering unnecessary provider cooldowns. - wafer-checker: guard quota fetch behind includeAllowance (default true) - config.ts: add includeAllowance to WaferQuotaCheckerOptionsSchema - WaferQuotaConfig: add Switch toggle + disable endpoint input when off - tests: refactor with shared fixtures, add includeAllowance: false cases
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
Adds an
includeAllowanceopt-out toggle to the Wafer quota checker, useful for accounts that only use the PAYG (serverless) billing model rather than a Wafer Pass plan.Problem
The Wafer Pass quota endpoint returns zeroed-out data (
0 / 0 requests) for accounts that don't have an active Pass plan. This causes the checker to produce a permanently exhausted allowance meter, which triggers unnecessary provider cooldowns for PAYG-only users.Changes
Backend
wafer-checker.ts: Guard the quota endpoint fetch behindincludeAllowance(defaultstrue). Whenfalse, no HTTP request is made and no meters are returned — clean and side-effect-free.config.ts: AddincludeAllowance: z.boolean().optional()toWaferQuotaCheckerOptionsSchema.Frontend
WaferQuotaConfig.tsx: Add aSwitchtoggle for "Include Wafer Pass quota". When toggled off, the endpoint override input is also disabled (since it becomes irrelevant). Help text explains the use case.Tests
makeQuotaMockhelper (cleaner than the previous per-test inline mocks).includeAllowance: falsesub-suite covering: no fetch calls made, no meters returned, custom endpoint also skipped.UI
The Wafer quota checker config form now shows: