fix: exclude decorative images from alt-text PLG grant selection (SITES-44253)#2831
Open
yashrathore11 wants to merge 2 commits into
Open
fix: exclude decorative images from alt-text PLG grant selection (SITES-44253)#2831yashrathore11 wants to merge 2 commits into
yashrathore11 wants to merge 2 commits into
Conversation
…ES-44253) Decorative suggestions (data.recommendations[].isDecorative) needed no alt-text fix and shouldn't consume one of a PLG customer's 3 monthly grant token slots, but the alt-text opportunity had no grouping strategy and fell through to the unfiltered default, letting them compete for grants alongside real fixes. Co-Authored-By: Claude Sonnet 5 <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. |
yashrathore11
temporarily deployed
to
dev-branches
July 16, 2026 06:51 — with
GitHub Actions
Inactive
yashrathore11
requested review from
MysticatBot and
tkotthakota-adobe
and removed request for
tkotthakota-adobe
July 16, 2026 08:50
MysticatBot
approved these changes
Jul 16, 2026
There was a problem hiding this comment.
Hey @yashrathore11,
Verdict: Approve - clean, well-scoped fix with thorough test coverage.
Complexity: LOW - small diff, single service, internal logic only.
Changes: Adds an alt-text grouping strategy to OPPORTUNITY_STRATEGIES that excludes decorative-image suggestions from PLG grant selection (2 files).
Non-blocking (2): minor issues and suggestions
- nit: The comment (lines 144-147) says
data.recommendations[].isDecorative- consider rewording to "Suggestions where any recommendation is marked decorative are excluded" to make the any-match semantics explicit without needing to read the filter body. -src/support/grant-suggestions-handler.js:144 - suggestion: The test "works with plain object data (no getData())" proves the filter handles plain objects, but if the downstream default sort calls
getId()/getRank()methods, plain objects without those methods would fail end-to-end. Consider whether this fallback path occurs at runtime - if not, the test overstates the supported contract. -test/support/grant-suggestions-handler.test.js:361
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 3s | Cost: $3.43 | Commit: e18bbe7c999822b48bda194e1b99a3d7c174d1b0
If this code review was useful, please react with 👍. Otherwise, react with 👎.
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
Decorative-image suggestions (
data.recommendations[].isDecorative === true) were competing for a PLG customer's limited alt-text grant slots (3 per month) alongside suggestions that actually need an alt-text fix. Since decorative images don't need alt text, granting one wasted a slot that should have gone to a real fix — silently reducing how many actionable suggestions a PLG customer saw that cycle.This adds an
alt-textgrouping strategy toOPPORTUNITY_STRATEGIESingrant-suggestions-handler.jsthat excludes decorative suggestions before grant selection, so all 3 monthly slots go to suggestions that actually need fixing. If fewer than 3 non-decorative suggestions exist, fewer than 3 are granted — slots are no longer backfilled with decorative suggestions just to hit the cap.No public API contract change: same endpoints, same response shape — only which suggestions get a grant record (and therefore surface to
sites-optimizer-uiPLG callers via the existingfilterByGrantStatusgate) changes.Testing
test/support/grant-suggestions-handler.test.jscovering: exclusion of decorative suggestions, exclusion when any of multiple recommendations is decorative, retention of non-decorative suggestions, missing/emptyrecommendationstreated as non-decorative, plain-objectdatasupport, and default rank-ascending sort of survivors.grant-suggestions-handler.test.js(58/58) and thesuggestions/opportunitiescontroller suites (528/528) pass.If the PR is changing the API specification:
If the PR is changing the API implementation or an entity exposed through the API:
If the PR is introducing a new audit type:
Related Issues
SITES-44253