[comp] Production Deploy#2736
Merged
carhartlewis merged 32 commits intoreleasefrom May 1, 2026
Merged
Conversation
…e management - Added functions to find or create a billing customer in Stripe and list billing invoices. - Introduced validation for redirect URLs in billing processes. - Updated BackgroundCheckBillingService to utilize new billing customer and invoice functionalities. - Enhanced BackgroundCheckPaymentService to handle invoice creation and payment processing. - Created BillingInvoicesTable component for displaying invoices in the UI. - Updated tests to cover new billing features and ensure proper functionality.
- Refactored the layout of the BillingInvoicesTable component to improve responsiveness. - Changed Stack component to a div with flex properties for better alignment on larger screens. - Adjusted width properties for the search input to enhance UI consistency.
…L validation - Introduced unit tests for the findOrCreateBackgroundCheckBillingCustomer function to ensure proper handling of concurrent requests and Stripe customer updates. - Added tests for validateBackgroundCheckBillingRedirectUrl to validate app URL configurations and handle malformed URLs. - Enhanced BackgroundCheckPaymentService tests to cover invoice voiding scenarios when invoice item creation or finalization fails.
…services - Added the @trycompai/billing package to the workspace and integrated it into the API. - Updated BackgroundCheckPaymentService to utilize the new BillingEntitlementsService for managing billing entitlements and usage. - Refactored background check billing logic to improve invoice handling and payment processing. - Introduced new billing-related endpoints and services, including billing customer management and usage tracking. - Enhanced tests for billing functionalities to ensure robust coverage of new features.
… lewis/comp-stripe-overhaul
- Updated BackgroundCheckBillingService to utilize resolveBillingCatalogEnvironment for improved SKU resolution. - Refactored BackgroundCheckPaymentService to streamline payment processing and error handling. - Introduced new billing setup session management with createBillingSetupSession and handleBillingSetupSuccess functions. - Enhanced BillingService to support subscription plan changes and trial eligibility checks. - Added new billing-related utility functions for managing subscriptions and usage tracking. - Updated tests to cover new billing functionalities and ensure robust integration with Stripe.
- Added "allowImportingTsExtensions" option to tsconfig.json for improved module resolution. - Updated import statement in index.ts to include the .ts extension for sku-definitions.
- Changed import statement in index.ts to use .js extension for sku-definitions. - Added sku-definitions.js to export createSkus from sku-definitions.ts.
- Implemented proxy handling for billing add-ons in the proxy.ts file. - Enhanced BillingAddOnsOverview component to display trial eligibility badges and messages. - Updated BillingSettingsClient to pass trial eligibility data. - Created a new catch-all page for billing add-ons to handle dynamic routing. - Added layout component for billing add-ons section. - Updated tests to cover new billing add-ons features and trial eligibility scenarios.
- Added AdminBillingActionsService to handle subscription management, including cancellation, resumption, and credit granting. - Created AdminBillingController to expose billing endpoints for managing organization billing preferences and subscriptions. - Introduced DTOs for billing actions to validate incoming requests. - Implemented billing audit logging for actions performed by admins. - Enhanced billing data fetching and context management for organizations.
- Added `tsup` as a dev dependency for building the billing package. - Updated billing package.json to include proper exports for module types. - Modified buildspec.yml and Dockerfile to include billing package in the build process.
…rhaul # Conflicts: # apps/app/src/app/(app)/[orgId]/admin/organizations/[adminOrgId]/components/AdminOrgTabs.tsx # apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/EmployeeBackgroundCheck.test.tsx # apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/EmployeeBackgroundCheck.tsx
[dev] [carhartlewis] lewis/comp-stripe-overhaul
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
5 added, 0 updated, 0 removed. Total: 574 / 9 categories. Added: airbrake, logz-io, monday-com, octopus-deploy, snipe-it Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
10 issues found across 131 files
Confidence score: 2/5
- Several high-confidence billing-path issues are user-impacting (idempotency collisions and stale usage selection), so merge risk is elevated rather than routine.
- The most severe concern is in
apps/api/src/billing/billing-customer.ts: a per-org idempotency key combined with variableemailcan trigger Stripe idempotency errors under concurrent requests. - There are additional runtime/behavior risks in
apps/api/src/billing/billing-entitlements.service.ts(missing@Optional()for DI),apps/api/src/admin-organizations/admin-audit-log.interceptor.ts(overbroad context parsing), andapps/api/src/billing/billing-webhook.service.ts(original errors can be swallowed). - Pay close attention to
apps/api/src/billing/billing-customer.ts,apps/api/src/billing/billing-usage.ts,apps/api/src/billing/billing-webhook.service.ts- these affect billing correctness, Stripe interaction reliability, and error visibility.
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed. cubic prioritises the most important files to review.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/app/src/app/(app)/[orgId]/settings/billing/billingPreferencesFormSchema.ts">
<violation number="1" location="apps/app/src/app/(app)/[orgId]/settings/billing/billingPreferencesFormSchema.ts:17">
P2: `getCountryLabel` uppercases input, but the `No country` option is stored as lowercase `none`, so `getCountryLabel('none')` returns `NONE` instead of the expected label.</violation>
</file>
<file name="apps/api/src/billing/billing-usage.ts">
<violation number="1" location="apps/api/src/billing/billing-usage.ts:70">
P2: `Map` construction here can select an older usage event per source instead of the latest one, causing stale billing type/SKU in usage rows.</violation>
</file>
<file name="apps/api/src/billing/billing-entitlements.service.ts">
<violation number="1" location="apps/api/src/billing/billing-entitlements.service.ts:21">
P2: Missing `@Optional()` decorator on the `credits` constructor parameter. NestJS DI ignores TypeScript's `?` — without `@Optional()`, this dependency is treated as required at runtime. The null-checks on `this.credits` elsewhere in the class will be dead code unless the decorator is added.</violation>
</file>
<file name="apps/api/src/admin-organizations/admin-audit-log.interceptor.ts">
<violation number="1" location="apps/api/src/admin-organizations/admin-audit-log.interceptor.ts:160">
P2: This condition is too broad and unintentionally changes `context` audit parsing. It should only apply to `billing`; otherwise `context` entries get `entityId = orgId` and lose correct entity-name resolution.</violation>
</file>
<file name="apps/api/src/billing/billing-webhook.service.ts">
<violation number="1" location="apps/api/src/billing/billing-webhook.service.ts:58">
P2: If `markStripeWebhookFailed` throws (e.g., DB is down), the original processing error is swallowed. Wrap the failure-recording call so the original error is always re-thrown.</violation>
</file>
<file name="apps/api/src/billing/billing-subscription-plans.ts">
<violation number="1" location="apps/api/src/billing/billing-subscription-plans.ts:101">
P2: Idempotency key lacks a temporal or sequence component, so an upgrade→downgrade→upgrade cycle within 24 hours would hit Stripe's cached response and silently skip the second upgrade. Consider including a timestamp, sequence counter, or the current `skuKey` being changed *from* in the key.</violation>
</file>
<file name="apps/api/src/billing/billing-credits.types.ts">
<violation number="1" location="apps/api/src/billing/billing-credits.types.ts:31">
P2: `eventType` is typed as `string` instead of the local `BillingCreditEventType` union, which weakens type safety for credit event payloads.</violation>
</file>
<file name="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/BackgroundCheckDetailsForm.tsx">
<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/BackgroundCheckDetailsForm.tsx:110">
P2: Use `next/link` instead of a plain `<a>` for this internal billing route to avoid full page reload navigation.</violation>
</file>
<file name="apps/api/src/billing/billing-customer.ts">
<violation number="1" location="apps/api/src/billing/billing-customer.ts:25">
P1: Using a per-organization idempotency key with a variable `email` field can trigger Stripe idempotency errors on concurrent calls with different `customerEmail` values.</violation>
</file>
<file name="apps/api/src/admin-organizations/admin-billing.service.ts">
<violation number="1" location="apps/api/src/admin-organizations/admin-billing.service.ts:233">
P2: Missing audit log for the checkout-session path. When `'changed' in result` is true (subscription created immediately), the method returns without calling `writeBillingAudit`, so the admin action goes untracked. Consider writing the audit entry before the early return in this branch.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
chore(integrations-catalog): refresh 2026-05-01 round 4
…ling - Updated AdminBillingService to write an audit event when an admin sets a subscription. - Enhanced billing webhook error handling to preserve processing errors. - Added a new function to assert valid credit event types. - Refactored usage event handling to ensure the newest event is used for each source resource. - Improved the BackgroundCheckDetailsForm to use Link component for navigation. - Minor adjustments to billing preferences schema and other related files for consistency.
[dev] [carhartlewis] lewis/comp-stripe-overhaul-fix
Contributor
|
🎉 This PR is included in version 3.42.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.
Summary by cubic
Launches the Stripe-backed billing platform using a SKU-first catalog via
@trycompai/billing, with admin/customer UIs, entitlement gating, secure webhooks, and add‑ons/trial support. Also refreshes the integrations catalog and adds billing audit logging with more robust webhook processing.New Features
BillingModulewith subscriptions, entitlements, credits, invoices, preferences, and webhook at/v1/billing/webhook(raw‑body enabled) with idempotent event store and better error preservation; usage ledger now favors the newest event.@trycompai/billing; build includespackages/billing.Migration
/v1/billing/webhook.NEXT_PUBLIC_APP_URL/APP_URL(orBETTER_AUTH_URL) to a valid HTTPS origin; only localhost may use HTTP.packages/billing(Dockerfile/buildspec updated).Written for commit 40180c8. Summary will update on new commits.