RI Recommendations - APIClient#8121
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
# Conflicts: # inc/Engine/Admin/RocketInsights/ServiceProvider.php
There was a problem hiding this comment.
Pull request overview
Adds a Rocket Insights “Recommendations” SaaS API client intended to fetch recommendation data from the /recommendations/ endpoint and wires it into the RocketInsights DI module, with accompanying unit tests/fixtures.
Changes:
- Added
Recommendations\APIClient::get_recommendations()for fetching and validating recommendations responses. - Registered the recommendations API client in
inc/Engine/Admin/RocketInsights/ServiceProvider.php. - Added unit tests and fixtures covering success and common failure paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
inc/Engine/Admin/RocketInsights/Recommendations/APIClient.php |
New Recommendations API client implementation (request + response validation + logging). |
inc/Engine/Admin/RocketInsights/ServiceProvider.php |
Registers the recommendations API client in the RocketInsights container. |
tests/Unit/inc/Engine/Admin/RocketInsights/Recommendations/APIClient/getRecommendations.php |
Unit tests for get_recommendations(). |
tests/Fixtures/inc/Engine/Admin/RocketInsights/Recommendations/APIClient/getRecommendations.php |
Test fixtures for the recommendations API client scenarios. |
Comments suppressed due to low confidence (1)
inc/Engine/Admin/RocketInsights/ServiceProvider.php:185
- Service registration wires
ri_recommendations_api_clientwith theoptionsservice, but the recommendations endpoint is intended to be public/no-auth. If the API client is refactored to avoid credentials (and thus no longer needs Options_Data), update the container registration to drop this dependency to prevent unnecessary coupling and avoid leaking consumer credentials in requests.
[
'ri_query',
'ri_manager',
Description
Fixes #8098
Everything is mentioned in the issue itself.
Type of change
Detailed scenario
What was tested
Manually check the response of the APIClient::get_recommendations method
How to test
It's not testable by QA, only dev can validate it and we can enhance it later when it's being used.
Affected Features & Quality Assurance Scope
Nothing, new file
Technical description
Documentation
Only APIClient to send the request and handle the response of recommendations.
New dependencies
New endpoint, it's deployed in this saas director: https://group-onecom.slack.com/archives/C0AF91DUS9Z/p1771944856664779
Risks
N/A
Mandatory Checklist
Code validation
Code style
Unticked items justification
If some mandatory items are not relevant, explain why in this section.
Additional Checks