fix(workflows): refuse new placements of sunset blocks in workflow edits

Merged
WA
12d ago
+220-2

Summary

  • Workflow edits (CLI, Chat, MCP — all go through the same operations engine) now refuse a new block whose type is sunset (legacy / deprecated), e.g. table instead of table_v2
  • Covers every creation path: add, loop/parallel nestedNodes children, insert_into_subflow, and an edit that switches a block's type
  • The refusal is a block_not_allowed skipped item whose reason names the successor (use "table_v2" instead) and whose details.replacedBy carries it, so the agent self-corrects
  • Placed sunset blocks keep executing and stay editable; only new placements are refused, matching the catalog, which already hides sunset blocks from blocks list
  • Agents were writing legacy block ids from memory; the catalog read side was already correct but the write side accepted them silently

Type of Change

  • Bug fix

Testing

  • lib/workflows/editing + lib/workflows/application suites: 542 passed
  • New tests in operations.test.ts fail with each guard (add, nested, insert, type switch) reverted and pass with the fix
  • bun run lint, check-block-registry.ts origin/staging
  • Type-check / check:audits / full suite left to CI

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)