Skip to content

feat(aws-marketplace): sell several listings from one integration through a product catalog - #9920

Merged
waleedlatif1 merged 4 commits into
stagingfrom
feat/aws-marketplace-product-catalog
Nov 12, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
feat/aws-marketplace-product-catalog

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • One integration now sells any number of AWS Marketplace listings. Each listing's behavior is a plan in code (aws-marketplace/products.ts); which product codes exist is deployment configuration, AWS_MARKETPLACE_PRODUCTS=<code>=<plan>,.... Every path resolves a license's product from the code AWS returned or the code on its row, so adding, repricing, or retiring a listing is a config change, not a branch
  • Plans: contract (unchanged behavior: any current entitlement grants access) and platform-with-usage (access requires a current platform entitlement; usage dimensions never grant access on their own)
  • entitlementCount still counts every dimension AWS returned, so a license with usage but no platform reads inactive, not pending
  • Registration routes by the code ResolveCustomer returns, since all listings share the one fulfillment URL; a code this deployment doesn't sell is refused as before
  • Reconcile and the daily re-verify span every configured code and verify each license against its own product; agreement renewals, advisories and endings match across listings (agreement IDs are unique anyway)
  • The team's "organizations already linked to this AWS account" hint now matches across listings — a buyer moving to a new listing usually wants the organization they already have — and team notices name the listing
  • config.ts is the single parse point (memoized); a malformed AWS_MARKETPLACE_PRODUCTS throws an error naming the bad entry on first use. env.ts stays free of billing code
  • Reconcile resolves the configured products once per run and the repository returns each license paired with its product, so no loop re-looks-up or skips

Deploy prerequisite: this replaces AWS_MARKETPLACE_PRODUCT_CODE. Before the release carrying this PR deploys, the production env secret must hold AWS_MARKETPLACE_PRODUCTS=<existing code>=contract; otherwise the Marketplace surfaces turn off. The new listing is added to that value (and to the infra event rule) once this is live.

Type of Change

  • New feature

Testing

  • lifecycle.integration.ts + checkout-guard.integration.ts on real Postgres (bun run test:integration): 75 pass, including two new ones — a usage-listing buyer is admitted only on a current platform entitlement (a usage-only license is recorded inactive), and a queued License Updated event for the usage listing is applied under its own plan (a lapsed platform ends access while usage is current). Both go red with the dimension filter removed
  • entitlements.test.ts: 10 pass; the 3 new required-dimension cases go red with the filter removed
  • tsc --noEmit, bun run lint, and check:boundaries, check:client-boundary, check:utils, check:file-names, check:comment-hygiene, check:source-conventions, check:explicit-any; full audits and suites run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • 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 Nov 12, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 12, 2026 2:55am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR changes AWS Marketplace onboarding, access status, and license updates across configured listings.

Fix the lost retry for unconfirmed licenses before merging.

Findings

  1. P1 Unconfirmed licenses lose their retry ▶

Summary

This PR supports several AWS Marketplace listings through one configured product catalog.

  • One AWS Marketplace endpoint can register several configured listings.
  • Usage listings grant access only while their platform entitlement is current.
  • AWS license updates now refresh every configured Marketplace listing.
  • Marketplace notices connect related listings under the same AWS account.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Event[License Updated event] --> Read[Read AWS entitlements]
  Read --> Usage[Only usage is returned]
  Usage --> Save[Create pending license]
  Save --> Applied[Mark event applied]
  Applied --> Delete[Delete queued event]
  Delete --> Wait[Wait 24 hours for scheduled check]
  Wait --> Retry[Read AWS again]
Loading

Reviews (4) · Last reviewed commit: "fix(aws-marketplace): discover a license..." · Reviewed by Greptile

Comment thread apps/sim/lib/core/config/env.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

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.

All reported issues were addressed across 17 files

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/core/config/env.ts Resolved
…env free of billing code, and drop derivable state
…ss, and refuse to boot on a malformed product catalog
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

This comment has been minimized.

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 18 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Re the outside-diff finding (usage-only licenses go unrecorded): valid, fixed in 3caea36. The overloaded entitlementCount is replaced by two explicit facts on the summary: licenseSeen (AWS returned any entitlement, so the license exists and names its account; decides whether a row is created) and accessReported (AWS returned the access dimension, current or lapsed; decides status, registration retries, and which fields are written). A License Updated event that arrives first with only llm_credits now creates the row as pending and tells the team it is unconfirmed; a new integration test covers it and fails when row creation keys off access.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 18 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 392dc44 into staging Nov 12, 2026
80 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/aws-marketplace-product-catalog branch November 12, 2026 03:06
return db.transaction(async (tx) => {
const accountId = verification.summary.customerAwsAccountId ?? input.fallbackAccountId
if (accountId && verification.summary.entitlementCount > 0) {
if (accountId && verification.summary.licenseSeen) {

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.

P1 Unconfirmed licenses lose their retry

When a new license's License Updated event arrives before AWS returns platform, licenseSeen now creates a pending row from usage-only entitlements. applyLicenseEvent then returns applied and deletes the message instead of retaining it for another attempt.

Without another event or buyer request, the saved license is not checked again for 24 hours. A buyer whose platform entitlement appears minutes later can remain unconfirmed for a day. Keep retrying unresolved access after saving the row, or check pending rows more often.

This branch was previously deployed

1 inactive deployment
Preview — 3caea360 Deployed Nov 12, 2026 by vercel[bot]
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