Skip to content

feat(quota): add includeAllowance option to Wafer checker#523

Merged
mcowger merged 1 commit into
mainfrom
wafer-payg
May 26, 2026
Merged

feat(quota): add includeAllowance option to Wafer checker#523
mcowger merged 1 commit into
mainfrom
wafer-payg

Conversation

@mcowger
Copy link
Copy Markdown
Owner

@mcowger mcowger commented May 26, 2026

Summary

Adds an includeAllowance opt-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 behind includeAllowance (defaults true). When false, no HTTP request is made and no meters are returned — clean and side-effect-free.
  • config.ts: Add includeAllowance: z.boolean().optional() to WaferQuotaCheckerOptionsSchema.

Frontend

  • WaferQuotaConfig.tsx: Add a Switch toggle 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

  • Refactored test file with shared fixtures and a makeQuotaMock helper (cleaner than the previous per-test inline mocks).
  • Added includeAllowance: false sub-suite covering: no fetch calls made, no meters returned, custom endpoint also skipped.

UI

The Wafer quota checker config form now shows:

  1. Endpoint (existing, greyed out when allowance disabled)
  2. Include Wafer Pass quota — Switch toggle, on by default

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
@mcowger mcowger merged commit 4e0e0a3 into main May 26, 2026
1 check passed
@mcowger mcowger deleted the wafer-payg branch May 26, 2026 01:10
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.

1 participant