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 more study validation from processed_study.cc. #1183

Merged
merged 10 commits into from
Aug 20, 2024
Merged

Conversation

goodov
Copy link
Member

@goodov goodov commented Aug 19, 2024

Implement additional validation that exists in processed_study.cc.

Important ones:

  • study, experiment, feature name validation
  • default_experiment_name validation + experiment existence validation
  • experiment param name conflict and emptiness

Other was added just to have the full coverage (forcing_flag, google_web_experiment_id).

@goodov goodov marked this pull request as ready for review August 19, 2024 08:36
@goodov goodov requested a review from a team as a code owner August 19, 2024 08:36
);
}

// Validate total probability.
if (totalProbability !== 100) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

generally it's not neccessarily true, but probably we can limit ourself to 100 for simplicity
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can assume totalProbability == 100 for Griffin, but not for Finch, so the code will be non-reusable.
Not sure that it's a real issue, because we don't validate Finch right now.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can assume totalProbability == 100 for Griffin

yes, that's what we did before and I assume we will continue doing. It's just easier to view this as 0-100 percent value.

// Validate features.
if (experiment.feature_association !== undefined) {
if (
experiment.feature_association.enable_feature !== undefined &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use experiment?.feature_association to remove if (experiment.feature_association !== undefined)?
Also, !==undefined can't be get rid off if it's an object.

experiment.feature_association.enable_feature !== undefined &&
experiment.feature_association.enable_feature.length > 0
) {
for (const feature of experiment.feature_association.enable_feature) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

WDYT about making let features_to_check: string[] = [] and extending it.
Then just a one for-loop to check them all.

// Valiate params.
const paramNames = new Set<string>();
if (experiment.param.length > 0) {
for (const param of experiment.param) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: for (const param of experiment.param || [])

@goodov goodov requested a review from atuchin-m August 19, 2024 17:11
@goodov goodov force-pushed the validate-seed-more branch 2 times, most recently from 2320048 to d94d251 Compare August 20, 2024 05:54
@goodov goodov added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 0f56482 Aug 20, 2024
6 checks passed
@goodov goodov deleted the validate-seed-more branch August 20, 2024 07:01
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