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

Fix TR-5932 branching rules evaluation for non-linear test parts #381

Merged

Conversation

gabrielfs7
Copy link
Contributor

@gabrielfs7 gabrielfs7 commented Dec 12, 2023

https://oat-sa.atlassian.net/browse/TR-5932

Make branch rules work again between test part with nonlinear navigation

Related PR

@gabrielfs7 gabrielfs7 changed the base branch from master to develop December 12, 2023 17:09
@wazelin wazelin closed this Dec 12, 2023
@wazelin wazelin reopened this Dec 12, 2023
if (
$ignoreBranchings === false &&
$numberOfBranchRules > 0 &&
$this->mustApplyBranchRules() || $branchRules->isNonLinearNavigationModeAllowed()
Copy link
Member

Choose a reason for hiding this comment

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

Just a sanity check.
Did you mean what you've written, or did you mean this instead?

                $ignoreBranchings === false &&
                $numberOfBranchRules > 0 &&
                ($this->mustApplyBranchRules() || $branchRules->isNonLinearNavigationModeAllowed())

Copy link
Member

Choose a reason for hiding this comment

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

In either case, I strongly advise using parenthesis (even if the order of logical operations is correct) to emphasize the intended logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, let me improve that

Copy link
Member

Choose a reason for hiding this comment

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

Oh. So, it was a wrong condition after all?
I mean, what you've applied now is totally different from the original condition where, should $branchRules->isNonLinearNavigationModeAllowed() be true the rest of the condition didn't matter.

Copy link
Member

Choose a reason for hiding this comment

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

Now the question is: "why didn't the test cases fail with the original code"?

Copy link
Contributor Author

@gabrielfs7 gabrielfs7 Dec 12, 2023

Choose a reason for hiding this comment

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

We probably do not have proper coverage for those conditions. But this is quite a PISA emergency, I am not sure I can cover all the previous missing cases on this PR.

Copy link
Member

Choose a reason for hiding this comment

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

That's fine. Just once again want to be 100%-sure your changes are intentional.
Quick reference of the changes between the two conditions we saw in this PR before and after my comment on this line: https://3v4l.org/G5cLN

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is intentional, before the || operator outside of the parentheses would invalidate all the time all the other rules (which was passing cause of low test coverage), but it only makes sense to pass if other conditions are met too :)

Thanks for the heads up

Copy link
Member

Choose a reason for hiding this comment

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

OK then.
I just didn't realize that from your initial response to my comment.

All clear now.

Copy link
Contributor Author

@gabrielfs7 gabrielfs7 Dec 13, 2023

Choose a reason for hiding this comment

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

FYI, $ignoreBranchings and other parameters for this very method are never passed. They were introduced on 2020, but never used. I will not change them now to avoid inflate the PR, but that is also one of the reasons that condition is not caught on tests

@wazelin wazelin changed the title chore: add test that must pass after fix Fix TR-5932 branching rules evaluation for non-linear test parts Dec 12, 2023
@gabrielfs7 gabrielfs7 merged commit 37b52f5 into develop Dec 13, 2023
3 of 4 checks passed
@gabrielfs7 gabrielfs7 deleted the fix/TR-5932/fix-branching-rules-nonlinear-test-parts branch December 13, 2023 12:30
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