Skip to content

REV-1625 C5: Billing & Usage free-state#12554

Draft
jefflloyd wants to merge 1 commit into
jeff/rev-1625-c4-gated-statesfrom
jeff/rev-1625-c5-billing-usage
Draft

REV-1625 C5: Billing & Usage free-state#12554
jefflloyd wants to merge 1 commit into
jeff/rev-1625-c4-gated-statesfrom
jeff/rev-1625-c5-billing-usage

Conversation

@jefflloyd

Copy link
Copy Markdown
Contributor

Description

Implements the Billing & Usage free-state (REV-1625 work item C5, TECH spec §5 / P16).

When the user is in the plan-gated free state (FREE_AI_REMOVAL arm + Free plan + zero base allotment, via C4's AIRequestUsageModel::is_free_plan_ai_gated):

  • The Balance section's base-credits meter card is replaced with a "Warp AI" card stating "The Free plan includes no Warp AI usage." — never a "0 of N" meter. The gated card also wins over a stale non-zero cached limit (e.g. when the FREE_PLAN_NO_AI denial arrives before the usage refresh).
  • Remaining bonus-grant balances (personal/team cards) continue to render unchanged, so promo/referral credits stay visible until exhausted (P4/P17).
  • A new actions row offers "Set up your own API key" (deep-links to AI settings via the existing NavigateToByokSettings action) and "Upgrade plan" (existing upgrade flow).
  • Non-gated users (paid plans, arm-less Free users) see the page exactly as before (P25/P26).

Stacked on C4 (jeff/rev-1625-c4-gated-states); top of the REV-1625 stack (C3 → C4 → C5).

Linked Issue

Testing

  • cargo check -p warp, cargo clippy -p warp --tests (clean), ./script/format
  • cargo nextest run -p warp -E 'test(billing_and_usage_page_v2)' — new unit test for the entitlement-card choice (meter vs gated card vs none), including the stale-limit case.

Local testing

  1. Run against a local warp-server with S1+S3 (PRs Improve edit_files diff match failure errors #11841, Reorder tools panel to put project explorer first, conversation list second #11843):
    # warp-server: ./script/server
    # enroll a Free test user in the experiment arm (id 102):
    psql warp_development -c "INSERT INTO experiment_arm_user_overrides (experiment_arm_id, user_id) SELECT 102, id FROM users WHERE email = '<your-test-email>';"
    # this repo:
    cargo run --features with_local_server
    
  2. Open Settings → Billing & Usage as the enrolled Free user: the Balance section shows the "Warp AI — The Free plan includes no Warp AI usage." card (no 0-of-N meter) plus the BYOK/upgrade buttons; "Set up your own API key" lands on Settings → AI with the API-key search applied; "Upgrade plan" opens the upgrade URL.
  3. Grant the user bonus credits (INSERT INTO bonus_credit_grants ...) and refresh (↻ button in the Plan row): a Personal credits card with the remaining balance renders next to the gated card.
  4. Delete the override row and refresh: the page returns to today's rendering (Balance section hidden for a 0-limit user without grants; meter card for limit > 0).
  5. Paid account sanity: Build/Max/Enterprise accounts render the base-credits meter exactly as before.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/b0196734-7ef9-43b3-acc2-e243d9e053d7
Run: https://oz.staging.warp.dev/runs/019eb89c-4bd7-75cd-8c8a-398dabd0afde

This PR was generated with Oz.

On the gated Free plan (FREE_AI_REMOVAL arm + Free + zero base allotment),
Settings > Billing & Usage stops rendering a 0-of-N base-credits meter
(P16). The Balance section instead shows a 'Warp AI' card stating the Free
plan includes no Warp AI usage, keeps any remaining bonus-grant balance
cards, and offers 'Set up your own API key' and 'Upgrade plan' actions.
The gated card also wins over a stale non-zero cached limit so a credit
meter is never shown for a plan that includes no Warp AI.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant