-
Notifications
You must be signed in to change notification settings - Fork 153
When pushing to Central, push form definitions for all versions referenced in submissions #872
Conversation
Just saw this :) I'm not sure if it's ready, but I will take a lookie look anyway and see how it goes ;) |
Oops. That sounds like an unintended behavior. That information shouldn't be lost between pulls |
src/org/opendatakit/briefcase/pull/aggregate/PullFromAggregate.java
Outdated
Show resolved
Hide resolved
@lognaturel, I did a quick review and I think your approach is OK. Some thoughts/notes (probably things that you already know, though):
|
Thanks so much for taking a look, @ggalmazor, and for all the helpful feedback.
Interesting! Do you happen to remember why version is included in FormKey? I expected the form metadata repository to be keyed on logical forms rather than specific versions. Is there a reason not to do that? |
dc7226d
to
eaa45ba
Compare
9e8b3a9
to
7ea34d9
Compare
This comment has been minimized.
This comment has been minimized.
9f158bc
to
56ed077
Compare
This would allow a user to push missing form versions by retrying
56ed077
to
6726972
Compare
@getodk/testers There's a lot of behavior here and weird edge cases depending on what versions are already on the Central server and when forms were pulled. I think I've come up with something that makes sense and handles most of them (except for forms with blank versions) but before we do code review it would be helpful for you to do a discovery pass so we identify anything missing or that just doesn't make sense. |
@lognaturel I have another dose of questions/concerns:
Briefcase's status is "Success with errors" what is acceptable as draft form version is pushed but I can see another issue here which is actually more connected to Central than to Briefcase. I went to project and tried to publish draft version and I can't to that, text field to specify version is missing what makes form useless right now.
I can't see the difference between case where I am pulling form with submissions of different form versions using Briefcace 1.17.4 or PR-version and then pushing it again to new project on Central using PR-version: all submissions are sent and errors about failing to push media files are displayed only.
Here as a step "I let a push attempt complete and fail" you mean use Briefcase 1.17.4 in first push and the second push using PR-version? I do not fully understand the difference between that scenario and the other above. I have the same results. I am wondering how the last published version is actually selected on Central? Does it happen randomly? (ex. project 193). See the gif: |
I'm very puzzled about what's going on here. Do you have a form with a single version and media files that you could do a pull and then push with 1.17.4 with? I suspect there's an existing issue.
I think you got in this state by deleting a form with that form version and then trying to create it again. I agree that this can lead to a user being stuck and will explore with the Central team.
You'd have to make sure to clear your Briefcase directory before doing a pull from <=1.17.4 so that the form version cache is cleared. Then also make sure you're pushing to a project that doesn't know about that form at all.
No, the first push would have to be using the PR version. So this is download everything with Briefcase 1.17.4 after having cleared the Briefcase directory. Then go to the PR version and push. There should be failures. Then try again and it should succeed. However, the published version will not be the latest one. This I will describe in documentation. As you noticed:
If you already had things pulled in <=1.17.4, there's no information about submission versions. That means Briefcase will only push the form version it knows about and will publish it. |
|
Thanks for all the detailed checks, @kkrawczyk123. Before you dive back in, I encourage you to read through getodk/docs#1272. Hopefully that will clarify the intended behavior for weird edge cases. If not, let me know what parts are unclear!
I was seeing instance folders with absolutely no contents, not even I'm not seeing any failures to push media files anymore so maybe that was also related?
The form versions that need to be created on Central are identified on pull. If you pull on v1.17.4 and use the same storage directory to push using this PR, older form versions won't be pushed because the form version list is stored in the storage directory and v1.17.4 just doesn't record that info. But the process of pushing on this PR generates the list of form versions to push. So once you've attempted a push, that storage directory knows about all the versions, and a future push with this PR will send all form versions. Does that make sense? This might be one to hop on a quick call about if you think there might be a bug or if you're still not feeling clear on the intended behavior (don't worry, it's super hard to reason about).
Is it possible this only happens if you cancel right after the "Start pushing form definition..." message is emitted but before anything actually gets pushed? I can't get that behavior. If I cancel immediately right after tapping push, the cancel has no effect. This is a bad state but it's the same on v1.17.4. It's also unlikely so I'm not too worried about it. If I push once submissions are sending, I see something like
In that case, it's annoying because the "Cancelled" message may not be the last one. But I think it's ok. The most similar case I can get is if I cancel right after form creation:
In that case it looks like there's no final message.
Wow, that was indeed crazy! The problem was that one of the submissions had an XML media attachment. Briefcase was treating that like a form definition and then getting confused because there were two form definitions at different paths. Should be fixed, now. I believe I have addressed all of the issues you highlighted except that I wasn't able to satisfactorily reproduce the "Success" after cancelling issue. Does that sound right? If not, please summarize issues from above that are still present so we make sure we're on the same page. 🙏 |
576c199
to
a94b78b
Compare
This comment has been minimized.
This comment has been minimized.
@lognaturel I noticed a different behavior in one case. Probably it's uncommon.
The form was pushed with errors on v1.17.4. It appeared in Central. But when I tried this case with these changes, I clicked on the push but nothing happened. |
List of test cases verified/retested so far:
|
It’s looking like we’re almost there!
Is it possible the form on Central is a draft and not ending up getting published? What if you publish the draft? I will give this a try hopefully tomorrow. |
@lognaturel I looked at this case once again and I realized that the attached data are complex so I tried the same case with a much more simple form and the result was correct. I pulled this form from Aggregate and from form directory. In both cases, nothing happened when I clicked on the 'Push' button. But still, the released version is able to push it and create a draft version. |
and more cases have been verified: cmd push to Central form with submissions of different versions |
The cases look quite complete. I'll look at those two remaining issues ASAP. Thank you! |
a94b78b
to
10c1601
Compare
Previously, XML documents included as submission attachments could be identified as form definitions and lead to duplicate key issues.
10c1601
to
8cedf4a
Compare
I believe that both of you were running into the issue where form definitions used as media were causing conflicts. I had updated the method to look for form definitions but didn't update the call. It should now be fixed. |
We have confirmed that issues have been fixed. We have verified both via ui and cmd and also did quick regression check. We both agree that it's ready to go! @getodk-bot unlabel "needs testing" |
Central only accepts submissions for form versions that it is aware of. Aggregate allows limited form versioning but only retains the latest form version. Briefcase only has awareness of the last form version it pulled.
There was a v2 planned to address this and other limitations but unfortunately we've been struggling to get the time and resources to make it happen.
TODO:
This PR:
Acceptance criteria:
Given: I have pulled a form definition and submissions from Aggregate, Central, or a Collect directory from this version of Briefcase
And: the submissions are all for the active form definition's version
When: I push that form and submissions to Central
Then: the form definition and corresponding submissions are pushed without any special behavior
Given: I have pulled a form definition and submissions from Aggregate, Central, or a Collect directory from this version of Briefcase
And: some submissions are for the active form definition's version and others for prior form versions
When: I push that form and submissions to Central
Then: I see a warning with a description of what will happen, a reference to a documentation page
And: I see buttons to Cancel or Push
Given: I see a warning about pushing a form with submissions for multiple versions to Central
When: I click the Cancel button
Then: the push is aborted and nothing is pushed to Central
Given: I see a warning about pushing a form with submissions for multiple versions to Central
When: I click the Push button
Then: the push begins
Given: I have confirmed a push to Central
And: there was no form with the corresponding formId on my Central server
Then: all form versions referred to by submissions are present on my Central server
And: all submissions are pushed
And: the form version Briefcase knows about is the actively published version
Given: I have confirmed a push to Central
And: there was a form with the corresponding formId on my Central server
And: some versions that Briefcase has submissions for were not previously uploaded to Central
Then: all form versions that were not previously uploaded to Central are now on my Central server
And: all submissions are pushed
Given: I have confirmed a push to Central
And: there was a form with the corresponding formId on my Central server
And: all versions that Briefcase has submissions for were previously uploaded to Central
And: the form was deleted
Then: the form is in draft state on my Central server and can't be published because of a version conflict
And: I see errors about all of the form versions and submissions failing to upload
Given: I have pulled a form definition and submissions from Aggregate, Central, or a Collect directory from a prior version of Briefcase (<=v1.17.4)
And: some submissions are for the active form definition's version and others for prior form versions
When: I push that form and submissions to Central
Then: submissions for versions other than the version Briefcase knows about fail
And: in the details, I see a message about trying again and a reference to documentation
Given: I have pulled a form definition and submissions from Aggregate, Central, or a Collect directory from a prior version of Briefcase (<=v1.17.4)
And: some submissions are for the active form definition's version and others for prior form versions
And: I let a push attempt complete and fail
When: I retry
Then: all form versions that were not previously uploaded to Central are now on my Central server
And: all submissions are pushed
And: the form version Briefcase knows about is not the actively published version
Given: I have pulled a form definition and submissions from Aggregate, Central, or a Collect directory from this version of Briefcase
And: some submissions are for the active form definition's version and others for prior form versions
When: I push that form and submissions to Central from the command like
Then: all form versions that were not previously uploaded to Central are now on my Central server
And: all submissions are pushed