Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughUpdates Prisma transaction options to add maxWait, introduces a test-mode bypass path in CheckoutForm and wires it from the purchase page, changes payments.testMode default to true, and adjusts e2e tests/configs to reflect test mode behavior and payloads. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant P as Purchase Page (page-client)
participant CF as CheckoutForm
participant S as Stripe/PaymentElement
participant B as Bypass Handler
U->>P: Open purchase page
P->>CF: Render with props (may include onTestModeBypass)
alt Test mode bypass provided
CF->>U: Show test-mode notice + "Complete test purchase"
U-->>CF: Click bypass
CF->>B: onTestModeBypass()
B-->>CF: Resolve
CF-->>P: Completion callback/refresh
else Normal checkout
CF->>S: Mount PaymentElement
U-->>CF: Submit payment
CF->>S: confirmPayment(...)
S-->>CF: Result (success/error)
CF-->>P: Propagate result
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.test.{ts,tsx,js}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance. |
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on 0ac2b00..c69dc14
| Severity | Location | Issue | Delete |
|---|---|---|---|
| apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx:285 | Undefined prop passed to component | ||
| apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx:287 | Undefined prop passed to component | ||
| apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx:286 | Payment form never renders |
✅ Files analyzed, no issues (3)
• apps/backend/src/auto-migrations/index.tsx
• apps/dashboard/src/components/payments/checkout.tsx
• packages/stack-shared/src/config/schema.ts
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/backend/src/auto-migrations/index.tsx(1 hunks)apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx(2 hunks)apps/dashboard/src/components/payments/checkout.tsx(3 hunks)packages/stack-shared/src/config/schema.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer ES6 Map over Record when representing key–value collections
Files:
packages/stack-shared/src/config/schema.tsapps/dashboard/src/components/payments/checkout.tsxapps/backend/src/auto-migrations/index.tsxapps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
For blocking alerts and errors in UI, do not use toast notifications; use alerts instead
Files:
apps/dashboard/src/components/payments/checkout.tsxapps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Keep hover/click animations snappy; avoid pre-transition delays on hover and apply transitions after the action (e.g., fade-out on hover end)
Files:
apps/dashboard/src/components/payments/checkout.tsxapps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
🧬 Code graph analysis (1)
apps/dashboard/src/components/payments/checkout.tsx (1)
packages/stack-ui/src/components/ui/typography.tsx (1)
Typography(46-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: docker
- GitHub Check: all-good
- GitHub Check: Vercel Agent Review
- GitHub Check: check_prisma_migrations (22.x)
- GitHub Check: lint_and_build (latest)
- GitHub Check: build (22.x)
- GitHub Check: build (22.x)
- GitHub Check: docker
- GitHub Check: restart-dev-and-test
- GitHub Check: setup-tests
- GitHub Check: Security Check
🔇 Additional comments (2)
packages/stack-shared/src/config/schema.ts (1)
539-539: Approve safer default for payments.testMode Defaulting to true prevents accidental real charges when unset; no code assumes false as default.apps/backend/src/auto-migrations/index.tsx (1)
189-192: LGTM!The addition of
maxWait: 30_000is a sensible operational improvement that increases resilience during connection pool contention, especially in CI environments where multiple workers may race to apply migrations. The comment clearly explains the rationale.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx (1)
284-284: Add !selectedPriceId to the disabled condition.The
disabledprop should include!selectedPriceIdto prevent checkout when no price is selected. Without this check, users could potentially trigger payment or test mode bypass without a price, causing backend errors.Apply this diff:
- disabled={quantityNumber < 1 || isTooLarge || data.already_bought_non_stackable === true} + disabled={quantityNumber < 1 || isTooLarge || data.already_bought_non_stackable === true || !selectedPriceId}
🧹 Nitpick comments (1)
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx (1)
123-126: Add defensive null check for selectedPriceId.Although
selectedPriceIdis initialized when data loads, adding a null check provides defense-in-depth and prevents potential issues if the product has no prices.Apply this diff:
const handleBypass = useCallback(async () => { - if (quantityNumber < 1 || isTooLarge) { + if (!selectedPriceId || quantityNumber < 1 || isTooLarge) { return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
For blocking alerts and errors in UI, do not use toast notifications; use alerts instead
Files:
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer ES6 Map over Record when representing key–value collections
Files:
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Keep hover/click animations snappy; avoid pre-transition delays on hover and apply transitions after the action (e.g., fade-out on hover end)
Files:
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: build (22.x)
- GitHub Check: build (22.x)
- GitHub Check: restart-dev-and-test
- GitHub Check: lint_and_build (latest)
- GitHub Check: docker
- GitHub Check: all-good
- GitHub Check: setup-tests
- GitHub Check: Security Check
🔇 Additional comments (1)
apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx (1)
285-285: Conditional onTestModeBypass logic is correct.The conditional
data.test_mode ? handleBypass : undefinedensures that the test mode bypass is only available when test mode is enabled, addressing the critical issue raised in past review comments.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/e2e/tests/backend/backend-helpers.ts(1 hunks)apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--validate-code.test.ts(1 hunks)apps/e2e/tests/backend/endpoints/api/v1/payments/validate-code.test.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.test.{ts,tsx,js}
📄 CodeRabbit inference engine (AGENTS.md)
In tests, prefer .toMatchInlineSnapshot where possible; refer to snapshot-serializer.ts for snapshot formatting and handling of non-deterministic values
Files:
apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--validate-code.test.tsapps/e2e/tests/backend/endpoints/api/v1/payments/validate-code.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer ES6 Map over Record when representing key–value collections
Files:
apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--validate-code.test.tsapps/e2e/tests/backend/backend-helpers.tsapps/e2e/tests/backend/endpoints/api/v1/payments/validate-code.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: all-good
- GitHub Check: setup-tests
- GitHub Check: Vercel Agent Review
- GitHub Check: restart-dev-and-test
- GitHub Check: build (22.x)
- GitHub Check: build (22.x)
- GitHub Check: check_prisma_migrations (22.x)
- GitHub Check: docker
- GitHub Check: docker
- GitHub Check: lint_and_build (latest)
- GitHub Check: Security Check
🔇 Additional comments (2)
apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--validate-code.test.ts (1)
60-60: LGTM!The test expectation correctly reflects the new default
payments.testMode: truesetting.apps/e2e/tests/backend/endpoints/api/v1/payments/validate-code.test.ts (1)
60-60: LGTM!Both test expectations correctly updated to reflect the new
payments.testMode: truedefault.Also applies to: 330-330
|
Some new issue(s) might be present. Please use the following link(s) to view them: https://zeropath.com/app/issues/f3606a04-82f4-4312-ba84-01a2dcdd5a85 Reply to this PR with |
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR fixes payment test mode behavior by changing the default test mode setting to `true` and refactoring the test mode bypass UI. The bypass functionality is moved from a floating card in the purchase page into the checkout form itself, providing a cleaner and more integrated experience. Additionally, the database migration configuration is updated to increase the `maxWait` timeout to handle concurrent migration attempts more gracefully in high-contention scenarios like CI environments. ⏱️ Estimated Review Time: 5-15 minutes <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `packages/stack-shared/src/config/schema.ts` | | 2 | `apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx` | | 3 | `apps/dashboard/src/components/payments/checkout.tsx` | | 4 | `apps/backend/src/auto-migrations/index.tsx` | </details> <details> <summary>⚠️ Inconsistent Changes Detected</summary> | File Path | Warning | |-----------|---------| | `apps/backend/src/auto-migrations/index.tsx` | Database migration timeout configuration changes appear unrelated to payment test mode fixes, which is the stated purpose of this PR | </details> [](https://discord.gg/n3SsVDAW6U) [](https://squash-322339097191.europe-west3.run.app/interactive/564b2cf6ef5a9aad7d43da76d2f9e14e8521bc4d3e7d31e2eb13fcd8dce00e43/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=957) <!-- RECURSEML_SUMMARY:END --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Sets payment test mode to default true, integrates test mode bypass into checkout form, and updates migration timeout. > > - **Behavior**: > - Default `testMode` set to `true` in `schema.ts`. > - Integrates test mode bypass into `CheckoutForm` in `checkout.tsx`. > - Removes separate bypass panel from `page-client.tsx`. > - **Database**: > - Increases `maxWait` timeout in `index.tsx` to handle concurrent migration attempts. > - **Tests**: > - Updates tests in `backend-helpers.ts` and `validate-code.test.ts` to reflect test mode behavior. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for 6313c0b. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> ---- <!-- ELLIPSIS_HIDDEN --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a test-mode checkout path with a “Complete test purchase” action when test mode is active. * **Refactor** * Consolidated test-mode bypass into the checkout component and removed the separate bypass UI. * **Bug Fixes** * Improved reliability of database migrations by extending the transaction wait window, reducing timeout errors under load. * **Chores** * Payments now default to test mode enabled. * **Tests** * Updated tests and payload expectations to reflect test mode defaults and behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
High-level PR Summary
This PR fixes payment test mode behavior by changing the default test mode setting to
trueand refactoring the test mode bypass UI. The bypass functionality is moved from a floating card in the purchase page into the checkout form itself, providing a cleaner and more integrated experience. Additionally, the database migration configuration is updated to increase themaxWaittimeout to handle concurrent migration attempts more gracefully in high-contention scenarios like CI environments.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
packages/stack-shared/src/config/schema.tsapps/dashboard/src/app/(main)/purchase/[code]/page-client.tsxapps/dashboard/src/components/payments/checkout.tsxapps/backend/src/auto-migrations/index.tsxapps/backend/src/auto-migrations/index.tsxImportant
Sets payment test mode to default true, integrates test mode bypass into checkout form, and updates migration timeout.
testModeset totrueinschema.ts.CheckoutFormincheckout.tsx.page-client.tsx.maxWaittimeout inindex.tsxto handle concurrent migration attempts.backend-helpers.tsandvalidate-code.test.tsto reflect test mode behavior.This description was created by
for 6313c0b. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit