-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
In audit log, only include position predicates for repeats #3231
Conversation
I hope @grzesiek2010 will be taking it easy and healing tomorrow and not doing too much code review! @kkrawczyk123, @mmarciniak90, would you consider testing without code review since this is so targeted and can easily be swapped out later if a better approach is found? Alternately, I know there's a lot of JavaRosa context involved that you probably haven't looked at yet, @seadowg, so I understand if a deep review feels like it's hard to do but perhaps you could evaluate that and review if you feel like you can? I added a bunch of comments to |
@lognaturel I'm going to have to look at some docs around how this feature works but will have a go. |
This PR is blocking the beta and hasn't been tested. I think it's important to get the beta out today, so I'm going to merge and ask the testers to try this after the code freeze. If there are issues, those will be filed and fixed before final release. This is a change in process, but I've confirmed with @lognaturel that this PR is low-risk. |
@opendatakit-bot unlabel "needs testing" |
Thank you, @mmarciniak90! |
Closes #3126
Alternative to getodk/javarosa#469, builds on #3227
What has been done to verify that this works as intended?
Look at audit generated by nested-repeats-for-audit.xml.txt which has nesting of groups and repeats.
Why is this the best possible solution? Were any other approaches considered?
My first inclination was to modify the
TreeReference.toString
as done in getodk/javarosa#469. But as I was reviewing that solution, I saw a number of issues with it:toString
implementationTreeReference
s can be used to represent references in secondary data instances which may have sequences of elements that are not backed by XForms repeatsTreeReference
s don't currently have a link to a specificFormDef
I didn't realize these subtle issues were there until I thought through it deeply.
My main goal in designing an alternative was not to increase coupling between
TreeReference
andFormDef
.FormIndex
actually already bridges the two andAuditEvent
keeps track ofFormIndex
objects so it seems natural to use them.FormIndex
objects are only related to the primary instance and they only have a value other than-1
forinstanceIndex
at layers that represent repeats.This solution walks the
FormIndex
linked list to get the position predicates while using theTreeReference
field to get the names of the nodes. I think it's the simplest possible solution.I think we'll want to move this into
FormIndex
but it will be easier to review and QA here for now. An unfortunate side effect of makinggetXPathPath
a static method is that we end up needing realFormIndex
objects for tests. I think it's still more sensible than making it an instance method inAuditEvent
and we can either go back to mocking the toString or perhaps restructure the tests to make the cases clearer when the method moves.AuditEventSaveTaskTest.getTestFormIndex
is certainly not good because it does a whole bunch of work that is not real Collect code.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Position predicates will only be added to nodes that are backed by repeats. This has the potential to be disruptive depending on the kind of analysis people are doing but it's important to make sure we're spec-compliant.
Do we need any specific form for testing your changes? If so, please attach one.
nested-repeats-for-audit.xml.txt and audit-group-multiplicity.xml.txt
test.xml.txt
Does this change require updates to documentation? If so, please file an issue here and include the link below.
getodk/xforms-spec#248
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.