Skip to content

fix(workflows): preserve valid empty strings during import - #7638

Open
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/platform-workflow-empty-strings
Open

fix(workflows): preserve valid empty strings during import#7638
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/platform-workflow-empty-strings

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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 null instead of ''. Browser import/export passed with a synthetic three-block workflow: exported cleared code and sandbox selection stayed '', explicit language stayed null, and input-format stayed []. Running the imported workflow succeeded and displayed '', null, 0, and false unchanged in its output.

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 9, 2026 1:37am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

The PR should not merge until empty strings on multi-select selectors continue to normalize rather than being preserved as scalar values.

Findings

  1. P1 Multi-select blanks stay scalar

Summary

  • Resolves malformed subblocks using their configured field type.
  • Preserves empty strings for recognized string-valued controls and selectors.
  • Adds import round-trip and focused sanitization regression coverage.
  • The selector classification needs to distinguish single-select from array-valued multi-select fields.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Imported subblock value is empty string] --> B[Repair metadata from block config]
  B --> C{Control accepts empty string?}
  C -->|Text-like or declared empty single-select| D[Preserve empty string]
  C -->|Non-string or invalid dropdown blank| E[Normalize to null]
  C -->|Current blanket selector branch| F[Multi-select selector incorrectly preserves scalar empty string]
Loading

])

function acceptsEmptyString(type: string, config?: SubBlockConfig): boolean {
if (EMPTY_STRING_TYPES.has(type) || type.endsWith('-selector')) return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant