fix(workflows): preserve valid empty strings during import - #7638
Open
BillLeoutsakosvl346 wants to merge 2 commits into
Open
fix(workflows): preserve valid empty strings during import#7638BillLeoutsakosvl346 wants to merge 2 commits into
BillLeoutsakosvl346 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
The PR should not merge until empty strings on multi-select selectors continue to normalize rather than being preserved as scalar values. Findings
|
| ]) | ||
|
|
||
| function acceptsEmptyString(type: string, config?: SubBlockConfig): boolean { | ||
| if (EMPTY_STRING_TYPES.has(type) || type.endsWith('-selector')) return true |
Contributor
There was a problem hiding this comment.
Multi-select blanks stay scalar
Multi-select selectors store arrays, but this condition treats every selector as accepting an empty string. When an imported workflow contains a legacy '' for a multi-select selector such as departmentIds, folderSelection, or channelFilter, sanitization preserves that scalar instead of normalizing it, leaving the field with a value that conflicts with its array contract. Exclude multi-select selectors from empty-string preservation.
Suggested change
| if (EMPTY_STRING_TYPES.has(type) || type.endsWith('-selector')) return true | |
| if (EMPTY_STRING_TYPES.has(type) || (type.endsWith('-selector') && !config?.multiSelect)) return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workflow import converted every empty subblock string to
null, losing cleared text and explicit empty dropdown choices. Preserve empty strings for scalar string-valued controls and declared single-select empty choices, using the repaired field type. Multi-select fields retain legacy blank-to-null normalization and preserve valid empty arrays; invalid dropdown blanks still allow configured defaults.Validation: 42 focused import/roundtrip/sanitization tests pass (5 regression cases added), app typecheck passes, changed-file Biome and API validation pass. The roundtrip regression fails on staging with
nullinstead of''. Browser import/export passed with a synthetic three-block workflow: exported cleared code and sandbox selection stayed'', explicit language stayednull, and input-format stayed[]. Running the imported workflow succeeded and displayed'',null,0, andfalseunchanged in its output.