getodk / getodk/central

Questions about actors with formview assignments

Open
#1,260 0 comments 0 reactions 0 assignees View on GitHub
backend documentation
Dominant language
JavaScript
Stars
226
Forks
235
Avg merge
2d 22h
Merged PRs (30d)
19

Description

When a form is published, a `singleUse` actor is created and assigned the `formview` role. A session of 15 minutes is created for the actor. Backend then sends a request to Enketo, specifying the session token in a `__Host-session` cookie. Presumably, this is to provide Enketo access to the form. Enketo responds with Enketo IDs that are used to preview the form (among other things).

However, it's not clear to me what the exact flow is from there. Enketo doesn't seem to request the form from Backend before returning its response, because in many cases, we request Enketo IDs for a form that is not yet created or published. Does Enketo hold onto the session token and send a request for the form soon after its response, but before the session's 15-minute expiration? Is there any chance that Enketo only requests the form when a user first uses the form in Enketo? In that case, the actor with the `formview` assignment wouldn't be needed.

Another question: even if the actor is needed, is it in fact single-use? I'm thinking that Enketo must send multiple requests: first for the OpenRosa formList, then for the form's XML and maybe also the form's attachments. I'm wondering this in part because I'm thinking about when/how we should delete the actor. We could consider deleting the actor after its first use, but that wouldn't work if it's used for multiple requests. Right now, I don't think we delete these actors at all. Related: getodk/central#1238.

Whatever the answers to these questions are, I think it'd be helpful to document them in code comments.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.