refactor(kilo-pass): inline promo eligibility into getState to reduce DB calls#1491
Merged
markijbema merged 2 commits intomainfrom Mar 24, 2026
Merged
Conversation
… DB calls Include isEligibleForFirstMonthPromo in the getState response and remove the separate getFirstMonthPromoEligibility tRPC procedure. This eliminates one redundant getKiloPassStateForUser DB call per profile page load for users without an active subscription.
Contributor
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)No inline-commentable issues found in diff hunks. Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (7 files)
Reviewed by gpt-5.4-20260305 · 657,106 tokens |
iscekic
approved these changes
Mar 24, 2026
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
kiloPass.getStateresponse by addingisEligibleForFirstMonthPromotoGetStateOutputSchema, eliminating the need for a separategetFirstMonthPromoEligibilitytRPC procedure and its redundantgetKiloPassStateForUserDB query.getFirstMonthPromoEligibilityprocedure entirely and updateProfileKiloPassSectionto read promo eligibility directly fromgetStatedata.getKiloPassStateForUserDB calls on the profile page from 2 to 1 for users without an active subscription.Verification
pnpm typecheck— passespnpm jest -- src/routers/kilo-pass-router.test.ts— 35/35 tests pass, including 2 new tests forisEligibleForFirstMonthPromo(eligible when no subscriptions, ineligible when canceled subscription exists)Visual Changes
N/A
Reviewer Notes
isEligibleForFirstMonthPromofield is placed at the top level of thegetStateresponse (alongsidesubscription) so it's available even whensubscriptionisnull.truewhengetKiloPassStateForUserreturnsnull(no subscription rows at all),falseotherwise (including canceled/ended subscriptions). This matches the priorgetFirstMonthPromoEligibilitybehavior exactly.