feat(suggestions): allow OUTDATED status in auto-fix allowlist#2425
Open
FentPams wants to merge 4 commits into
Open
feat(suggestions): allow OUTDATED status in auto-fix allowlist#2425FentPams wants to merge 4 commits into
FentPams wants to merge 4 commits into
Conversation
OUTDATED alt-text suggestions are re-detections of previously-FIXED rows where the producer found the issue still present on the live URL (after the publish-lag reset gate). The experience-success-studio-ui PR #1914 surfaces OUTDATED in the Current tab so customers can retry the deploy, but the auto-fix controller's status gate only accepted NEW and PENDING_VALIDATION — silently rejecting OUTDATED with 400 inside a 207 response. The UI today treats 2xx as success, so the customer sees a "Success" toast while nothing actually re-deploys. This 3-line allowlist relaxation closes the gap. The rest of the round-trip is already status-agnostic: - bulkUpdateStatus is source-status-agnostic (verified in spacecat-shared-data-access: no state machine, no transition rules, no hooks — just enum membership check on the target value) - autofix-worker queries by opportunity_id + IN_PROGRESS, origin status is invisible to it - alt-text handler reads recommendations[0].altText, writes alt, transitions IN_PROGRESS → FIXED — status-agnostic - mystique projector and publish-lag reset gate are timestamp-driven, not status-driven So OUTDATED → IN_PROGRESS → (apply) → FIXED is now the supported flow. Tests: - Updated existing assertion to reflect new error message - Added new test asserting OUTDATED is accepted, bulkUpdateStatus transitions it to IN_PROGRESS, and the 207 response reports success=1 / failed=0 All 404 suggestions controller tests pass, no regressions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
V2 re-detected OUTDATED rows (previousDeployment stamp present in recommendations[0]) represent actionable work — PLG customers must be able to re-deploy them. The grant revocation predicate previously treated all OUTDATED as stale, revoking the token grant and causing a 403 on re-deploy. Only revoke OUTDATED grants that lack the previousDeployment stamp (V1 legacy windowing rows), which are genuinely stale book-keeping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This PR will trigger a minor release when merged. |
fb63148 to
67996a1
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Two gaps that blocked the end-to-end re-deploy flow for OUTDATED alt-text suggestions:
Gap 1 — Autofix gate rejected OUTDATED
The autofix controller only accepted
NEW | PENDING_VALIDATION. When a V2 re-detected suggestion (FIXED→OUTDATED after the projector ran) reached the deploybutton, the api-service returned 400 inside a 207. The UI showed a success toast while nothing re-deployed — silent failure.
Gap 2 — Grant revocation blocked PLG customers
STALE_STATUSESincludedOUTDATED, so the grant cycle revoked the token grant when a suggestion flipped to OUTDATED. PLG customers then hit a 403("suggestions are not granted") when trying to re-deploy, even after Gap 1 is fixed.
Changes
src/controllers/suggestions.js— addOUTDATEDto the autofix allowlist (Gap 1)src/support/grant-suggestions-handler.js— updateisRevocableto distinguish V1 vs V2 OUTDATED:recommendations[0].previousDeploymentpresent): grant preserved — customer can re-deployContext
The V2 projection pipeline (mystique PR #1974/#1982) stamps
previousDeploymenton suggestions it flips FIXED→OUTDATED after genuine re-detection. The UI(PR #1914, #1925) uses this stamp to route OUTDATED rows to the Current + Deployed tabs with a "Re-detected" pill. This PR closes the two remaining
server-side gaps so the re-deploy actually works end-to-end.
Please ensure your pull request adheres to the following guidelines:
describe here the problem you're solving.
If the PR is changing the API specification:
yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
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
Thanks for contributing!