Skip to content

[CDX-380] Add support for variationId param in RecommendationsRequest#183

Merged
esezen merged 6 commits intomasterfrom
cdx-380-java-sdk-add-support-for-variation-id-param-in
Apr 8, 2026
Merged

[CDX-380] Add support for variationId param in RecommendationsRequest#183
esezen merged 6 commits intomasterfrom
cdx-380-java-sdk-add-support-for-variation-id-param-in

Conversation

@quiteeasy
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 25, 2026 14:52
constructor-claude-bedrock[bot]

This comment was marked as outdated.

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

RecommendationsRequest request = new RecommendationsRequest("item_page_1");
request.setItemIds(Arrays.asList("power_drill"));
request.setVariationId("power_drill_variation");
RecommendationsResponse response = constructor.recommendations(request, userInfo);
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test sets variationId, but it doesn’t assert that the client actually sent variation_id (or that the server understood it). Since RecommendationsResponse exposes the parsed request map, add an assertion that response.getRequest().get("variation_id") matches the value you set so the test validates the new behavior.

Suggested change
RecommendationsResponse response = constructor.recommendations(request, userInfo);
RecommendationsResponse response = constructor.recommendations(request, userInfo);
assertEquals(
"variation_id in request should match the variationId set",
"power_drill_variation",
response.getRequest().get("variation_id"));

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quiteeasy I think this makes sense. What do you think?

@@ -54,6 +55,7 @@ public void settersShouldSet() throws Exception {
request.setPodId("zero_results_1");
request.setNumResults(3);
request.setItemIds(Arrays.asList("1", "2", "3"));
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setVariationId is documented as only valid when exactly one item_id is specified, but this test sets itemIds to three values and then sets variationId. Consider updating the test setup to use a single itemId when setting variationId (or split into separate cases) so the tests align with the documented constraint.

Suggested change
request.setItemIds(Arrays.asList("1", "2", "3"));
request.setItemIds(Arrays.asList("1"));

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well

Copy link
Copy Markdown
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quiteeasy this is looking good. Copilot left some good comments. Do you mind taking a look?

RecommendationsRequest request = new RecommendationsRequest("item_page_1");
request.setItemIds(Arrays.asList("power_drill"));
request.setVariationId("power_drill_variation");
RecommendationsResponse response = constructor.recommendations(request, userInfo);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quiteeasy I think this makes sense. What do you think?

@@ -54,6 +55,7 @@ public void settersShouldSet() throws Exception {
request.setPodId("zero_results_1");
request.setNumResults(3);
request.setItemIds(Arrays.asList("1", "2", "3"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well

@esezen esezen requested a review from a team as a code owner April 8, 2026 12:58
@esezen esezen requested review from Copilot and esezen April 8, 2026 12:58
Copy link
Copy Markdown

@constructor-claude-bedrock constructor-claude-bedrock bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR adds variationId support to RecommendationsRequest, including server-side validation that enforces it must be used with exactly one itemId. The implementation is clean and consistent with the existing codebase patterns, with good test coverage for both the happy path and error cases.

Inline comments: 4 discussions added

Overall Assessment: ⚠️ Needs Work

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@esezen esezen merged commit ee29c51 into master Apr 8, 2026
9 checks passed
@esezen esezen deleted the cdx-380-java-sdk-add-support-for-variation-id-param-in branch April 8, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants