https://prefect.io logo
Title
s

Serdar Tumgoren

06/27/2021, 1:02 AM
Hey all, I just noticed some quirky behavior on the Prefect Cloud UI when configuring Inputs on a Flow. I have some boolean Parameters set in the flow, and they appear to display their defaults correctly in the Cloud UI. However, when I try to switch from 
true
 -> 
false
 or vice versa, the UI appears to be converting them under the hood to strings (
"true"
 or 
"false"
 , as the case may be). This causes  conditional logic that checks for “truthiness” in my flow to behave incorrectly (i.e. conditionals expecting a 
False
 always evaluate as 
True
 since non-empty Python strings always evaluate as
True
). I verified this by toggling the values in Inputs UI and switching to the JSON configuration view of the data. I can get the Flow to run correctly by switching to the JSON configuration and correcting the issue, but figured that perhaps I’m missing something basic about the UI. Anyone have advice?
If it helps, here are some screenshots demonstrating the issue. Initial state of inputs (based on defaults specified in flow Parameters):
In the JSON view, the boolean is represented correctly
After switching from
false
->
true
in the UI, the value is converted to a string as shown in the JSON view below
Further, it seems that any time an Input value is changed via the Inputs UI, all Input values are converted strings — including values that were previously fixed via the JSON configuration. The net result seems to be that you have to configure all values via JSON configuration to avoid the reversion to strings across the board….
Sorry, one last note. It appears that simply toggling between the UI and JSON view (after the initial toggle) causes this across-the-board conversion to strings. Any advice would be appreciated!
k

Kevin Kho

06/27/2021, 10:00 PM
Hi @Serdar Tumgoren, thanks for the very detailed writeup. Will make sure the UI team sees this tomorrow.
s

Serdar Tumgoren

06/27/2021, 10:07 PM
@Kevin Kho Sure thing! Also, fwiw, I got things to work by simply not toggling to JSON mode. I haven’t dug into the internals to see what’s actually getting passed to the agent, but it seems that if I update Inputs in the UI and then perform the run, things work as expected. The Run UI displays the
true
and
false
values as proper booleans and my flow works correctly (see image below). So perhaps this is just a quirk related to toggling to JSON configuration mode? Anyhow, sorry to bug you all on the weekend with it. Let me know next week if you have any follow-ups to help reproduce the issue
👍 1
n

nicholas

06/28/2021, 3:15 PM
Hi @Serdar Tumgoren - thanks for the detailed report. This does indeed look like a bug in the toggle logic. I'll open a ticket so the UI team can look into it and get out a patch.
@Marvin open "Issue with toggling between JSON and non-JSON input on the run page"
s

Serdar Tumgoren

06/28/2021, 3:16 PM
@nicholas Thanks for the speedy response! And love the Marvin-bot 🙂
😄 1