Conversation
Add license parent preview and propagation controls, preserve customer configurations across catalog updates, and organize core license catalog coverage.
Mock the license-reference collaborators added to product item updates so existing atomicity and lock tests exercise their intended paths.
…ement-ids fix(catalog): variant customize inherits base plan entitlement ids
Disable lazy dashboard migration runs
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. |
feat(licenses): add scalable license transitions
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
Deployment #729 deployment failed
Deployed on Manufact.com |
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.
Summary by cubic
Adds scalable, batched license transitions and cycle alignment to support large pool updates without timeouts, plus parent→child license propagation that preserves customizations in catalog updates. Also fixes variant customize row-ID collisions by stripping base-plan row IDs and disables lazy migration runs so dashboard-triggered runs execute immediately.
New Features
batch-transitiontask with timeouts, concurrency, and safety limits.subscription_ids.updateCatalog; dependency sorting simplified.Bug Fixes
subscription_idsin sync when adding/removing Stripe subscriptions across updated customer products.Written for commit f4f3575. Summary will update on new commits.
Greptile Summary
This PR ships two independent fixes from the dev branch: a server-side bug fix that prevents duplicate-key DB errors when catalog variants inherit unchanged base plan rows, and a migration UI simplification that permanently disables lazy execution.
stripPlanRowIdsstripsentitlement_idandprice_idfrom a base plan's price and items before it seeds a variant, preventingduplicate key ... "entitlements_id_key"constraint violations oncatalog.update. Both the write path (updateVariants) and the preview path (previewAffectedVariants) are patched, and a new integration test covers the idempotent re-push case that originally surfaced the bug.buildRunMigrationRequestis extracted as a pure, testable function that hard-codeslazy_run: false, and the "Lazy run" admin toggle is removed fromMigrationLiveView. Previously, full (non-targeted) migration runs defaulted tolazy_run: true; they now always run eagerly.Confidence Score: 5/5
Safe to merge — both changes are tightly scoped bug fixes with accompanying tests, and the lazy-run removal is an intentional product decision reflected consistently across the server, hook, and UI layers.
The stripPlanRowIds fix is straightforward and correctly applied in both the write and preview paths; the integration test covers the original crash scenario and its idempotent re-push variant. The lazy_run: false hardcoding and UI removal are consistent with each other and with the new unit tests. No logic gaps or unintended side effects were found.
No files require special attention.
Important Files Changed
stripPlanRowIdshelper that removesentitlement_idandprice_idfrom a plan's price and items before seeding a variant, fixing a duplicate-key DB constraint.stripPlanRowIdstoincomingBasePlanbefore building the variant target plan, preventing entitlement/price row ID collisions on upsert.stripPlanRowIdsto the edited base plan before computing the variant preview, consistent with the fix in updateVariants.lazy_run: falseand defaulting targeted runs toretry_item_statuses: ["failed"].buildRunMigrationRequest; removes thelazyRunparameter fromtriggerRun, permanently disabling lazy execution.lazy_run: falseinbuildRunMigrationRequest.buildRunMigrationRequestcovering the base case and targeted-run retry-status defaulting; confirmslazy_runis always false.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Caller participant updateVariants participant stripPlanRowIds participant applyDiffToVariantPlan participant DB Caller->>updateVariants: catalog.update(params) updateVariants->>updateVariants: fetch incomingBasePlan (has entitlement_id / price_id) updateVariants->>stripPlanRowIds: "stripPlanRowIds({ plan: incomingBasePlan })" stripPlanRowIds-->>updateVariants: plan without entitlement_id / price_id updateVariants->>applyDiffToVariantPlan: "applyDiffToVariantPlan({ plan: stripped, diff })" applyDiffToVariantPlan-->>updateVariants: variantTargetPlan (no conflicting row ids) updateVariants->>DB: "upsert variant entitlements & prices (mints new ids)" DB-->>updateVariants: success (no duplicate key error)%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Caller participant updateVariants participant stripPlanRowIds participant applyDiffToVariantPlan participant DB Caller->>updateVariants: catalog.update(params) updateVariants->>updateVariants: fetch incomingBasePlan (has entitlement_id / price_id) updateVariants->>stripPlanRowIds: "stripPlanRowIds({ plan: incomingBasePlan })" stripPlanRowIds-->>updateVariants: plan without entitlement_id / price_id updateVariants->>applyDiffToVariantPlan: "applyDiffToVariantPlan({ plan: stripped, diff })" applyDiffToVariantPlan-->>updateVariants: variantTargetPlan (no conflicting row ids) updateVariants->>DB: "upsert variant entitlements & prices (mints new ids)" DB-->>updateVariants: success (no duplicate key error)Reviews (1): Last reviewed commit: "Merge pull request #2302 from useautumn/..." | Re-trigger Greptile