Skip to content

dev - #2309

Merged
johnyeocx merged 3 commits into
mainfrom
dev
Jul 20, 2026
Merged

dev#2309
johnyeocx merged 3 commits into
mainfrom
dev

Conversation

@johnyeocx

@johnyeocx johnyeocx commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary by cubic

License prices now always use the license plan’s Stripe Product (not the parent), removing ambiguity in back-sync and making attach/update customizations consistent.

  • Refactors
    • Route custom and shared license base prices to the license plan’s Stripe Product; back-sync selects by exact price within that product.
    • Simplified Stripe init by removing parent-product dependency and using plan-license-only helpers (planLicenseToCustomStripeInitProduct, planLicenseToStripeInitProduct).
    • Updated tests to assert the new contract and added an update-customization test.
    • Trigger build: generate stub workspace package.json files during image build to satisfy Bun, remove copying of workspace manifests, and replace additionalFiles with a custom image step using @trigger.dev instructions.

Written for commit d81a6ab. Summary will update on new commits.

Review in cubic

Greptile Summary

This PR changes the Stripe Product ownership model for customized license prices: previously, customized prices were created under the parent product's Stripe Product; they now live under the license product's own Stripe Product. The planLicenseToCustomStripeInitProduct / planLicenseToStripeInitProduct helpers drop the parentProduct parameter entirely, and trigger.config.ts replaces additionalFiles copies of real package.jsons with runtime-generated stubs.

  • [Bug fixes / Improvements] licenseStripeResourceUtils.ts — removed parentProduct coupling; customized prices now reference the license's own Stripe Product, which also removes the guard that silently suppressed custom prices when the parent had no processor.id.
  • [Improvements] initStripeResourcesForProducts.ts / initStripeResourcesForBillingPlan — call sites updated: parentProduct lookup and cusProductToProduct wrappers removed from license-transition handling, simplifying the billing plan initialisation path.
  • [Improvements] trigger.config.ts — workspace package.json stubs are now generated with printf in a single Dockerfile RUN layer rather than individually COPY-ing real manifests, reducing image layer count and avoiding stale dependency lists in the deploy image.

Confidence Score: 4/5

The core billing change is intentional and well-tested; the trigger.config.ts refactor is straightforward with only a minor printf format-string edge case unreachable with valid npm package names.

The billing ownership model change is structural but thoroughly covered by updated integration tests, and the removed null-guard was itself a correctness concern. No logic paths are left untested.

trigger.config.ts — the printf stub-generation command embeds JSON content directly as a format string.

Important Files Changed

Filename Overview
server/src/internal/billing/v2/providers/stripe/utils/common/licenseStripeResourceUtils.ts Removes parentProduct coupling from both helpers; customized prices now spread the license product's own processor/Stripe Product instead of inheriting the parent's.
server/src/internal/billing/v2/providers/stripe/utils/common/initStripeResourcesForProducts.ts Call sites updated to match the new signatures; redundant parentCustomerProduct lookup removed from the license-transition loop.
trigger.config.ts Replaces additionalFiles copies of workspace package.json with runtime-generated stubs. The printf format string is passed without a %s guard.
server/tests/integration/billing/stripe-webhooks/subscription-created/licenses/sub-created-parent-product-license-backsync.test.ts Test contracts updated: same license product now yields the same Stripe Product ID across parent variants.
server/tests/integration/licenses/billing/attach/attach-license-parent-stripe-product.test.ts Adds a new update-subscription test; both tests assert license Stripe Product is used and differs from the parent's.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
trigger.config.ts:43-46
`printf` treats its first argument as a format string, so any `%` character in `contents` would be misinterpreted as a format specifier. While npm package names cannot contain `%`, using `printf '%s'` with the content as a separate argument is the defensive idiom that avoids the risk entirely.

Reviews (1): Last reviewed commit: "Merge branch 'main' into dev" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@johnyeocx
johnyeocx requested a review from ay-rod as a code owner July 20, 2026 15:22
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
checkout Ignored Ignored Jul 20, 2026 3:22pm
landing-page Ignored Ignored Jul 20, 2026 3:22pm

Request Review

@capy-ai

capy-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@vercel
vercel Bot temporarily deployed to staging – autumn-vite July 20, 2026 15:22 Inactive
@mcp-use

mcp-use Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deployment #731 deployment failed

StatusLogsURLURLUpdated
FailedBuild Logs | Runtime Logs🔗 ProductionN/AJul 20 2026 3:22 pm

View deployment details


Deployed on Manufact.com

Comment thread trigger.config.ts
Comment on lines +43 to +46
return {
dir,
contents: JSON.stringify({ name: packageJson.name, private: true }),
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 printf treats its first argument as a format string, so any % character in contents would be misinterpreted as a format specifier. While npm package names cannot contain %, using printf '%s' with the content as a separate argument is the defensive idiom that avoids the risk entirely.

Prompt To Fix With AI
This is a comment left during a code review.
Path: trigger.config.ts
Line: 43-46

Comment:
`printf` treats its first argument as a format string, so any `%` character in `contents` would be misinterpreted as a format specifier. While npm package names cannot contain `%`, using `printf '%s'` with the content as a separate argument is the defensive idiom that avoids the risk entirely.

How can I resolve this? If you propose a fix, please make it concise.

@johnyeocx
johnyeocx merged commit a674240 into main Jul 20, 2026
20 of 22 checks passed
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