-
Notifications
You must be signed in to change notification settings - Fork 80
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
Fixed a bug in DynamicRelation.members() that broke BareAtlas.relationsLowerOrderFirst() #216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great testing again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix and test - great stuff. Just a belated review to confirm the fix.
Assert.assertEquals(14, finalAtlas.numberOfRelations()); | ||
|
||
/* | ||
* This has been updated to 16 instead of 14. This is because two of the relations in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this comment is necessary. The check here was on the data, simply changing the number is fine. Thanks for the detailed explanation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly left it just for the purposes of explaining the change in the PR, so you guys didn't think I was just cheating to make a test pass :)
It could have been removed but we merged so fast that I didn't get a chance.
Description:
Previously, the interaction between
BareAtlas
,AtlasEntity
, andDynamicAtlas
/DynamicRelation
was broken in the following way:If you had a
DynamicAtlas
containing some relationR
that contained at least one other relationR'
as a member, callingDynamicAtlas.relationsLowerOrderFirst()
(which used the implementation inBareAtlas
) would drop relationR
from the returned set.This was due to a faulty
AtlasEntity
equality assumption made byrelationsLowerOrderFirst()
which did not hold in the case ofDynamicAtlas
.This has now been fixed in
DynamicRelation
. Themembers
function now returns entities of the correct type, so that the equality assumptions made inrelationsLowerOrderFirst()
are correct.Potential Impact:
The broken version of
DynamicAtlas.members()
(andBareAtlas.relationsLowerOrderFirst()
) was negatively impacting the functionality ofWaySectionProcessor
(the raw atlas version), which depends onDynamicAtlas
and proper functionality of this method to work. Before the bug fix, theWaySectionProcessor
would drop any relation which had at least one relation as a member.Unit Test Approach:
I have added
DynamicAtlasTest.testRelationsLowerOrderFirstConsistency()
, which demonstrates the case in which the bug would occur. It utilizes a new test atlas,DynamicAtlasTestRule.atlasForRelationsTest
, which is designed to trigger the bug. With the fix, this unit test now passes.RawAtlasIntegrationTest.testSectioningFromShard()
was also affected. In the previous code version, it was dropping two relations from the build, and the test was assuming that those two relations did not exist (when in reality they had actually just been dropped by theWaySectionProcessor
). The test is updated, and passes with the bug fix in place.Test Results:
I am planning on doing more extensive testing. Please reach out to me to discuss.
In doubt: Contributing Guidelines