Skip to content

Conversation

@ctsims
Copy link
Member

@ctsims ctsims commented Apr 18, 2019

Ticket Reference:
https://dimagi-dev.atlassian.net/browse/HI-572

Will implemented an algorithm to find the shortest cycle in dependency evaluation, but the directional of the graph was implemented backwards

IE: For a calculation
velocity = distance / time

it would create the dependency edge set
distance -> velocity
time -> velocity

rather than
velocity -> time
velocity -> distance

which was making the algorithm mistakenly miss the cycle and error out.

Also ensured that cyclical references are reported specifically as a parse error, which was not unified on the current reporting path. We can end up detecting them in two places.

@@ -0,0 +1,7060 @@
<?xml version="1.0" encoding="UTF-8" ?>
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:vellum="http://commcarehq.org/xforms/vellum">
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's possible to use a smaller form for the test case that can repro the issue. Current one is 7k lines of xml which is not ideal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey, agreed that this seems like a big form. It also adds more time to tests than I'm comfortable with, but I couldn't think of a way to specifically clean out only these question elements and retain the "Regression."

I'm not sure if it actually matters much to have the regression test for the future if it ends up causing issues. i'll mull it over a bit

Copy link
Contributor

@shubham1g5 shubham1g5 left a comment

Choose a reason for hiding this comment

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

@ctsims Nice catch. Thanks for fixing.

@ctsims ctsims merged commit bfabc56 into master Apr 19, 2019
@ctsims ctsims deleted the ctsims/cyclical_reference_fix branch April 19, 2019 15:36
@shubham1g5 shubham1g5 added this to the 2.46 milestone May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants