Skip to content
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

"Form does not specify an instanceID" after second submission in an encrypted project #5644

Closed
dbemke opened this issue Jun 27, 2023 · 3 comments
Milestone

Comments

@dbemke
Copy link

dbemke commented Jun 27, 2023

ODK Collect version

the store version 2023.1.2, the beta version 2023.2 Beta 3

Android version

10, 13

Device used

Redmi 9T, Pixel 6a

Problem description

After sending a second submission of the form AuditTest to an encrypted project on Central there is the error saying that the "form does not specify an instanceID”. It only happens after sending the second submission, the first submission is sent to Central without any errors.
The error also contains "saved as finalized" referring to the previous design.
encypted2ndsubmissionAuditTest

Steps to reproduce the problem

  1. Scan the QR code with the encrypted project.
    https://test.getodk.cloud/#/projects/469/app-users
  2. Fill in and send submission of AuditTest form.
  3. Fill in and send submission of AuditTest form again.

Expected behavior

I don’t know the cause of the issue so I don’t know if the error should appear after the first submission or the form is broken or maybe it’s something related to encryption.

Other information

I uploaded the form to other project in Central and there were no warning or errors connected with the form while uploading.

@seadowg
Copy link
Member

seadowg commented Nov 1, 2023

I've been trying to boil this down to a minimal form reproduction and ended up with this:

<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa"
    xmlns:orx="http://openrosa.org/xforms" xmlns="http://www.w3.org/2002/xforms">
    <h:head>
        <h:title>Missing instance ID</h:title>
        <model>
            <instance>
                <data id="missing_instance_id" version="1">
                    <orx:meta>
                        <instanceID />
                    </orx:meta>
                    <text1 />
                </data>
            </instance>
            <bind calculate="concat('uuid:', uuid())" nodeset="/data/orx:meta/instanceID" readonly="true()" type="string" />
            <bind nodeset="/data/text1" type="string" />
        </model>
    </h:head>
    <h:body>
        <input ref="/data/text1">
            <label>Question 1</label>
        </input>
    </h:body>
</h:html>

Basically if I finalize this form twice, the second instance with have a blank instance ID. There's two changes I can make to the form to fix the problem:

  1. I can switch the way the instanceID is assigned to the way pyxform would output (with jr:preload)
  2. I can Remove the orx namespace from meta

After about it with @lognaturel, we realised that rather than it working for the first "instance", it actually only works for the first form session - if you open the form, discard it and start again you'll also end up with a blank instance ID for the first instance. This would suggest that the problem is related to form def caching.

As far as I can see, there's nothing incorrect with the form, so I'm pretty sure this is a bug rather than a form design problem.

@seadowg seadowg added this to the v2023.4 milestone Nov 1, 2023
@lognaturel
Copy link
Member

@seadowg and I briefly discussed. It's an issue with namespaced references (e.g. /data/orx:meta/instanceID) and forms deserialized from the form cache. getodk/javarosa#695 We ultimately decided that there wasn't enough value to supporting this to take it on. It doesn't really appear to be a part of XPath and downstream tools would need to be namespace-aware for it to make a difference.

I think we should update the test form and that's it.

@seadowg
Copy link
Member

seadowg commented Nov 2, 2023

Marking this as "won't fix". @dbemke you should be able to run the test form back through XLSForm Online or pyxform to fix the problem.

@seadowg seadowg closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: done
Development

No branches or pull requests

3 participants