fix(licenses): show currency edits in plan previews - #2301
Open
charlietlamb wants to merge 2 commits into
Open
Conversation
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. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
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
Verification
The integration regression is included; its local run is blocked during setup by an invalid test secret before reaching the assertion.
Summary by cubic
Show currency changes in license plan previews and in the dashboard diff, and allow currency-only customizations to flow through the dashboard and API. Fixes missing visibility for added/removed
additional_currencieson prices and item tiers.additional_currencieschanges indiffPlanV1(base price and item tiers) viaincludeCurrencyListChanges.Written for commit f69c2f0. Summary will update on new commits.
Greptile Summary
This PR fixes the plan preview system to surface catalog currency additions and removals as visible changes, in addition to price-amount edits it already tracked. The core mechanism is a new
includeCurrencyListChangesflag ondiffPlanV1that layers a strictadditionalCurrencyListsEqualcheck on top of the existing migration-compatibleadditionalCurrenciesCompatiblecomparison, so callers that need a full diff can opt in without affecting snapshot-comparison paths used for migrations.additionalCurrencyListsEqualanditemCurrencyListsEqualhelpers and wire them into all preview/diff call sites (diffPlanV1PreviewFields,getPlanResponse,buildPlanUpdatePreview,diffLicensePlanCustomize,productToLicenseCustomize) via the new opt-in flag.customizePlanV1DiffsEqual(used invariantCustomizeChanged) to also require full currency-list equality, so a currency-only change on a variant's customize no longer silently passes as "unchanged".Confidence Score: 5/5
Safe to merge. The change is additive — a new opt-in flag threads through all preview and customize-diff call sites, leaving migration-snapshot comparisons untouched.
All changed paths opt in to the stricter additionalCurrencyListsEqual check, and the pre-existing additionalCurrenciesCompatible logic used by migration snapshot comparisons is left intact. The customizePlanV1DiffsEqual update correctly expands variant-change detection. Unit tests cover the new currency-detection paths end-to-end; the integration test addition is structurally sound even though its local run is gated by a test-secret issue unrelated to the logic.
No files require special attention. The integration test in preview-parent-license-update.test.ts cannot yet run locally due to a test-secret setup issue noted in the PR, so its assertion remains unverified in CI.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[diffPlanV1 called] --> B{includeCurrencyListChanges?} B -- false --> C[pricesEqual uses additionalCurrenciesCompatible\nonly changed amounts on shared currencies trigger diff] B -- true --> D[pricesEqual AND additionalCurrencyListsEqual\nany add/remove/change triggers diff] C --> E[itemsEqual uses itemPricesEqual\nwhich uses additionalCurrenciesCompatible] D --> F[itemsEqual OR itemCurrencyListsEqual\ndetects currency-list changes on items too] E --> G[Returns DiffedCustomizePlanV1] F --> G G --> H{Caller} H -- migration snapshot compare --> I[pricesEqual / additionalCurrenciesCompatible\nno flag needed] H -- preview / customize diff --> J[includeCurrencyListChanges: true\ndiffPlanV1PreviewFields\ngetApiPlanDiff\ndiffLicensePlanCustomize\nproductToLicenseCustomize\ngetPlanResponse]%%{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"}}}%% flowchart TD A[diffPlanV1 called] --> B{includeCurrencyListChanges?} B -- false --> C[pricesEqual uses additionalCurrenciesCompatible\nonly changed amounts on shared currencies trigger diff] B -- true --> D[pricesEqual AND additionalCurrencyListsEqual\nany add/remove/change triggers diff] C --> E[itemsEqual uses itemPricesEqual\nwhich uses additionalCurrenciesCompatible] D --> F[itemsEqual OR itemCurrencyListsEqual\ndetects currency-list changes on items too] E --> G[Returns DiffedCustomizePlanV1] F --> G G --> H{Caller} H -- migration snapshot compare --> I[pricesEqual / additionalCurrenciesCompatible\nno flag needed] H -- preview / customize diff --> J[includeCurrencyListChanges: true\ndiffPlanV1PreviewFields\ngetApiPlanDiff\ndiffLicensePlanCustomize\nproductToLicenseCustomize\ngetPlanResponse]Reviews (1): Last reviewed commit: "fix(licenses): 🐛 show currency edits in..." | Re-trigger Greptile