Workflow block reset to example JSON + SEVERE editor UI inconsistency

I opened up a workflow which has been running just fine for some time, and unexpectedly saw a pretty serious looking defect in it.
The first block in this workflow (which I'll refer to as WorkflowA for clarity) is a call to another workflow (WorkflowB), and that call is supposed to reference some specific IDs and settings - we place those values in the startTrigger of WorkflowA and reference them using the {{ startTrigger.data.param_name }} pattern in the block calling WorkflowB.
But, where I expected to see those {{ startTrigger... }} lines, the editor was showing the example JSON params for the WorkflowB, here's a screenshot of what that looked like when I first open WorkflowA in the editor:

Thinking maybe someone had accidentally clicked the "reset to example JSON" button while viewing this workflow, I used the Deploy history tab to view the most recently deployed version, and was even more alarmed when it showed a slightly different layout, implying the past version had loaded, but it still showed the incorrect parameters, as shown here:

Knowing that I had deployed the most recent version, and that even if I had deployed it with that mistake in it, I would have quickly found out about my mistake due to the errors it would cause, I checked the run history... and found that the correct values were being used. The editor was supposed to be showing me the same code as was used in the run, but the params shown in the logs didn't match what was shown on screen, as you can see at the bottom of my screenshot

When I used the Deploy history to select an even earlier version, the editor updated to show the correct {{ startTrigger... expressions for the call to WorkflowB, then I selected the deployed version again, and the correct parameters persisted:

Those two screenshots are supposed to be of the same version, but they show different things, that's a pretty severe defect

I refreshed the page a few times, and on a fresh page load the editor consistently showed the example JSON params for that block. Wanting to ensure those incorrect params never got accidentally deployed, I entered the correct params in again, and tried to deploy the change, which resulted in an internal server error. I neglected to capture a screenshot of that error message or the network request, and when I reloaded the page once more, updated the params again (as they had reset to the example JSON again after the refresh), the deploy went through successfully.

My working theory is that when I first opened WorkflowA, there was likely some error while loading the settings for that get_audience block, and instead of reporting the error, the editor just fell back to the example JSON. And when I selected the deployed version in Deploy history, the editor again failed to load the settings for get_audience and left the example JSON in place. But when I loaded the earlier version, it successfully loaded the correct params, and when I swapped back to the deployed version those remained on screen.

If that theory is correct, or close to it, then I see two core defects which should be addressed:

  1. If something goes wrong while loading the parameters for a workflow block, falling back to the example JSON is NOT desirable behavior, it's in fact very very risky. I'd much rather see an empty list of parameters or an error message so I know something has gone wrong.
    Had I not noticed and deployed an update with those example params included, it could have resulted in pretty severe issues for my business. I'd rather lose the "Reset to Example JSON" functionality entirely than ever risk it happening accidentally, and it should absolutely never happen without user input.

  2. When loading a past version of a workflow through the Deploy history menu, it should not be possible to "partially load" a past version, as must be happening in order for me to see different things on screen when I navigate directly to the deployed version vs. when I first load an earlier version then load the deployed version - if any part of the previous version can't be loaded correctly, I'd MUCH prefer an error message telling me so over a seeing a partially accurate representation of that version.

Currently I don't believe this has caused any actual problems in my system. The correct code is running. But if I had been making a hasty update to this workflow, or if a new person on my team were tasked with updating it and didn't have enough context to notice the incorrect parameters, it could've been pretty bad.

Hello @Kai_Mollerud

My sincerest apologies for the confusion, I agree this is very alarming and that the workflow should not default to incorrectly showing the example JSON params when you had saved {{ startTrigger.data.param_name }} to the block.

Thank you for the thorough write up on the situation. I can relay this to our engineering team and ensure that users are properly notified if the workflow block's UI needs more time to properly load in the params it was saved with.

I hope that the UI state containing the default JSON was simply a visual placeholder, and that if a user had saved the app or made any other changes that the code behind the UI would have stayed set to {{ startTrigger.data.param_name }} as I am fairly confident it is not possible for saved data in a workflow block to be changed without direct user input.

We will investigate and try to reproduce this behavior to see what conditions might have lead to the block changing without your input, and to confirm that if the visual change happens that the code and state has not changed or fix the issue if it has unintentionally changed.

I do not believe that we have any 'intended' functionality for users to 'Reset to Example JSON" as far I am aware. But I will want to double check this now to ensure this is correct.

For your second point on discrepancies when loading past versions, I completely agree, we want to ensure that there is no confusion when comparing versions and can definitely make sure that if needed, there is latency on loading to get the full visual presentation accurate.

You mentioned that the two screen shots should show the exact same view of the app, could you direct me to what parts of the screenshots are different? :sweat_smile:

If any other users have experienced a similar issue, add on to this comment thread to let us know so we can better understand what might be causing the workflow block to display incorrectly Test JSON Parameters instead of the correct information!

Also quick question, how are you triggering the workflow?

Are you using a webhook?

It looks like we have a bug report where default params are passed in when users have a ternary operator involved in the workflow code :sweat_smile:

The parameters to the get_audience block differ in the 2nd and 3rd images of my initial post - these images should both be showing v0.2.1, but in the first you can see the block passes 6 parameters to the workflow, all of which have their values specified directly, while in the second only 4 parameters are passed, and all of them use {{ notation }} to pass values from startTrigger. The first image is showing the example JSON parameters, while the second shows the intended configuration.

how are you triggering the workflow?

This workflow usually runs via daily schedule, in my testing for the initial post my runs were triggered manually via the workflow editors "run" button. This workflow does not have a webhook trigger configured.

After making my initial post I did observe another related defect - the day after deploying an update to this workflow it encountered a runtime error during it's scheduled daily run, and when I opened it to investigate I found that another block (later in the flow, not included in my screenshots) which calls another workflow, had it's parameters cleared out entirely.
I wasn't able to document the issue in detail, but the effected block was supposed to have 7+ params, the example JSON for the workflow it calls has more, and to the best of my recollection I didn't edit any of the parameters for that block, much less delete all 7+ of them.
Assuming these issues are related, I'd suspect that the root cause is the intended parameters for these blocks somehow failing to load, and in some situations the UI falls back to showing the example JSON, while in others it might populate with a blank list.