Skip to content

fix(workflow-code): keep stored values an unchanged source round trip used to rewrite - #10527

Merged
waleedlatif1 merged 5 commits into
stagingfrom
fix/wac-real-roundtrip
Dec 1, 2026
Merged

waleedlatif1 merged 5 commits into
stagingfrom
fix/wac-real-roundtrip

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

An unchanged source get → source apply now leaves these stored shapes byte-identical instead of rewriting or clearing them:

  • Condition/router branch value that doesn't lift into rows (retired native { id, next, label, expression } rows, or ''): it used to print as nothing and apply wrote null. It now prints as conditions: raw([...]) (a condition uses the generic block('condition', …) form) or routes: raw(''), compiles back verbatim, and is written in the encoding source gives it.
  • inputFormat holding a non-list object (a pasted schema such as { name, type, schema, description }): it compiled as the record sugar and invented start fields. It now prints as inputFormat: raw({...}).
  • Webhook token minted on create: re-applying the source that created the workflow (which leaves the token out) cleared it. Materialize now restores a stored value of a field creation mints (mintsFreshValue) when source leaves it out.
  • Native JSON object/array in a JSON code field (api.body, response.data, agent.responseFormat, …): it was rewritten as JSON text. It now compiles back native when the stored field is native; text stays text.
  • Files mode: no more codeFile() for a code param printed under meta.extra, which compile refused.
  • Agent tool whose params repeat the operation its builder pins: params.operation was dropped. Such a tool now prints as raw(tool).
  • Refusals (E_TARGET_TRIGGER, E_EDGE_NOTE, E_EDGE_SCOPE, …) are unchanged.
  • Not fixed here: a loop or parallel holding a stray triggerMode: true still resets to false on apply. Keeping it would make compile refuse every edge into that container (E_TARGET_TRIGGER).

A round-trip check over a broad set of existing workflow shapes surfaced each of these classes; every one is reproduced by a synthetic fixture below.

Type of Change

  • Bug fix

Testing

  • New regression fixtures, all synthetic:
    • stored-shapes corpus cases: legacy native rows, '' branches, schema object and object text in inputFormat, native JSON object/array in api/response, apollo code param under meta.extra
    • agent-tools case params-repeat-operation
    • a re-apply corpus for null webhook tokens, run by the "applies printed source as a new workflow, then re-applies it as a no-op" property
  • Each guard reverted on its own turns its fixture red (P0/P1/P2/P6/P7, P3, P5, or re-apply); restored, all are green.
  • packages/workflow-code: 812 tests pass. apps/sim lib/workflows/code, including every corpus suite and the typecheck corpus: 267 tests pass.
  • Consumer suites pass: sim-cli, workflow-sdk, workspace-code, and the apps/sim blocks/application/contracts tests.
  • bun run generate, bun run lint, bun run type-check, check-block-registry pass.
  • check:audits passes except check:unused-exports, which fails only on apps/docs .content/registry: that file isn't generated in a fresh worktree, and this PR doesn't touch it.
  • bun run test: one load timeout in real-catalog.test.ts, which hit its 10s limit under the full-suite load and takes 1.7s alone.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

… used to rewrite

- condition/router branch values that do not lift into rows (retired native rows, '') print as
  raw(...) and are written back verbatim instead of being cleared
- an inputFormat holding a non-list object prints as raw(...) instead of compiling as record
  sugar into invented start fields
- a value creation mints (webhook token) that source leaves out keeps its stored value on apply
- a JSON code field stored as a native object or array compiles back native, not as JSON text
- files mode no longer emits codeFile() for a code param printed under meta.extra
- an agent tool whose params repeat its pinned operation prints as raw(tool)

Regression fixtures: stored-shapes corpus cases, an agent-tools case, and a re-apply corpus the
re-apply property runs.
…ures

- one storedParamOf lookup in compile, ValuePrinter.raw for raw(json) prints, the branch print
  arms merged, the pinned-param check folded into toolParamsTyped
- shared caseSubject for corpus subjects; the generator test pins every regression fixture id
  and the re-apply test pins its cases
@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 3:30am 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 15 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/5 · The PR appears safe to merge; no new blocking issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Keeps stored workflow values unchanged through a source round trip.

  • Condition and router blocks keep branch values that do not fit current branch rows.
  • Schema objects and code-field values keep their stored shapes in workflow source.
  • Agent tools keep parameters that repeat an operation pinned by their builder.
  • Webhook tokens minted during creation survive when source leaves them out.

No new actionable issues found. Tests were not run during this review.

Reviews (4) · Last reviewed commit: "fix(workflow-code): keep an explicit nul..." · Reviewed by Greptile

Leaving a minted field (webhook token) out of source keeps the stored value; writing it as null
now compiles to an explicit null param, so apply clears it instead of restoring it.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 16 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

…a no-op

An explicit null on a minted field now compiles to a clear only when the stored block holds a
value, so re-applying it over a cleared token no longer reports a change.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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.

1 issue found across 16 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/workflow-code/src/compile/blocks.ts">

<violation number="1" location="packages/workflow-code/src/compile/blocks.ts:917">
P2: Preserve an explicit `token: null` for a new webhook; this guard drops it, so the first apply stores a minted token and the next apply clears it. Distinguish a new block from an existing block whose token is already cleared.</violation>
</file>

A new block's `token: null` compiled to nothing after the no-op fix, so create minted a token and
the next apply cleared it. The clearing null is now written for a new block as well as over a stored
value, and skipped only when the stored block already holds none.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 16 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

@waleedlatif1
waleedlatif1 merged commit c2d0e6b into staging Dec 1, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/wac-real-roundtrip branch December 1, 2026 04:30

This branch was previously deployed

1 inactive deployment
Preview — 2cb1a120 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