zooniverse / caesar

Backend automation and orchestration
https://zooniverse.github.io/caesar
Apache License 2.0
13 stars 13 forks source link

Parsing / re-parsing issue for single string as extractor key input for UI form #1580

Open lcjohnso opened 1 year ago

lcjohnso commented 1 year ago

The following issue was discovered while helping M. Denslow in #notes-from-nature Slack channel (private link to Slack thread).

Although the default placeholder example suggests that the input for the extractor_keys filter parameter be an array of strings (e.g., ["extractor_1", "extractor_2", "extractor_3"]), the reducer form allows a single string to be input as well (e.g., "extractor_1"). However, when that single string is read back in to the form for reducer config editing, it appears without quotes and when the form is submitted, the submission returns an error.

The Sentry error clearly explains this is a JSON parsing issue, however the user only receives a vague, generic error: "We're sorry, but something went wrong."

If a single string value is going to be allowed, what change needs to be made such that when it is read back into the form during reducer editing that resubmission of the existing value will be allowed? Is this issue somehow related to how existing parameter settings are ready back into the form, as added in https://github.com/zooniverse/caesar/pull/1389?