Skip to content

fix: exclude archived products from check preview and related flows#796

Open
lutz-grex wants to merge 1 commit intouseautumn:devfrom
lutz-grex:fix/archived-products-in-preview
Open

fix: exclude archived products from check preview and related flows#796
lutz-grex wants to merge 1 commit intouseautumn:devfrom
lutz-grex:fix/archived-products-in-preview

Conversation

@lutz-grex
Copy link

@lutz-grex lutz-grex commented Feb 23, 2026

Summary

  • ProductService.getByFeature: Added ne(products.archived, true) to the query so archived products are never included in the /check withPreview response. This was the root cause of paywall dialogs incorrectly suggesting upgrades to retired/archived plans as the upgrade target.
  • handleGetPricingTable: Pass archived: false to listFull so archived products are excluded from the customer-facing pricing table component.
  • getCusAndProducts: Reject attach requests that target an archived product with a clear error message, preventing archived products from being attached to customers.
  • createProduct / handleCreatePlan: Allow reusing an archived product's ID for a new product — don't treat an archived product as a conflict when checking for duplicate IDs.

Related Issues

No existing issue - bug found during code review

Type of Change

  • [x ] Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (please describe):

Checklist

  • [x ] I have read the CONTRIBUTING.md
  • [ x] My code follows the code style of this project
  • I have added tests where applicable
  • [ x] I have tested my changes locally
  • I have linked relevant issues
  • I have added screenshots for UI changes (if applicable)

Screenshots (if applicable)

Additional Context

Other ProductService methods (listDefault, handleListPlans, handleListBillingPlans) already filtered archived products correctly using ne(products.archived, true) or archived: false. This PR brings the remaining callers in line with that existing pattern - getByFeature was the only query method missing the filter entirely, and the other three fixes address the downstream consequences of archived products leaking through.


Summary by cubic

Archived products are now fully excluded from previews and customer-facing flows to prevent upgrade prompts to retired plans and invalid attachments. Creating new products can reuse IDs from archived products.

  • Bug Fixes
    • Filtered archived products in ProductService.getByFeature so /check withPreview returns only active plans.
    • Excluded archived products from the pricing table by passing archived: false to listFull.
    • Blocked attach requests targeting archived products with a clear error.
    • Allowed reusing IDs of archived products when creating products/plans; only non-archived products cause conflicts.

Written for commit 3f5d01b. Summary will update on new commits.

Greptile Summary

This PR systematically excludes archived products from customer-facing flows to prevent upgrade prompts to retired plans.

Bug Fixes

  • Fixed /check endpoint's withPreview response incorrectly suggesting upgrades to archived/retired products by adding archived filter to ProductService.getByFeature at server/src/internal/products/ProductService.ts:67
  • Prevented archived products from appearing in customer-facing pricing tables at server/src/internal/misc/components/handlers/handleGetPricingTable.ts:26
  • Blocked attach requests targeting archived products with validation error at server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getCusAndProducts.ts:40-46

Improvements

  • Allowed reusing product IDs from archived products when creating new products by updating duplicate checks in createProduct and handleCreatePlan to only reject non-archived duplicates

The changes are consistent with existing patterns throughout the codebase. Other ProductService methods (listDefault, handleListBillingPlans) already filter archived products using the same approach. The fix brings getByFeature in line with these existing patterns.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes follow established patterns already used elsewhere in the codebase. The archived product filtering using ne(products.archived, true) and archived: false is consistent with existing code in listDefault, handleListBillingPlans, and other methods. The validation logic is defensive and prevents potential runtime errors. The changes are minimal, focused, and directly address the stated bug.
  • No files require special attention

Important Files Changed

Filename Overview
server/src/internal/products/ProductService.ts Added ne(products.archived, true) filter to getByFeature method to exclude archived products from check preview results
server/src/internal/misc/components/handlers/handleGetPricingTable.ts Added archived: false parameter to listFull call to exclude archived products from customer-facing pricing table
server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getCusAndProducts.ts Added validation to reject attach requests targeting archived products with clear error message
server/src/internal/product/actions/createProduct.ts Updated duplicate check to only throw error for non-archived products, allowing ID reuse from archived products
server/src/internal/products/handlers/handleCreateProduct/handleCreatePlan.ts Updated duplicate check to only throw error for non-archived products, allowing ID reuse from archived products

Last reviewed commit: 3f5d01b

(4/5) You can add custom instructions or style guidelines for the agent here!

- ProductService.getByFeature: filter out archived products so they
  never appear in /check withPreview response (paywall dialog bug)
- handleGetPricingTable: pass archived: false so archived products
  are excluded from the customer-facing pricing table component
- getCusAndProducts: reject attach requests that target an archived
  product with a clear error message
- createProduct / handleCreatePlan: allow reusing an archived product's
  ID for a new product (don't treat archived as a conflict)
@vercel
Copy link

vercel bot commented Feb 23, 2026

@lutz-grex is attempting to deploy a commit to the Autumn Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
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 5 files

Confidence score: 5/5

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

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