getodk / briefcase

ODK Briefcase is a Java application for fetching and pushing forms and their contents. It helps make billions of data points from ODK portable. Contribute and make the world a better place! ✨💼✨
https://docs.getodk.org/briefcase-intro
Other
60 stars 154 forks source link

Briefcase freezes when exporting forms that have a null version #839

Closed DavisRayM closed 4 years ago

DavisRayM commented 4 years ago

Software versions

Briefcase v1.17.1 & Briefcase v1.17.0

Problem description

Briefcase freezes while trying to export a form whose metadata.json has a null on the version. The logs show no error / warning and Briefcase just keeps infinitely loading.

Steps to reproduce the problem

Set version to null in the metadata.json of a form and try exporting the form

Expected behavior

Briefcase should raise/log an error and stop exporting

ggalmazor commented 4 years ago

Thanks for reporting this, @DavisRayM!

ggalmazor commented 4 years ago

Do you intend on working on a solution to this issue, @DavisRayM? Asking before jumping in :)

DavisRayM commented 4 years ago

Sadly, I'm a bit too swamped to work on this...

ggalmazor commented 4 years ago

No prob! I'll take it :)

ggalmazor commented 4 years ago

OK, so far, this is what I got:

This rules out just having null version in the metadata.json file as the single cause for the reported error, which indicates that the issue has a more complex cause

ggalmazor commented 4 years ago

I was able to get an error if I pulled a form with a version and then, after closing Briefcase, I changed its version to null in the metadata.json file.

This is expected because we use a combination of the form's id and version as a key to identify forms and link them to their submissions. The error comes because there's a mismatch between the form's definition - which has version - and its metadata - which doesn't have version.

In any case, I'm not sure we should support this kind of scenarios where users tamper with files created by Briefcase.

Also, I'm not 100% sure this is what you originally did to get your error, @DavisRayM... Could you explain how to reproduce the error with more detail? Specifically, I'd be interested about:

DavisRayM commented 4 years ago

Hey,

Not quite sure if this would be of help but noticed that the metadata.json is a bit different from the one the Untitled Form brings back.

Metadata.json for the form raising issues

{
  "key" : {
    "name" : "lets_try",
    "id" : "aiw5KNVFDkB3TZWso5qpw4",
    "version" : null
  },
  "formDir" : "forms/lets_try",
  "hasBeenPulled" : true,
  "cursor" : {
    "type" : "empty",
    "value" : null
  }
}
ggalmazor commented 4 years ago

Would it be inconvenient if i provided user credentials and a form that causes the uses for you to utilize in testing ?

Yes! :) You can send them to ggalmazor@gmail.com if you'd rather not publish them here ;)

ggalmazor commented 4 years ago

Not quite sure if this would be of help but noticed that the metadata.json is a bit different from the one the Untitled Form brings back.

If you're referring to the different cursor structure., it's fine. It's because Ona and Aggregate use different cursor approaches.

DavisRayM commented 4 years ago

Hey, sent the credentials.

ggalmazor commented 4 years ago

Thanks!

I've been able to narrow down the cause of the problem. It turns out that when Briefcase asks Ona for the remote form list, Ona it's reporting that the Testing Form has no version, and creates a metadata.json file with a null version accordingly.

The problem is that when the form is pulled, there's a mismatch between the form's definition, that has version v2E67Yj8FPMji2fK4r6bJ8, and the metadata file, that has no version, and this is what's causing issues during export.

ggalmazor commented 4 years ago

The bad news is that Briefcase doesn't expect to change identifying data such as the form's version when pulling them, which means that fixing this Briefcase-side will be a complex thing to do that will affect other pull sources too.

The easiest fix would involve Ona reporting the form's version correctly. ~I'll create an issue in their tracker to inform about this.~

We can keep this issue open for now, just in case.

DavisRayM commented 4 years ago

The bad news is that Briefcase doesn't expect to change identifying data such as the form's version when pulling them, which means that fixing this Briefcase-side will be a complex thing to do.

The easiest fix would involve Ona reporting the form's version correctly. I'll create an issue in their tracker to inform about this.

We can keep this issue open for now, just in case.

Thank you, an issue to deal with Ona not returning a version has already been opened. Was just not quite sure if that was the only cause of this.

Feel free to comment or track the issue here

Thanks once again :)

ggalmazor commented 4 years ago

Thank you @DavisRayM!

ggalmazor commented 4 years ago

Closing this issue, since it looks like we're trying to address a solution in Ona first.