[SITES-40704] Add suggestion data validation using shared Joi schemas#2008
Open
Kanishkavijay39 wants to merge 7 commits intomainfrom
Open
[SITES-40704] Add suggestion data validation using shared Joi schemas#2008Kanishkavijay39 wants to merge 7 commits intomainfrom
Kanishkavijay39 wants to merge 7 commits intomainfrom
Conversation
Validate suggestion data against DATA_SCHEMAS before creating or updating suggestions in syncSuggestions. Invalid data is skipped with a warning log to prevent bad data from persisting.
Validate suggestion data against DATA_SCHEMAS before creating or updating suggestions in syncSuggestions. Invalid data is logged as a warning to provide observability into data quality. Co-authored-by: Cursor <cursoragent@cursor.com>
|
This PR will trigger no release when merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Extract warnOnInvalidSuggestionData utility and apply it to Suggestion.create(), addSuggestions(), and setData()+save() calls across 15 handler files for consistent validation coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Added getType() method to opportunity mocks in accessibility and structured-data tests to ensure warnOnInvalidSuggestionData validation logic is properly exercised and achieves 100% code coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Added getType() method to opportunity mocks in high-organic-low-ctr, no-cta-above-the-fold, prerender, and readability guidance handler tests to achieve 100% code coverage for validation logic. Co-authored-by: Cursor <cursoragent@cursor.com>
Added getType() method to all opportunity mocks that use addSuggestions in image-alt-text opportunity-handler tests to achieve 100% branch coverage for validation logic. Co-authored-by: Cursor <cursoragent@cursor.com>
Added getType() method to opportunity mocks in 8 failing tests: - accessibility: 2 tests (without htmlWithIssues, multiple remediations) - experimentation-opportunities: 2 tests (new opportunity, validation) - prerender: 1 test (null getData) - broken-links guidance: 1 test - high-organic-low-ctr: 2 tests (system-managed, legacy) This completes 100% test coverage for the validation implementation. Co-authored-by: Cursor <cursoragent@cursor.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.
Validate suggestion data against DATA_SCHEMAS before creating or updating suggestions in syncSuggestions. Invalid data is skipped with a warning log to prevent bad data from persisting.
Please ensure your pull request adheres to the following guidelines:
Related Issues
Thanks for contributing!