Skip to content

fix(workflow) Make workflow description nullable#4785

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/workflow-description
May 29, 2026
Merged

fix(workflow) Make workflow description nullable#4785
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/workflow-description

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

Summary

Workflows were failing contract validation. Fixed by making description nullable

Response failed contract validation

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

How has this been tested? What should reviewers focus on?

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)

Screenshots/Videos

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 29, 2026 2:56am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 29, 2026

PR Summary

Low Risk
Single-field Zod relaxation aligned with existing API/DB null descriptions; no auth or persistence logic changes.

Overview
Fixes contract validation failures on GET /api/workflows/[id] when a workflow has no description in the database.

workflowStateSchema.metadata.description now accepts null in addition to optional strings, matching how the route stamps responseWorkflowData.description (same nullable shape as getWorkflowResponseDataSchema / list items).

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR makes the description field inside workflowStateSchema's metadata object nullable, aligning the contract with the underlying database column which already allows null in every other schema that exposes description (e.g., workflowListItemSchema, getWorkflowResponseDataSchema).

  • The one-line change from z.string().optional() to z.string().nullable().optional() fixes contract validation failures that occurred when the GET /api/workflows/[id] route stamped a null description from the DB row onto the state payload.
  • No other schemas or routes are changed; the fix is contained to the metadata sub-object of workflowStateSchema, which is already marked .optional() at the object level.

Confidence Score: 5/5

Safe to merge — a minimal, targeted schema alignment with no behavioural regressions.

The single-line change correctly aligns workflowStateSchema.metadata.description with every other place in the file that exposes the description column (workflowListItemSchema, getWorkflowResponseDataSchema, duplicateWorkflowResponseSchema) — all of which already carry .nullable(). The fix removes the contract validation failure without touching any business logic or runtime behaviour.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/api/contracts/workflows.ts Added .nullable() to description in workflowStateSchema.metadata, matching the nullability already present in all other workflow description fields across the file.

Sequence Diagram

sequenceDiagram
    participant Client
    participant GET /api/workflows/[id]
    participant DB
    participant ContractValidator

    Client->>GET /api/workflows/[id]: GET request
    GET /api/workflows/[id]->>DB: fetch workflow row
    DB-->>GET /api/workflows/[id]: { description: null, ... }
    GET /api/workflows/[id]->>GET /api/workflows/[id]: stamp metadata onto state
    GET /api/workflows/[id]->>ContractValidator: validate against workflowStateSchema
    Note over ContractValidator: Before: z.string().optional() → FAILS on null
    Note over ContractValidator: After: z.string().nullable().optional() → PASSES
    ContractValidator-->>Client: "{ data: { state: { metadata: { description: null } } } }"
Loading

Reviews (1): Last reviewed commit: "Make workflow description nullable" | Re-trigger Greptile

@TheodoreSpeaks TheodoreSpeaks merged commit 066cd70 into staging May 29, 2026
10 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the fix/workflow-description branch May 29, 2026 03:00
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