Remove confusing 'getting low on credits' message for newly signed up users#4097
Conversation
Preview deployments |
2faa3ba to
682beb1
Compare
Host Test Results 1 files ± 0 1 suites ±0 3h 46m 7s ⏱️ + 1h 51m 37s For more details on these errors, see this check. Results for commit f657c8f. ± Comparison against base commit 157e2ef. ♻️ This comment has been updated with latest results. |
When a new user signs up, they receive an initial daily credit grant. Previously, the profile popover would immediately show "We topped up your account to 2,000 credits since you were getting low", which is confusing for users who haven't spent any credits yet. Added a `dailyCreditGrantCount` field to the user endpoint that counts how many daily_credit ledger entries exist. The "topped up" message is now only shown when the count is greater than 1, meaning the daily cron has actually topped up the user after they spent credits. Fresh users with only the initial signup grant (count=1) will only see the "Last daily credits grant" line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a12c49e to
c551cba
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the / _user endpoint and host UI copy/logic so newly signed-up users don’t see the misleading “since you were getting low” daily top-up message unless a real post-usage top-up occurred.
Changes:
- Add
dailyCreditGrantCountto the/_userresponse, derived fromCOUNT(*)ofdaily_creditledger entries. - Update host UI messaging to only include “since you were getting low” when
dailyCreditGrantCount > 1. - Extend server and host acceptance tests to cover the new field and messaging behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/billing/billing-queries.ts | Replace single-timestamp query with combined “last grant + count” query for daily credits. |
| packages/realm-server/handlers/handle-fetch-user.ts | Include dailyCreditGrantCount in /_user response attributes. |
| packages/realm-server/tests/realm-endpoints/user-test.ts | Assert dailyCreditGrantCount across scenarios (no grants, one grant, multiple grants). |
| packages/realm-server/tests/server-endpoints/stripe-webhook-test.ts | Update expected /_user payload to include dailyCreditGrantCount. |
| packages/host/app/services/billing-service.ts | Parse and store dailyCreditGrantCount from /_user response. |
| packages/host/app/components/with-subscription-data.gts | Gate the “getting low” clause on dailyCreditGrantCount > 1. |
| packages/host/tests/acceptance/operator-mode-acceptance-test.gts | Add acceptance coverage for fresh user messaging (no “getting low” text). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
dailyCreditGrantCountfield to the/_userendpoint that counts how manydaily_creditledger entries exist for the userdailyCreditGrantCount > 1, meaning the daily cron has actually topped up the user after they spent credits and went below the thresholdCloses CS-10292
Test plan
🤖 Generated with Claude Code