Skip to content

[comp] Production Deploy#2754

Open
github-actions[bot] wants to merge 9 commits intoreleasefrom
main
Open

[comp] Production Deploy#2754
github-actions[bot] wants to merge 9 commits intoreleasefrom
main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 5, 2026

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

Expose per-product wallet credit balances in billing status and update pentest/background-check allowance logic to include them, preventing false paywalls when admin-granted credits exist. Add an organization access auto-approval API and move Stripe domain checks server-side; the upgrade page now uses it and keeps the self-hosted shortcut.

  • New Features

    • API: /v1/billing/status now returns aggregated creditBalances per product; BillingService uses an optional credits service and includes tests for aggregation and empty states.
    • App: pentest and background-check UIs compute allowance as subscription remainder + wallet credits via a new helper and updates to types/fixtures; emptyBillingStatus includes creditBalances.
    • API: added /v1/organization-access/auto-approve to grant org access based on self-hosted flag, @trycomp.ai email, or domain-matched active Stripe customer (via StripeService); includes domain utils and tests. App upgrade page now calls this endpoint, removes lib/stripe.ts and the app’s STRIPE_SECRET_KEY, and retains the self-hosted inline grant to avoid OSS regression.
  • Bug Fixes

    • Pentest page and background-check wizard no longer block when only wallet credits are available; balances match backend consumption.
    • Trust Portal: Switch/Status Select keep optimistic updates with rollback; toasts include server error details and errors are logged for ISO 27001, ISO 42001, GDPR, HIPAA, SOC 2 Type 1/2, SOC 3, PCI DSS, NEN 7510, and ISO 9001.

Written for commit 8247ed3. Summary will update on new commits.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app (staging) Ready Ready Preview, Comment May 5, 2026 9:17pm
comp-framework-editor (staging) Ready Ready Preview, Comment May 5, 2026 9:17pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal (staging) Skipped Skipped May 5, 2026 9:17pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

tofikwest and others added 3 commits May 5, 2026 13:03
The backend already falls back from Stripe subscription to the
BillingCreditBalance wallet when an active subscription is missing or
exhausted, but `/v1/billing/status` only returned subscription data.
Both the pentest page and the background-check wizard computed their
"available scans" balance from subscription remainder alone, so admin-
granted credits were invisible: the New Scan button rerouted to
billing even though the create endpoint would have happily consumed a
wallet credit. Now `getStatus` aggregates wallet balances per product
and the two UIs add them to the displayed allowance, mirroring the
backend's consumption decision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gating

fix(billing): surface wallet credits to pentest + bg-check UIs
The /upgrade page was instantiating its own Stripe client and writing
hasAccess directly to the DB from a Next.js server component. That meant
STRIPE_SECRET_KEY had to live on Vercel in addition to the API, the
hasAccess flip skipped the API's audit log + RBAC, and we had two
Stripe clients drifting apart over time.

Move both the Stripe lookup and the hasAccess write into a new API
endpoint:

  POST /v1/organization-access/auto-approve

guarded by HybridAuthGuard + PermissionGuard with
@RequirePermission('organization', 'update'). The endpoint reuses the
existing global StripeService — no second Stripe client. Decision
matrix preserved exactly: self-hosted, @trycomp.ai email, or
domain-matched active Stripe customer.

App side: upgrade page now calls serverApi instead of importing
@/lib/stripe and writing to db; lib/stripe.ts and the
STRIPE_SECRET_KEY env declaration are removed from the Next.js app.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tofikwest and others added 3 commits May 5, 2026 15:47
NEXT_PUBLIC_SELF_HOSTED is a Next.js build-time env that the OSS Docker
deployment sets on the app container only — there is no propagation to
the API container (the root docker-compose.yml ships only app + portal
services). Moving the entire auto-approval flow into the API would have
broken self-hosted/OSS deployments, since neither SELF_HOSTED nor
NEXT_PUBLIC_SELF_HOSTED is available there.

Restore the inline self-hosted branch on the upgrade page (preserves
original behavior bit-for-bit) and route only the Stripe-customer +
@trycomp.ai paths through the API. The single remaining DB write on the
page is gated on a build-time deploy flag, not user input — so the
"all mutations through the API" rule is preserved in spirit for every
user-facing decision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…to-api

refactor(stripe): move upgrade-page auto-approval into API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant