fix: Restrict opportunities to 3 for freemium plan in spacecat-api-service#2072
Merged
fix: Restrict opportunities to 3 for freemium plan in spacecat-api-service#2072
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This PR will trigger a patch release when merged. |
getAllForSite and getByStatus were not forwarding the request context to getIsSummitPlgEnabled, so the x-client-type header check was skipped and PLG filtering always applied for FREE_TRIAL sites. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| "deploy": "hedy -v --deploy --aws-deploy-bucket=spacecat-prod-deploy --pkgVersion=latest", | ||
| "deploy-stage": "hedy -v --deploy --aws-deploy-bucket=spacecat-stage-deploy --pkgVersion=latest", | ||
| "deploy-dev": "hedy -v --deploy --pkgVersion=latest$CI_BUILD_NUM -l latest --aws-deploy-bucket=spacecat-dev-deploy --cleanup-ci=24h", | ||
| "deploy-dev": "hedy -v --deploy --pkgVersion=latest$CI_BUILD_NUM -l sandsinh --aws-deploy-bucket=spacecat-dev-deploy --cleanup-ci=24h", |
Contributor
There was a problem hiding this comment.
let's make sure we revert this.
solaris007
pushed a commit
that referenced
this pull request
Apr 6, 2026
## [1.415.3](v1.415.2...v1.415.3) (2026-04-06) ### Bug Fixes * Restrict opportunities to 3 for freemium plan in spacecat-api-service ([#2072](#2072)) ([fb979dc](fb979dc))
Member
|
🎉 This PR is included in version 1.415.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Restricts opportunities returned by the API to only PLG-allowed types (
broken-backlinks,cwv,alt-text) when the site has Summit PLG enabled (freemium plan). This ensures freemium users only see the 3 supported opportunity types rather than all available opportunities.Changes
src/controllers/opportunities.js: AddedfilterForSummitPlg()helper that checks if Summit PLG is enabled for the site and filters opportunities to the allowed types. Applied to bothgetAllForSiteandgetByStatusendpoints.test/controllers/opportunities.test.js: Added 6 test cases covering PLG filtering for both endpoints (enabled/disabled), and verifying request context is passed through.Related Issues
Test plan
getAllForSiteandgetByStatusendpointsgetIsSummitPlgEnabledNotes
package.jsoncontains a dev deploy label change (latest→sandsinh) — revert before merge.