Skip to content

fix(workflow-code): staging QA fixes for runtime, promote, workspace and CLI source - #10262

Merged
waleedlatif1 merged 63 commits into
stagingfrom
fix/workflow-code-qa5
Nov 21, 2026
Merged

waleedlatif1 merged 63 commits into
stagingfrom
fix/workflow-code-qa5

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Fixes from end-to-end QA of workflows and workspace as code on staging, after #10237 and #10238. Five QA lanes ran (CLI workflow, workspace, editor and non-code, stress and safety, maintainability), plus an independent review of the fixes. No P0s were found. Every behaviour fix has a test that was seen to fail with the fix reverted.

Runtime and editing

  • In sync runs, child-workflow selected outputs now match block names after normalizing them, the same way the parent and streaming paths do. This was a bug in fix(executor): selected outputs no longer fail runs that call a child workflow #10232.
  • A condition that joins two branches inside a loop now reads the branch that ran in the current iteration. Before, it could read a previous iteration's executed flag.
  • Renaming a block through the operations path (used by Copilot and the API) now rewrites references to it. The editor, import and operations paths share one helper, rewriteBlockNameReferences. This also removes the editor store's copy, which had an unescaped regex and a stateful global regex.
  • The operations path coerces a numeric-string loop iterations or parallel count to a number. Any other value is refused; before, it was silently reset.

Workspace source and promote

  • A promotion deletes what the directory deleted since the last promotion, and only with --allow-delete. Resources that exist only in the target are kept and listed. Deleting them needs the new --delete-target-only flag, which is accepted only together with --to and --allow-delete. The promotion record no longer records target-only entries.
  • The stale hint on a promotion no longer suggests deleting the promotion record, because doing that would silently overwrite changes made in the target.
  • Dropping a managed table's column clears its cells in the same transaction, in one pass, with a timeout scaled to the row count. Before, the cells were cleared in the background, which looked like false row drift.
  • Workspace dry runs are charged to the plan rate budget instead of the write budget.
  • Findings have clearer wording: name taken, table folder, stale, refused delete, skipped resource, and findings no longer listed twice.

Compiler and CLI

  • A variable whose value is falsy can now be renamed and keep its id.
  • status and apply ignore function files that no codeFile() names, in both workflow and workspace directories.
  • A block moved into or out of a loop or parallel is laid out again.
  • check and the server agree on an unknown dropdown option on a changed field. Option lists that depend on the deployment stay a warning in the offline check.
  • Pruning removes only function files the CLI itself wrote.
  • The directory lock is released on Ctrl-C.
  • A NUL byte in a path is refused with E_CODE_FILE_PATH.
  • Finding totals count every finding.
  • The deploy command that apply prints is pinned to the saved draft, and a no-op apply --deploy does not redeploy.
  • The workflow-code rule's paths: patterns now cover the folders from wave 2.

Contract changes

  • New --delete-target-only flag for promotions.
  • Catalog options carry an optionsVary marker. The OpenAPI spec and the CLI types are regenerated.
  • A no-op apply --deploy skips the deploy when the live version already matches. To re-register webhooks or schedules, use sim workflows deploy.

Testing

  • The local gate passes: every workspace type-check and package suite, apps/sim and realtime units, integration suites in migrate and push modes, goldens, check:audits, check:test-types, migrations, docs compatibility, lint and the root type-check.
  • No golden file changed.

… in sync runs

findChildSpanOutput compared the normalized span name with the caller's raw block ref, so a capitalised or spaced child block name was silently omitted while the parent and streaming paths matched it.
…an this iteration

resolveSourceBlockId took the first incoming block whose state said executed, and a block state keeps that flag across loop iterations, so the edge drawn first won. It now reads executedBlocks, which the loop clears between iterations.
…to the block

The ops path (Copilot, API, sim workflows operations apply) only set block.name, leaving <oldname.field> references dangling, so runs emitted the raw template. The reference rewrite moves to lib/workflows/references/block-rename.ts and the editor rename, workflow import, and ops rename all use it; the editor store's inline copy (unescaped regex, stateful global test) is gone.
…ount on the ops path

An operations batch stored iterations: "3" or count: "2" as a string, which the loader then reset to its default (1 iterations, 5 branches) with no error. A numeric string is now stored as its number, as slider inputs coerce; any other value is an input validation error that keeps the current count, so --atomic refuses it.
… since the last one

A resource the promotion record holds that the directory no longer declares
stays in the base, so the apply plans its delete and refuses it without
--allow-delete, as an apply to the directory's own workspace does. Only
resources no promotion left in the target are named W_PROMOTE_DELETES_TARGET_ONLY.
…e record

Deleting .sim/targets/<id>.json made the next promotion overwrite every change
made in the target since, rows its workflows wrote included, while the hint
read as keeping the target's version. The hint now offers only the flows that
keep the target's data and says what deleting the record does.
…wn transaction

The strip ran after commit in the background and moved the managed rows'
version after the apply recorded it, so the next status reported server row
drift and a delete of the table was refused as stale. For a managed table the
strip now commits with the reshape, so the recorded version holds it.
…gs say what to do

A workflow create refused for a taken name gets its file and a hint, without
the use case's 'or in another folder', which a directory cannot express; the
workspace guide's exit table names E_NAME_TAKEN. E_TABLE_FOLDER and
E_KB_FOLDER name the folders create command, and the credential finding no
longer reads 'has no a slack credential'.
…drift hints the target

The plan line of a resource refused as stale said 'kept as the server has
it'; it now says the edit is refused as stale. A promotion's W_SERVER_CHANGED
pointed at a get of the directory's own workspace; it now names a get of the
target.
…orkflow once

A workflow's commit runs its pipeline again and re-reported every finding its
plan had found, so a real apply listed each warning twice. A write's finding
now replaces the plan's (matched without the block id the commit gave it).
A table over 10,000 rows (or any resource the get cannot read as source) was
only counted in the result, with the reason in .sim/skipped.json. The get now
prints each skipped resource with its reason.
…her kind's stale finding has

The workflow pipeline's E_APPLY_STALE carried its single-directory advice in
the message and no hint; a workspace plan now reports it as staleFinding does
for every other kind, naming the folder and the get to run.
…k leaves the next command's lock

The lock's interrupt release stayed installed while the command removed the
folders it created, and it removed the lock path by name. A second command could
take the lock in that window, and an interrupt then deleted the second
command's lock. The release targets the lock only until this command removes it.
… parallel's collection and conditions

renameBlock rewrote references only in sub-blocks, so a loop iterating
<fetch.items> kept the old name after Fetch was renamed and failed at run time.
It now also rewrites the collection, while and do-while conditions a loop or
parallel holds in data, which the loop and parallel records are rebuilt from.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@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 89 files

Confidence score: 3/5

  • In command-lock.ts, a deferred SIGINT can make rmSync delete a lock created by another command if the asynchronous removal hasn’t finished. Verify the cleanup still owns the lock before removing it.
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/sim-cli/src/commands/protocol/source-dir/command-lock.ts">

<violation number="1" location="packages/sim-cli/src/commands/protocol/source-dir/command-lock.ts:198">
P1: `released` is set only after asynchronous `rm` resolves. If another command recreates the lock before that continuation runs, a deferred SIGINT still makes `rmSync(lock)` delete the new command’s lock. Remove the lock synchronously or verify ownership before signal cleanup targets it.</violation>
</file>

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

Turn on auto-fix | Re-trigger cubic

…till names this command

Clearing a flag after the async rm left a window: once the folder was gone,
another command could create the lock before the flag was set, and an interrupt
then deleted it. The interrupt release now reads the lock's owner record and
removes the lock only when it names this process and host (before the record is
written, the lock is this command's by construction).
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@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 89 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

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/sim-cli/src/commands/protocol/source-dir/command-lock.ts">

<violation number="1" location="packages/sim-cli/src/commands/protocol/source-dir/command-lock.ts:211">
P3: If the lock removal throws, `disposeSignalRelease()` is never reached, so the SIGINT/SIGTERM listener stays installed. Previously it was released before `rm`. Wrap the removal in `try { ... } finally { disposeSignalRelease() }` so the listener is always released.</violation>
</file>

@waleedlatif1
waleedlatif1 merged commit 6787693 into staging Nov 21, 2026
85 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/workflow-code-qa5 branch November 21, 2026 03:51
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@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 89 files

Confidence score: 5/5

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

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — 84e9d15a Deployed Nov 21, 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