Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1919540 - Implement basic environment handling for the search engine selector. #6474

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Standard8
Copy link
Member

This adds most of the environment handling necessary for the search engine selector. There are some remaining parts that will be handled in bug 1930969.

This code is not currently used anywhere so no API / changelog actions are necessary.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@Standard8
Copy link
Member Author

Asking @mandysGit for the main review please, and @linabutler to take a look at the rust usage for us please.

Copy link
Member

@linabutler linabutler left a comment

Choose a reason for hiding this comment

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

The Rust parts look terrific; thanks, @Standard8!

components/search/src/configuration_types.rs Show resolved Hide resolved
components/search/src/configuration_types.rs Outdated Show resolved Hide resolved
components/search/src/environment_matching.rs Outdated Show resolved Hide resolved
components/search/src/environment_matching.rs Outdated Show resolved Hide resolved
components/search/src/environment_matching.rs Outdated Show resolved Hide resolved
components/search/src/environment_matching.rs Outdated Show resolved Hide resolved
components/search/src/environment_matching.rs Outdated Show resolved Hide resolved
components/search/src/types.rs Show resolved Hide resolved
Copy link

@mandysGit mandysGit left a comment

Choose a reason for hiding this comment

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

Thank you! I learned so much Rust reviewing this patch.

I left some suggestions and comments around code clarity, and few questions I had about things I didn't quite understand. No major blocking comments though.

components/search/src/configuration_types.rs Outdated Show resolved Hide resolved
/// Describes variations of this search engine that may occur depending on
/// the user's environment. The last variant that matches the user's
/// environment will be applied to the engine, subvariants may also be applied.
pub variants: Vec<JSONEngineVariant>,

Choose a reason for hiding this comment

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

What do you think about adding sub_variants underneath the pub variants?

We could add this description:
subvariant description from search-config-v2 schema

Copy link
Member Author

Choose a reason for hiding this comment

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

My plan was to add that in a later bug - this one is for handling of filtering for most of the environment.

components/search/src/filter.rs Show resolved Hide resolved
components/search/src/filter.rs Outdated Show resolved Hide resolved
@@ -127,6 +134,11 @@ mod tests {
},
"extraField2": "123"

Choose a reason for hiding this comment

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

I noticed there are these extraField properties. What is it and and why do we need these?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are testing that if add extra properties to the configuration in future then these will not cause existing clients to fail. The test description mentions these should be allowed, but I'll improve the assertion as well.

components/search/src/selector.rs Outdated Show resolved Hide resolved
components/search/src/selector.rs Outdated Show resolved Hide resolved
components/search/src/selector.rs Outdated Show resolved Hide resolved
@Standard8
Copy link
Member Author

Thank you both for the reviews, I've updated for the comments and believe I've addressed everything @mandysGit

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