fix: improve Governing_Data remote api contract#55
Merged
justlevine merged 3 commits intodevelopfrom Nov 12, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors and improves the Governing_Data REST API client by relocating the class, enhancing error handling, adding input sanitization, and switching to safer HTTP methods.
Key Changes:
- Moved
Governing_Datafrominc/classes/rest/toinc/Modules/Rest/with namespace change fromOnesearch\Inc\RESTtoOnesearch\REST\Modules - Enhanced methods to return
WP_Erroron failures instead of silently falling back to empty arrays - Added input sanitization using WordPress functions (
sanitize_text_field,esc_url_raw) - Replaced
wp_remote_getwithwp_safe_remote_getfor improved security
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| inc/classes/rest/class-governing-data.php | Deleted old location of Governing_Data class |
| inc/Modules/Rest/Governing_Data.php | New location with improved error handling, sanitization, and WP_Error returns |
| inc/Modules/Rest/Abstract_REST_Controller.php | New base controller with shared NAMESPACE constant |
| inc/Modules/Rest/Rest.php | Updated to remove Governing_Data::instance() call and namespace changes |
| inc/classes/rest/class-basic-options.php | Updated import to use new Governing_Data namespace |
| inc/classes/algolia/class-algolia.php | Added WP_Error handling for get_algolia_credentials and updated import |
| inc/classes/algolia/class-algolia-search.php | Refactored constructor logic into register_hooks, added WP_Error checks, updated import |
| inc/classes/algolia/class-algolia-index-by-post.php | Updated to use Abstract_REST_Controller::NAMESPACE constant |
| inc/Utils.php | Added explicit string cast to normalize_url return value |
| inc/Modules/Core/Assets.php | Updated to use Abstract_REST_Controller::NAMESPACE constant |
| inc/Main.php | Updated class reference from Inc\REST to Modules\Rest\Rest |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Description
Technical Details
Fixes the REST contracts used by
Governing_Data, including sanitizing and validating values.Checklist
Screenshots
To-do
Fixes/Covers issue
Fixes #