Skip to content

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

Open
waleedlatif1 wants to merge 52 commits into
stagingfrom
fix/workflow-code-qa5
Open

waleedlatif1 wants to merge 52 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.
…lete; delete them only with --delete-target-only

Plain --allow-delete on a promotion now deletes only what the promotion record
proves the directory deleted. Resources only the target holds stay out of the
base, so the server keeps them and names each (W_UNDECLARED, with a promotion
hint). --delete-target-only, which needs --to and --allow-delete, opts into
deleting them. A target-only delete the apply held back is no longer written
into the promotion record, where it read as a directory delete on the next
promotion.
…r a row-scaled timeout

The in-transaction strip ran once per dropped column under withLockedTable's
10 s default statement timeout. reshape now collects the dropped column ids and
strips them in one pass with stripDroppedColumnData, which scales the statement
and idle timeouts per row as the sibling column rewrites do. The carried-over
non-null assertion on the row filter is gone.
…codeFile() names

readWorkspaceDir drops each file under a workflow folder's functions/ that
neither its workflow.ts nor its lock names, through the same codeFilePaths rule
the workflow directory status uses. A workspace status no longer reports such a
file as a local change (exit 11 forever), names it on the 'Not named by any
codeFile()' line, and an apply no longer sends that folder whole for it.
… the edit sets, and not on deployment-shaped options offline

The server now passes the fields its value gate judges (changedSubBlockFields)
into the shared refusal rule, so a stored out-of-options value written bare
again on an edited block is no longer refused. The catalog marks options a
registry function derives from deployment settings (optionsVary); the CLI's
offline check keeps a value outside them a warning, since its cached catalog may
have been built under other settings, and leaves the verdict to the server.
…ing the block id when it names no key

The write-time finding dedup dropped blockId from the key outright, so two
findings that differed only in the block they named by id merged into one.
… of at least 1 on the ops path

containerCount took whatever Number() accepted, so "1e3", "0x10", "2.5",
"-1" and "0" (and the numbers -1 and 2.5) were stored silently. They are now
refused as input validation errors, the bound source compile holds a count to.
…y per code and block

Reporter.omitted kept one object per warning past the caps. It now counts them
per code and block, so what a compile keeps stays bounded by the blocks it
reads; the CLI check sums the counts.
…kspace and tool

The spy edited its tool on any delete authorize call, so a test that timed out
with the spy still installed could edit the tool of whichever test ran next.
… not the write budget

A workspace apply with ?dryRun=true writes nothing and runs what a plan runs,
yet drew one write unit per workflow folder from the 40-token bucket real
applies share, so the preview of a 61-workflow apply left the apply waiting
about two minutes. The route's new sourceApply policy charges a dry run to the
source-plan bucket the status plan route uses and a real apply to the write
bucket, each still per folder sent with its files and capped at the smaller
bucket.
@vercel

vercel Bot commented Nov 20, 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 Nov 21, 2026 12:49am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 2/5

[High impact] The changes reach workflow runs and source applies across workflow and workspace workflows.

Fix the offline option check, falsy count refusals, and combined variable renames before merging.

Findings

  1. P1 Valid options still fail checks ▶
  2. P1 Bad counts become defaults ▶
  3. P1 Combined renames lose variable ids ▶
  4. P2 Ignored files look deleted ▶

Summary

This PR fixes workflow execution and editing, makes workspace promotions safer, and improves CLI checks and source-directory handling.

  • Workflow runs use the current loop branch and match child outputs by normalized names.
  • Block edits keep references, valid container counts, and workflow identity in step.
  • Workflow source checks distinguish changed fields and deployment-dependent options.
  • Promotions keep target-only resources unless the operator asks to delete them separately.
  • Workspace source applies report findings once and charge dry runs to the plan budget.
  • Managed table rows lose dropped-column cells in the schema transaction.
  • Workflow source commands check, write, and deploy against the same saved draft.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Directory[Workspace directory] --> Promotion[Build promotion submission]
  Record[Previous promotion record] --> Promotion
  Target[Current target resources] --> Promotion
  Promotion --> Declared[Apply declared resources]
  Promotion --> Removed[Previously promoted resource removed locally]
  Promotion --> TargetOnly[Resource only in target]
  Removed --> AllowDelete{allow-delete?}
  AllowDelete -->|Yes| Delete[Delete resource]
  AllowDelete -->|No| Refuse[Refuse deletion]
  TargetOnly --> Explicit{delete-target-only and allow-delete?}
  Explicit -->|Yes| Delete
  Explicit -->|No| Keep[Keep and warn]
  Declared --> Save[Save promotion record]
  Delete --> Save
Loading

Reviews (1) · Last reviewed commit: "chore(audits): shrink the non-null asser..." · Reviewed by Greptile

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

All reported issues were addressed across 86 files

This PR changes a public API contract. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

…the default strict mode

The optionsVary exemption skipped the edit refusal but the strict raise still
turned W_UNKNOWN_OPTION into an error on a new block. Listed, withheld and
omitted findings now all skip the strict raise when the option varies by
deployment.
…dd and nested edit

The add and nested-edit paths guarded on a truthy value, so 0, false, null and
'' skipped containerCount and saved the default. They now check presence, as
the top-level edit does.
…d block, so a reader renamed in the same edit still ties the rename
…lue after apply, and the strip without polling

This branch was previously deployed

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