feat(dev): add credits dev tool on /profile - #5389
Open
IamCoder18 wants to merge 1 commit into
Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the three-file dev-only Add Credits tool on Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 78K · Output: 8K · Cached: 321.9K Review guidance: REVIEW.md from base branch |
Contributor
Author
|
Ready for review! |
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 a companion "Add Credits" dev tool on
/profile, mirroring the existing "Consume Credits" tool so devs can grant themselves credits without a real Stripe purchase or admin grant.Changes:
apps/web/src/app/api/dev/add-credits/route.ts(new) — dev-only POST that inserts acredit_transactionsrow (credit_category: 'dev-tools',is_free: true) and incrementskilocode_users.total_microdollars_acquired, then callsforceImmediateExpirationRecomputationto bust the balance cache. Mirrors the auth/guard pattern inapps/web/src/app/api/dev/consume-credits/route.tsand the write pattern inapps/web/src/lib/promotionalCredits.ts:175-224, but bypassespromoCreditCategoriesByKeysince this is not a real campaign.apps/web/src/components/dev/DevAddCreditsButton.tsx(new) — mirrorsDevConsumeCreditsButton.tsx: amount input + Add button,router.refresh()on success, dev-mode guard.apps/web/src/app/(app)/profile/page.tsx— adds an "Add Credits" section above "Consume Credits" in the existing Development Tools card.No DB migration. No new env vars. No changes outside
apps/web/src/app/api/dev,apps/web/src/components/dev, and the/profilepage.Verification
Visited
/profile, entered an amount in the new "Add Credits" section, and submitted. Verifiedtotal_microdollars_acquiredincreases and the profile balance counter refreshes.Ran
pnpm -w exec oxlint --config .oxlintrc.jsonon the changed files — 0 warnings, 0 errors.Visual Changes
Reviewer Notes
process.env.NODE_ENV === 'development', same as the siblingconsume-creditsroute, so it is unreachable in production.credit_categoryliteral'dev-tools'is intentionally not registered inpromoCreditCategoriesByKey, keeping it isolated from real campaigns.