Skip to content

improvement(admin): remove included usage for enterprise provisioning#5749

Merged
icecrasher321 merged 1 commit into
stagingfrom
improvement/admin-pan
Jul 17, 2026
Merged

improvement(admin): remove included usage for enterprise provisioning#5749
icecrasher321 merged 1 commit into
stagingfrom
improvement/admin-pan

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Remove included usage from enterprise plan creation admin panel.

Type of Change

  • Other: UX Improvement

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 17, 2026 9:48pm

Request Review

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes commercial terms for new enterprise issuances and alters provisioning dedupe keys; existing org limit edits via PATCH are untouched in this diff.

Overview
Admin enterprise issuance no longer accepts a separate includedMonthlyDollars field. Included monthly usage is now always derived from monthlyInvoiceAmountUsd via dollarsToCredits, while optional usageLimitDollars still maps to credits on the API route.

Provisioning logic (issueEnterpriseProvisioning, request-key building, and outbox payloads) drops includedMonthlyCredits from input and computes it from the invoice amount. Default usage limit when omitted is that same derived included amount. Deduplication keys change for new requests because included credits in the key follow invoice dollars, not a caller-supplied allowance.

Contract and billing tests were updated to match the slimmer request body.

Reviewed by Cursor Bugbot for commit 077e9ee. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR derives enterprise included usage from the monthly invoice amount. The main changes are:

  • Removes included usage from the admin provisioning request.
  • Derives included credits and the default usage limit internally.
  • Updates request-key serialization and related tests.

Confidence Score: 4/5

Legacy provisioning requests can be rejected or applied with different billing terms during rollout.

  • Existing unresolved operations can produce a different idempotency key after deployment.
  • Older clients can have their included-usage input stripped while the request still succeeds.
  • New requests use the derived value consistently across serialization and persistence.

apps/sim/lib/billing/enterprise-provisioning.ts and apps/sim/lib/api/contracts/v1/admin/dashboard.ts

Important Files Changed

Filename Overview
apps/sim/lib/billing/enterprise-provisioning.ts Derives included credits consistently, but changes the meaning of the existing idempotency-key format.
apps/sim/app/api/v1/admin/dashboard/enterprise-provisioning/route.ts Stops converting a caller-provided included amount and forwards only the optional usage limit.
apps/sim/lib/api/contracts/v1/admin/dashboard.ts Removes included usage from the request schema, allowing older clients' field to be stripped.
apps/sim/lib/billing/enterprise-provisioning.test.ts Updates serialization expectations for derived usage but does not cover legacy unresolved operations.
apps/sim/lib/api/contracts/v1/admin/dashboard.test.ts Updates request fixtures to omit the removed included-usage field.

Reviews (1): Last reviewed commit: "improvement(admin): remove included usag..." | Re-trigger Greptile

Comment thread apps/sim/lib/billing/enterprise-provisioning.ts
Comment thread apps/sim/lib/api/contracts/v1/admin/dashboard.ts
@icecrasher321
icecrasher321 merged commit d637cba into staging Jul 17, 2026
21 checks passed
@icecrasher321
icecrasher321 deleted the improvement/admin-pan branch July 17, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant