Repository navigation
fix(workflow-code): keep stored values an unchanged source round trip used to rewrite - #10527
Conversation
… 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
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no new blocking issue was found. SummaryKeeps stored workflow values unchanged through a source round trip.
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.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…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.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
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.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
An unchanged
source get→source applynow leaves these stored shapes byte-identical instead of rewriting or clearing them:{ id, next, label, expression }rows, or''): it used to print as nothing and apply wrotenull. It now prints asconditions: raw([...])(a condition uses the genericblock('condition', …)form) orroutes: raw(''), compiles back verbatim, and is written in the encoding source gives it.{ name, type, schema, description }): it compiled as the record sugar and invented start fields. It now prints asinputFormat: raw({...}).mintsFreshValue) when source leaves it out.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.codeFile()for a code param printed undermeta.extra, which compile refused.params.operationwas dropped. Such a tool now prints asraw(tool).E_TARGET_TRIGGER,E_EDGE_NOTE,E_EDGE_SCOPE, …) are unchanged.triggerMode: truestill resets tofalseon 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
Testing
stored-shapescorpus cases: legacy native rows,''branches, schema object and object text in inputFormat, native JSON object/array inapi/response, apollo code param undermeta.extraparams-repeat-operationpackages/workflow-code: 812 tests pass.apps/simlib/workflows/code, including every corpus suite and the typecheck corpus: 267 tests pass.sim-cli,workflow-sdk,workspace-code, and theapps/simblocks/application/contracts tests.bun run generate,bun run lint,bun run type-check,check-block-registrypass.check:auditspasses exceptcheck:unused-exports, which fails only onapps/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 inreal-catalog.test.ts, which hit its 10s limit under the full-suite load and takes 1.7s alone.Checklist
test-auditauthoring gate)