Skip to content

fix(workflow-code): store a raw() branch value as json text when it lifts into rows - #10608

Open
waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/wac-raw-branch-value-text
Open

waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/wac-raw-branch-value-text

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A condition/router branch written as raw([...]) was stored as a native array (follow-up to fix(workflow-code): keep stored values an unchanged source round trip used to rewrite #10527). The condition editor reads branches with toString() + JSON.parse, got "[object Object]", fell back to default rows, and the next edit overwrote the real conditions.
  • A raw() branch value that lifts into rows (a list of { id?, title?, value } rows with distinct ids: the shape the editor parses) is now written as JSON text, as forceText did before fix(workflow-code): keep stored values an unchanged source round trip used to rewrite #10527. A value that does not lift, such as retired native { id, next, label, expression } rows, stays as written, so the printed raw(v) reads back unchanged and re-applying it is still a no-op.
  • The new liftsIntoRows predicate sits next to liftBranches in canonicalize/branches.ts, and ParamSite.verbatim becomes ParamSite.branch ({ kind, blockId }), which the derived row ids need.

The first approach ("native only over a stored native value") broke the round-trip corpus property apply printed source as a new workflow, then re-apply as a no-op: retired native rows were stored as text and then printed as raw('…'), so they never settled. Deciding by liftability keeps that property.

Tests

  • editing.corpus.test.ts: raw([...rows]) over a stored '' is stored as JSON text. This test fails on staging with expected 'object' to be 'string'.
  • Editing a retired native branch list keeps it native. This test fails when the branch value is always stringified.
  • The @sim/workflow-code suite (835 tests) passes, along with lib/workflows/code and the editing/roundtrip/generate corpus suites (including the stored-shapes fixtures).

…ifts into rows

A condition/router branch written as raw([...]) was stored as a native array. The condition
editor reads branches with toString() and JSON.parse, so it saw "[object Object]", fell back to
default rows, and the next edit overwrote the real conditions.

A branch value that lifts into rows (the shape the editor parses) is now written as JSON text,
as before #10527. A value that does not lift (retired native rows) stays as written, so the
printed raw(v) reads back unchanged and re-applying it stays a no-op.
@vercel

vercel Bot commented Dec 1, 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 Dec 1, 2026 10:13pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

The PR stores liftable raw() branch arrays as JSON text so the condition editor can read them. Values that cannot become branch rows keep their original form.

  • Raw branch lists use JSON text when they match the editor’s row shape.

No actionable issues were found. Review checks were read-only; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["raw branch value"] --> B{"Object or array?"}
  B -->|No| C["Keep value unchanged"]
  B -->|Yes| D{"liftsIntoRows?"}
  D -->|Yes| E["Store JSON text"]
  D -->|No| C
Loading

Reviews (1) · Last reviewed commit: "fix(workflow-code): store a raw() branch..." · Reviewed by Greptile

This branch was previously deployed

1 inactive deployment
Preview — c09bdad8 Deployed Dec 1, 2026 by vercel[bot]
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