Skip to content

improvement(workflow-code): sim workspaces source apply --run tests workflows, gating deployments/ - #10450

Merged
waleedlatif1 merged 6 commits into
stagingfrom
improvement/workspace-apply-run
Nov 27, 2026
Merged

waleedlatif1 merged 6 commits into
stagingfrom
improvement/workspace-apply-run

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • sim workspaces source apply --yes --run <key>='<input>': after the apply, dry-runs each named workflows/<key>/ draft as sim workflows run --dry --input does (input JSON or @file, repeat --run per workflow), mirroring sim workflows source apply --run
  • Each run is one entry in runs (workflow key and id, status, output, side effects); a run that does not complete exits 1, maps its failing block to file:line in workflows/<key>/, names the same apply as next, and leaves the applied drafts in place
  • Deploys are gated: with --run, the first write leaves deployments/ out, and a second write (only: workflow, deployment) applies it only after every run completed, so live: 'draft' publishes only a tested draft (the server vouches for it through the workflow folder bases the first write saved; no new deploy path). The first write's W_DEPLOYED_DRAFT_CHANGED for those workflows is dropped, since the second write decides them
  • Refused before anything is sent: --run with --dry or --to, an --only without workflows, an unknown key (naming the keys there), a repeated key, or input that is not JSON
  • Workspace primer (still within 4096 bytes; workflow primer unchanged), AGENTS.md pointer, workspaces source --help, the advanced guide, exit codes and docs teach the one-call loop sim workspaces source check --dir . && sim workspaces source apply --dir . --yes --run <key>='{…}'
  • TestRun/testRunResult move to workflow-run-follow.ts so both apply commands share them

Type of Change

  • Improvement

Testing

  • workspace-source-apply.test.ts --run block: completed run (two writes, deployments in the second), failed run (exit 1, file:line, no second write), unknown key, not-JSON input, --to and --dry refusals; each fails on the pre-change code, and the gating tests fail with the deployment split reverted
  • bun run generate, bun run lint, bun run type-check, bun run check:audits (incl. client-boundary and sim-cli bundle audits), root bun run test, block-registry check

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)

@vercel

vercel Bot commented Nov 27, 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 27, 2026 1:33am 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.

All reported issues were addressed across 13 files

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

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 27, 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

Adds sim workspaces source apply --run to test saved workflow drafts before applying deployments/.

  • Workspace applies can test selected workflow drafts before applying deployments.
  • Deployments keep chat outputs matched to the workflow draft going live.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Apply[Apply resources and drafts] --> Run[Test named workflows]
  Run --> Result{Every run completed?}
  Result -->|No| Keep[Keep drafts; skip deployments]
  Result -->|Yes| Files[Check files have not changed]
  Files --> Chat[Check and repair chat outputs]
  Chat --> Deploy[Apply deployments]
Loading

Reviews (6) · Last reviewed commit: "fix(workflow-code): review round 5: chec..." · Reviewed by Greptile

@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 Nov 27, 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 13 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 Nov 27, 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 13 files

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

Turn on auto-fix | Re-trigger cubic

…orkflows, gating deployments/

- `apply --yes --run <key>='<input>'` (repeatable, JSON or @file): after the apply, dry-run
  each named workflows/<key>/ draft as `sim workflows run --dry --input` does; one `runs` entry
  each in the result; a run that does not complete exits 1, maps its failing block to file:line,
  and leaves the applied drafts in place.
- With --run, deployments/ is applied in a second write only after every run completed, so a
  `live: 'draft'` deployment publishes only a tested draft.
- Refused before anything is sent: beside --dry or --to, an --only without workflows, an
  unknown key (naming the keys there), a repeated key, or input that is not JSON.
- Primer, AGENTS.md pointer, `source --help`, the advanced guide and docs teach the one-call loop
  `check && apply --yes --run <key>='{…}'`.
- Gate a managed deployments/ on the runs even when no deployment file is left, so a failed run
  never undeploys a workflow.
- Read the deployments write before the runs and refuse it when a workflow or deployment file
  changed while they ran, so only tested drafts deploy.
- Drop the first write's W_DEPLOYED_DRAFT_CHANGED for deferred deployments before it prints.
- Help names runs[].sideEffects.unchecked and .omitted.
@waleedlatif1
waleedlatif1 force-pushed the improvement/workspace-apply-run branch from 417dcdd to 388013d Compare November 27, 2026 00:56
@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 Nov 27, 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 13 files

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

Turn on auto-fix | Re-trigger cubic

…r apply's draft goes live

- A stored chat output reads by the block's name in the draft, else in the live version it serves,
  so a chat whose output block an earlier apply re-created is rewritten when that draft deploys
  (the apply --run deployments write), instead of keeping the deleted block id.
- Help says the test run executes code and sends GET fetches; the primer and pointer say one
  --run per changed workflow.
@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 Nov 27, 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 17 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 Nov 27, 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 17 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 cdc910d into staging Nov 27, 2026
87 checks passed

This branch was previously deployed

1 inactive deployment
Preview — b597aeaf Deployed Nov 27, 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