feat: refactor UI to use coss + coupons UI#27647
Merged
sean-brydon merged 3 commits intomainfrom Feb 5, 2026
Merged
Conversation
Paragon: tests updated2 new tests generated for this PR. New Tests
DetailsNew Tests
|
Contributor
There was a problem hiding this comment.
4 issues found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts:56">
P2: Use `TRPCError` instead of plain `Error` for consistent TRPC error handling. This follows the pattern used in other admin handlers (e.g., `setSMSLockState.handler.ts`).
(Based on your team's feedback about throwing TRPCError with code UNAUTHORIZED for access-denied cases.) [FEEDBACK_USED]</violation>
<violation number="2" location="packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts:60">
P1: Rule violated: **Avoid Logging Sensitive Information**
Avoid logging the user’s username when denying access; usernames are sensitive identifiers and should not be written to logs.</violation>
<violation number="3" location="packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts:71">
P2: Use `TRPCError` with appropriate code (e.g., `BAD_REQUEST`) for API failure errors to maintain consistent TRPC error handling.</violation>
</file>
<file name="packages/trpc/server/routers/viewer/admin/createCoupon.schema.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/admin/createCoupon.schema.ts:12">
P2: When `discountType` is `"percent"`, validation should cap `discountAmount` at 100. Right now any integer >= 1 is accepted, which allows invalid percentage discounts.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts
Outdated
Show resolved
Hide resolved
packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts
Outdated
Show resolved
Hide resolved
packages/trpc/server/routers/viewer/admin/createCoupon.handler.ts
Outdated
Show resolved
Hide resolved
Contributor
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
- Replace plain Error with TRPCError for consistent tRPC error handling - Use INTERNAL_SERVER_ERROR for missing env configuration - Use UNAUTHORIZED for permission denied errors - Use BAD_REQUEST for API failure errors - Remove console.warn that logged username (sensitive info) Co-Authored-By: unknown <>
eunjae-lee
approved these changes
Feb 5, 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.


What does this PR do?
Demo: https://www.loom.com/share/85031561f7f04cae9505b839c6d7e76d
This requires https://github.com/calcom/private-api/pull/62 to be merged first
Refactors the create license key UI to be coss-ui and implements the ability to create coupons for a user so they can use them directly in their license key creation
Updates since last revision
createCoupon.handler.tsto useTRPCErrorinstead of plainErrorfor consistent tRPC error handlingINTERNAL_SERVER_ERRORfor missing config,UNAUTHORIZEDfor permission denied,BAD_REQUESTfor API failuresMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Human Review Checklist
TRPCErrorcodes are appropriate for each error case