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

Add a structure hash to FeatureInspector #5949

Merged
merged 4 commits into from Nov 29, 2023

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Nov 28, 2023

Relates to EXP-3938.

According to The Big O of Code Reviews, this is a O(n) change.

This PR adds:

  • a TypeQuery utility for getting all TypeRefs that a FeatureDef uses, including recursively looking at ObjectDefs. This is useful in multiple places, so good to pull this out.
  • a Sha256Hasher, compatible with std:hash:Hash
  • a StructureHasher that uses the structure of the feature (and embedded Objects).

It exposes get_structure_hash() to the FeatureInspector, available to python.

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 dilligence applied in selecting them.

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

@jhugman jhugman added the nimbus Nimbus, the experimentation platform. label Nov 28, 2023
@codecov-commenter
Copy link

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (11b6f77) 26.97% compared to head (79cd3ac) 27.34%.

Files Patch % Lines
...port/nimbus-fml/src/intermediate_representation.rs 0.00% 10 Missing ⚠️
...ponents/support/nimbus-fml/src/client/inspector.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5949      +/-   ##
==========================================
+ Coverage   26.97%   27.34%   +0.37%     
==========================================
  Files         377      379       +2     
  Lines       47881    48145     +264     
==========================================
+ Hits        12916    13166     +250     
- Misses      34965    34979      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhugman jhugman force-pushed the jhugman/exp-3938-add-structure-hasher branch from 79cd3ac to 48bc961 Compare November 29, 2023 13:57
Copy link
Contributor

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

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

Fantastic! 🚀

@@ -66,6 +66,12 @@ impl FmlFeatureInspector {
pub fn get_errors(&self, string: String) -> Option<Vec<FmlEditorError>> {
self.get_first_error(string).map(|e| vec![e])
}

pub fn get_structure_hash(&self) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

I definitely agree that "structure" isn't as clear as I'd like it to be

Copy link
Contributor

Choose a reason for hiding this comment

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

"Schema" does seem like a good alternative, since we use "definition" in other places

@jhugman jhugman added this pull request to the merge queue Nov 29, 2023
Merged via the queue into main with commit 85f639a Nov 29, 2023
17 checks passed
@jhugman jhugman deleted the jhugman/exp-3938-add-structure-hasher branch November 29, 2023 17:36
@jhugman jhugman mentioned this pull request Nov 30, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nimbus Nimbus, the experimentation platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants