Skip to content

fix(cli): pick a trigger in workspace apply --run and skip deployment reads of new workflows - #10539

Open
waleedlatif1 wants to merge 4 commits into
stagingfrom
fix/wac-qa-b7-workspace-run-trigger
Open

waleedlatif1 wants to merge 4 commits into
stagingfrom
fix/wac-qa-b7-workspace-run-trigger

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

What

Workflows-as-code QA batch B7: sim workspaces source apply --run can test a workflow with several triggers, and the apply no longer reads the deployment of every workflow it just created.

A workflow with more than one trigger could never be test-run in a workspace apply.

  • Before: --run <key>=<input> had no way to name a trigger, and a repeated key was refused. For a workflow with an API and a webhook trigger, the server refused the run with its raw message (naming the wire field run.entry.blockId, ending in ..). next then repeated the same failing --run, so an agent following it looped, and deployments/ for that workflow could never be applied under --run.
  • Now: --run <key>.<trigger>=<input> names the trigger by its const, block key or id, resolved through the saved lock, the same way sim workflows source apply --run <trigger>=<input> does. A key may repeat once per trigger.
  • The workspace path now reuses runTests from workflow-test-runs.ts. The multi-trigger and not-a-trigger refusals are rewritten in --run terms (--run 'two.apiIn={…}' (or two.hook=<its input>)), and next.command names that trigger instead of repeating the refused value.
  • Trailing punctuation is stripped from each run's failure before the sentence continues.

One deployment GET per written workflow (N+1).

  • A workflow this apply created, with no deployments/ change for it, cannot be deployed. It is now reported as not deployed without a GET /api/v2/workflows/{id}/deployment.
  • A 60-workflow create now sends 0 deployment reads, down from 60 (each counted against the caller's public-API bucket).
  • Updated workflows and deployed keys still read their status, which has their webhook URLs.

Docs.

  • workspace.mdx, the workspace primer, loop help and the directory AGENTS.md text now describe the <key>.<trigger> form.
  • They also describe the untested-draft gate: deployments/ is skipped, and the apply exits non-zero, when it would publish a draft no --run tested.
  • The CLI reference was regenerated.

Not in this PR

  • Returning per-workflow deployment drift in the workspace apply response, so updated workflows need no GET either. That needs a v2 contract change and touches the workflow adapter, which batch B2 is changing. I took the minimum fix the plan allows and left the passthrough as a follow-up.

Tests

In workspace-source-apply.test.ts. I reverted each guard on its own and watched its test fail before restoring it:

  • tests each trigger named as <key>.<trigger>, then applies deployments/: two runs go through b-api and b-hook, then deployments/ is applied.
  • names the triggers and a next that picks one when a --run names none: no run.entry.blockId, no .., and next is --run 'ingest.apiIn={…}'.
  • maps an input the server refuses…: the server message now ends in ., which guards against the doubled period.
  • reads no deployment of a workflow it created without a deployments/ change: 60 created workflows, 0 deployment GETs.
  • refuses the same workflow and trigger twice.

The full sim-cli suite passes (1336 tests), along with sim-cli type-check, lint and check:audits.

Risks

  • --run values with a period before the first = now read as <key>.<trigger>. Workflow keys cannot hold a period ([a-z][a-z0-9_-]*), so no valid key changes meaning.
  • runTests gains an optional flag formatter. The single-workflow path passes none and is unchanged, and its tests still pass.

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Building Building Preview Dec 1, 2026 9:12am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Adds trigger selection to workspace apply runs and skips deployment reads for newly created, undeployed workflows.

  • Workspace apply can test a workflow through each named trigger.
  • New workflows without deployment changes skip deployment-status reads.

Reviews (4) · Last reviewed commit: "fix(cli): refuse two --run names of one ..." · 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 9 files

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

Turn on auto-fix | Re-trigger cubic

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

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.

All reported issues were addressed across 9 files

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

Turn on auto-fix | Re-trigger cubic

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

… reads of new workflows

- --run <key>.<trigger>=<input> enters a run through a named trigger (const, block key or id); a key may repeat once per trigger
- a multi-trigger refusal is rewritten in --run terms and next names a trigger instead of repeating the refused value; no doubled period
- created workflows with no deployments/ change report not deployed without a deployment GET
- docs, primer and loop help name the trigger form and the untested-draft gate
@waleedlatif1
waleedlatif1 force-pushed the fix/wac-qa-b7-workspace-run-trigger branch from a61be67 to e89dd69 Compare December 1, 2026 09:12

This branch was previously deployed

1 inactive (outdated) deployment
Preview — a61be673 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