Skip to content

Conversation

@TarekAlQaddy
Copy link
Contributor

  • Add features to Search and Browse response models
  • Add tests
  • features & feature_variants that are inside the request object of the response can be accessed as the request object is a generic Map<String, Object>
    • Ex: Map<String, Object> features = (Map<String, Object>) response.getRequest().get("features");
      System.out.println(features.get("personalization"));

@TarekAlQaddy TarekAlQaddy requested a review from a team October 2, 2025 01:58
@esezen esezen requested a review from Copilot October 2, 2025 14:45
Copy link
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

This PR adds support for exposing features and feature variants from search and browse API responses by adding new model classes and updating response models.

  • Added new Feature and Variant model classes to represent feature data
  • Updated SearchResponseInner and BrowseResponseInner to include features list
  • Added comprehensive test coverage for the new features functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Feature.java New model class representing a feature with display name, feature name, enabled status, and variant
Variant.java New model class representing a feature variant with name and display name
SearchResponseInner.java Added features field and getter/setter methods
BrowseResponseInner.java Added features field and getter/setter methods
SearchResponseTest.java Added test case to verify features parsing in search responses
BrowseResponseTest.java Added test case to verify features parsing in browse responses

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@Mudaafi Mudaafi left a comment

Choose a reason for hiding this comment

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

LGTM, I checked the schemas in the autocomplete repo and they match the structure we have here.

Comment on lines 322 to 330
assertEquals(
"browse result feature variant [display name] exists",
response.getResponse().getFeatures().get(0).getVariant().getDisplayName(),
"Default weights");
assertEquals(
"browse result feature variant [name] exists",
response.getResponse().getFeatures().get(0).getVariant().getName(),
"default_rules");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also test the case where variant is null? Something like ****

Suggested change
assertEquals(
"browse result feature variant [display name] exists",
response.getResponse().getFeatures().get(0).getVariant().getDisplayName(),
"Default weights");
assertEquals(
"browse result feature variant [name] exists",
response.getResponse().getFeatures().get(0).getVariant().getName(),
"default_rules");
}
assertEquals(
"browse result feature variant [display name] exists",
response.getResponse().getFeatures().get(0).getVariant().getDisplayName(),
"Default weights");
assertEquals(
"browse result feature variant [name] exists",
response.getResponse().getFeatures().get(0).getVariant().getName(),
"default_rules");
assertEquals(
"browse result feature variant returns null if empty",
response.getResponse().getFeatures().get(1).getVariant(),
null);
}

Comment on lines +298 to +305
assertEquals(
"search result feature variant [name] exists",
response.getResponse().getFeatures().get(0).getVariant().getName(),
"default_rules");
assertEquals(
"search result feature variant [display name] exists",
response.getResponse().getFeatures().get(0).getVariant().getDisplayName(),
"Default weights");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above for Browse Tests

@Mudaafi
Copy link
Contributor

Mudaafi commented Oct 2, 2025

Tests are failing due to an unrelated API updates. I've created a story internally to fix.

@Mudaafi Mudaafi merged commit cf19576 into master Oct 2, 2025
3 of 4 checks passed
@Mudaafi Mudaafi deleted the CDX-255-expose-the-features-object branch October 2, 2025 19:22
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