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

Move structure validation to separate structure validator #5939

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Nov 22, 2023

Relates to EXP-3938.

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

This is moving quite a lot of code out intermediate_representation.rs into a new structure/validator.rs file.

The changes are fairly mechanical, but they added up. The tests also changed and moved, so this is a larger O(n) sized.

This has a requirement on landing #5947 and rebasing before this will build.

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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2023

Codecov Report

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

Comparison is base (7b3cbad) 26.81% compared to head (3efedc8) 26.74%.

Files Patch % Lines
...ents/support/nimbus-fml/src/structure/validator.rs 97.62% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5939      +/-   ##
==========================================
- Coverage   26.81%   26.74%   -0.08%     
==========================================
  Files         376      377       +1     
  Lines       47777    47718      -59     
==========================================
- Hits        12813    12763      -50     
+ Misses      34964    34955       -9     

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

Copy link
Contributor Author

@jhugman jhugman left a comment

Choose a reason for hiding this comment

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

Self review.

Ok(())
}

pub(crate) fn validate_feature_def(&self, feature_def: &FeatureDef) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is the largest non-mechanical change: here we're aggregating a lot of disparate methods which were all iterating over feature_def.props, and put them all in one loop.

)],
false,
);
validator.validate_feature_def(&fm).expect_err(
Copy link
Contributor Author

@jhugman jhugman Nov 22, 2023

Choose a reason for hiding this comment

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

All these tests used to be of the form:

let fm = get_feature_manifest(…)

fm.validate_something()

I've left most of the variable names intact.

@jhugman jhugman added the nimbus Nimbus, the experimentation platform. label Nov 27, 2023
@jhugman jhugman force-pushed the jhugman/exp-3938-move-structure-validation-to-structure-validator branch from 9740f54 to 5407918 Compare November 27, 2023 16:29
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.

Perfect! 👏

@jhugman jhugman force-pushed the jhugman/exp-3938-move-structure-validation-to-structure-validator branch from 5407918 to 3efedc8 Compare November 28, 2023 00:47
@jhugman jhugman added this pull request to the merge queue Nov 28, 2023
Merged via the queue into main with commit 11b6f77 Nov 28, 2023
16 checks passed
@jhugman jhugman deleted the jhugman/exp-3938-move-structure-validation-to-structure-validator branch November 28, 2023 01:19
@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