Skip to content

feat(tables): workflow version selection (live/deployed) and not-found/no-output badges#4889

Merged
TheodoreSpeaks merged 6 commits into
stagingfrom
fix/table-dispatch-ui
Jun 5, 2026
Merged

feat(tables): workflow version selection (live/deployed) and not-found/no-output badges#4889
TheodoreSpeaks merged 6 commits into
stagingfrom
fix/table-dispatch-ui

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

Summary

  • Add a per-group Workflow version control (Live / Deployed segmented toggle) in the workflow column config sidebar's advanced section — picks whether table cell runs execute the live draft (default) or the latest active deployment. Plumbed through the contract, service, dispatch payload, and useDraftState in cell execution; a Deployed group with no active deployment fails the cell with a clear message.
  • Add a grey "Not found" badge (with tooltip) in a workflow column header when its source block no longer exists in the workflow.
  • Add a grey "No output" cell badge when a group run completed but produced no value for that cell (previously blank).

Type of Change

  • New feature

Testing

Tested manually. bun run check:api-validation:strict passes; bun run lint:check clean on all touched files (pre-existing unrelated lint findings left untouched); tsc --noEmit clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 5, 2026 12:48am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 4, 2026

PR Summary

Medium Risk
Changes table workflow execution paths (draft vs deployment loading and useDraftState), which affects production behavior for deployed groups; UI-only pieces are lower risk.

Overview
Adds per workflow-group version selection so table cell runs can use the live draft (default) or the latest deployed workflow. The sidebar advanced section gets a Live / Deployed toggle (manual groups only); deploymentMode is persisted through API contracts, table service, React Query mutations, and Mothership table tools. Background cell execution loads draft vs deployed state accordingly, sets useDraftState on execution to match, and errors the cell when deployed mode has no deployment (no silent fallback to draft). Cascade runs read each group’s mode from the live schema, not the initial payload.

Grid UX: workflow columns whose source block is gone show a WorkflowX header icon with tooltip (live-mode groups only, after workflow state loads). Completed runs with no cell value show a grey “No output” badge instead of a blank cell (enrichment “Not found” unchanged).

Minor polish: multi-select left edge drawn in the sticky checkbox column; removed required asterisk on workflow inputs label.

Reviewed by Cursor Bugbot for commit b85f9f7. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bc1a0dd. Configure here.

Comment thread apps/sim/background/workflow-column-execution.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR adds three UI features to the Sim tables: a per-group Workflow version segmented toggle (Live / Deployed) in the sidebar advanced section, a "Not found" badge in column headers when the source block no longer exists, and a "No output" cell badge when a workflow run completes but produces no value for a cell (distinct from a never-run blank). The deployment mode is plumbed through the full stack — contract schemas, API route, service layer, and background executor — with the executor correctly reading deploymentMode from the live group object per cascade iteration rather than from the initial payload.

  • Deployment mode selection: A new optional deploymentMode field ('live' | 'deployed') is added to WorkflowGroup and threaded through the add/update API, the sidebar state, and runWorkflowAndWriteTerminal, which uses loadDeployedWorkflowState for deployed groups and now surfaces the real error message on failure.
  • "Not found" badge: Only rendered for live-mode groups (deployed-mode groups run a graph that's not loaded client-side, so the guard prevents false-positive badges); uses a guard on blocks being truthy to avoid flashing during initial load.
  • "No output" badge + CSS fix: Adds a new CellRenderKind for completed-but-empty workflow output cells; also fixes a visual artifact where the selection overlay's left border doubled up with the sticky checkbox cell's right border when a range selection started at column 0.

Confidence Score: 5/5

Safe to merge — the deployment mode is correctly threaded through all layers with no silent fallbacks, previous review findings are fully addressed, and the changes are well-scoped to the tables feature.

All three features (deployment mode toggle, 'Not found' badge, 'No output' badge) are correctly implemented end-to-end. The cascade stale-mode bug from the prior review is fixed by reading deploymentMode from the live group per iteration. The error surfacing fix uses the actual thrown error message. The 'Not found' badge is correctly gated to live-mode groups and deferred until workflow state finishes loading. The CSS border fix is logically sound. No functional defects were found.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/background/workflow-column-execution.ts Reads deploymentMode from the live group (not the payload snapshot) per cascade iteration; conditionally calls loadDeployedWorkflowState for deployed groups and surfaces the real error message; sets useDraftState based on mode. All edge cases handled correctly.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx Adds no-output CellRenderKind for completed-but-empty non-enrichment workflow output cells. The enrichment-first guard ensures enrichment columns still show 'Not found' rather than 'No output'.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table.ts Computes blockMissing only for live-mode groups once the workflow state has fully loaded (blocks truthy), preventing false 'Not found' badges for deployed-mode groups or still-loading workflows.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/workflow-sidebar/workflow-sidebar.tsx Adds deploymentMode state (defaults to 'live') with a ButtonGroup toggle in the advanced section (hidden for enrichment groups); includes deploymentMode in both the create and update save payloads.
apps/sim/lib/table/types.ts Adds WorkflowGroupDeploymentMode type and optional deploymentMode field to WorkflowGroup and UpdateWorkflowGroupData; stored as part of the existing JSON schema blob, so no DB migration needed.
apps/sim/lib/api/contracts/tables.ts Adds workflowGroupDeploymentModeSchema Zod enum and the optional deploymentMode field to both addWorkflowGroupBodySchema (inside the group object) and updateWorkflowGroupBodySchema (top-level).
apps/sim/lib/table/service.ts Applies deploymentMode patch to the updated group using the same conditional-spread pattern as inputMappings, type, and autoRun.
apps/sim/app/api/table/[tableId]/groups/route.ts Passes deploymentMode from the validated PATCH body to updateWorkflowGroup using the same conditional-spread pattern as other optional fields.
apps/sim/hooks/queries/tables.ts Adds deploymentMode to UpdateWorkflowGroupVariables, typed from the contract body input so it stays in sync with the Zod schema.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/data-row.tsx Fixes selection-overlay left-border doubling at col 0 by delegating the border to the sticky checkbox cell's right edge when a multi-cell selection starts at col 0.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/column-header-menu.tsx Adds a 'Not found' badge with tooltip to both the read-only and interactive column header render paths when sourceInfo?.blockMissing is set.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Sidebar: Save WorkflowGroup] -->|deploymentMode included| B[PATCH /api/table/groups]
    B --> C[updateWorkflowGroup service]
    C --> D[WorkflowGroup stored in schema JSON]

    E[Background: runRowCascadeLoop] --> F{Fresh group from DB}
    F -->|group.deploymentMode| G[runWorkflowAndWriteTerminal]

    G --> H{deploymentMode?}
    H -->|'deployed'| I[loadDeployedWorkflowState]
    H -->|'live' or undefined| J[loadWorkflowFromNormalizedTables]

    I -->|error| K[writeState: error with real message]
    I -->|success| L[executeWorkflow useDraftState=false]
    J --> M[executeWorkflow useDraftState=true]

    L --> N[buildOutputsByBlockId]
    M --> N
    N -->|value present| O[Cell: value rendered]
    N -->|value empty| P[writeState: completed]
    P --> Q[resolveCellRender]
    Q -->|isEnrichmentOutput| R[Badge: Not found]
    Q -->|workflow column| S[Badge: No output]

    T[use-table.ts columnSourceInfo] -->|isLiveMode && blocks loaded && blockId missing| U[blockMissing=true]
    U --> V[Column header: Not found badge]
Loading

Reviews (2): Last reviewed commit: "fix(tables): render selection left edge ..." | Re-trigger Greptile

Comment thread apps/sim/background/workflow-column-execution.ts
Comment thread apps/sim/lib/table/types.ts
@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

Addressed review feedback in d7e4b9307:

  • Cursor (High) — stale deployment mode in cascade: runWorkflowAndWriteTerminal now reads deploymentMode from the live group instead of the first job's payload, so each group in a row cascade uses its own version (matching how workflowId is already re-derived per iteration). Removed the now-dead deploymentMode field from WorkflowGroupCellPayload.
  • Cursor (Medium) — "Not found" derived from live draft: the badge is now only computed for live-mode groups. Deployed-mode groups run a graph we don't fetch client-side, so we no longer risk a false badge for them.
  • Greptile (P1) — misleading deploy error: the loadDeployedWorkflowState catch now surfaces the actual error (toError(err).message) instead of always claiming "no deployed version", so transient DB/migration failures aren't mistaken for a missing deployment.
  • Greptile (P2) — duplicate type: removed the redundant WorkflowGroupDeploymentMode export from the contract; lib/table/types.ts is the single source (the Zod enum stays for the body schemas).

tsc + biome + check:api-validation:strict clean; 188 table tests pass.

@greptile review

# Conflicts:
#	apps/sim/lib/copilot/tools/server/table/user-table.ts
@TheodoreSpeaks TheodoreSpeaks merged commit ce7ddd1 into staging Jun 5, 2026
14 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the fix/table-dispatch-ui branch June 5, 2026 00:53
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.

2 participants