Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added workflows api route for dynamic discovery
  • added ability to edit parameter and workflow descriptions

Fixes #1335

Type of Change

  • New feature

Testing

Tested manually

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

vercel bot commented Jan 19, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 20, 2026 1:21am

Request Review

cursor[bot]

This comment was marked as outdated.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 19, 2026

Greptile Summary

Added API key-authenticated endpoints for programmatic workflow discovery, addressing issue #1335. The implementation includes:

  • New GET /api/v1/workflows endpoint: Lists workflows with cursor-based pagination, filtering by workspace/folder/deployment status
  • New GET /api/v1/workflows/[id] endpoint: Fetches individual workflow details including input parameters with descriptions
  • Extended input format schema: Added optional description field to workflow parameters for better API documentation
  • UI for editing descriptions: New modal in deploy panel allows editing workflow and parameter descriptions that are exposed via the API
  • Rate limiting: Added workflows and workflow-detail categories to the middleware type definitions

The implementation correctly uses API key authentication via authenticateV1Request, enforces workspace permissions through database JOINs, and includes proper error handling and logging.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with proper authentication, authorization via permissions JOINs, input validation using Zod schemas, cursor-based pagination, comprehensive error handling, and follows existing API patterns. The UI changes are isolated and include proper state management with unsaved changes detection.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/api/v1/workflows/route.ts New API endpoint for listing workflows with cursor-based pagination, workspace/folder filtering, and API key authentication
apps/sim/app/api/v1/workflows/[id]/route.ts New API endpoint for fetching individual workflow details including input fields and metadata with API key authentication
apps/sim/lib/workflows/input-format.ts Extended input field type definitions and extraction logic to support optional description field for workflow parameters
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/api-info-modal.tsx New modal component for editing workflow and parameter descriptions with unsaved changes detection

Sequence Diagram

sequenceDiagram
    participant Client
    participant ListAPI as GET /api/v1/workflows
    participant DetailAPI as GET /api/v1/workflows/[id]
    participant Middleware as checkRateLimit
    participant DB as Database
    participant InputExtractor as extractInputFieldsFromBlocks
    
    Client->>ListAPI: Request workflows list
    ListAPI->>Middleware: Verify authentication and rate limits
    Middleware-->>ListAPI: Authentication successful
    
    ListAPI->>ListAPI: Validate query parameters
    ListAPI->>DB: Query workflows with permissions check
    DB-->>ListAPI: Return filtered workflows
    ListAPI->>ListAPI: Apply cursor pagination
    ListAPI-->>Client: Return paginated workflows
    
    Client->>DetailAPI: Request specific workflow
    DetailAPI->>Middleware: Verify authentication and rate limits
    Middleware-->>DetailAPI: Authentication successful
    
    DetailAPI->>DB: Query workflow by ID with permissions
    DB-->>DetailAPI: Return workflow metadata
    DetailAPI->>DB: Query workflowBlocks
    DB-->>DetailAPI: Return block definitions
    DetailAPI->>InputExtractor: Extract input fields from blocks
    InputExtractor-->>DetailAPI: Return input fields with descriptions
    DetailAPI-->>Client: Return complete workflow details
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@waleedlatif1 waleedlatif1 merged commit 6cbadd7 into staging Jan 20, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/api branch January 20, 2026 01:21
Copy link

@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 1 potential issue.

setParamDescriptions(descriptions)
initialParamDescriptionsRef.current = { ...descriptions }
}
}, [open, workflowMetadata, inputFormat])
Copy link

Choose a reason for hiding this comment

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

Effect resets form state when store values change

Medium Severity

The useEffect that initializes the form includes workflowMetadata and inputFormat in its dependency array. Since these values are derived from Zustand stores that can update independently, any change to them while the modal is open will re-run the effect and reset all form state (description and paramDescriptions), discarding the user's unsaved edits. This also occurs during save: when setValue updates the subblock store, inputFormat changes, triggering the effect to reset the form before onOpenChange(false) closes the modal.

Fix in Cursor Fix in Web

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