Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Dec 5, 2025

Summary

Fixes overcorrecting validation

Type of Change

  • Bug fix

Testing

Manual

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 Dec 5, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 5, 2025 9:42pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 5, 2025

Greptile Overview

Greptile Summary

Removed conditional field validation from the copilot workflow editing tool to fix validation errors. The change recognizes that condition properties in SubBlockConfig are for UI display logic (showing/hiding fields in the editor) rather than API validation constraints.

Key Changes:

  • Removed evaluateCondition function and all condition checking logic from validateInputsForBlock
  • Removed existingInputs parameter from validation function - no longer merges existing inputs to evaluate conditions
  • Added logSkippedItem helper function to centralize logging and recording of skipped operations
  • Updated all skippedItems.push() calls to use the new logSkippedItem helper

Impact:
The copilot/API can now set any valid field in a block's schema without being rejected due to conditional display logic. The runtime will use the relevant fields based on the actual operation being performed.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-scoped and address a clear validation issue. The removal of condition checking is logical since conditions are for UI display purposes, not API validation. The addition of the logging helper improves code quality. All validation logic remains intact except for the condition checks that were causing false rejections.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts 5/5 Removed conditional field validation logic for copilot/API inputs, added logging helper function, simplified validation by removing condition checks that are only relevant for UI display

Sequence Diagram

sequenceDiagram
    participant Copilot
    participant editWorkflow
    participant validateInputsForBlock
    participant logSkippedItem
    participant validationLogger

    Copilot->>editWorkflow: edit_workflow(operations, workflowId)
    editWorkflow->>editWorkflow: applyOperationsToWorkflowState()
    
    alt Operation: edit with inputs
        editWorkflow->>validateInputsForBlock: validate(blockType, inputs, blockId)
        Note over validateInputsForBlock: Previously checked<br/>subBlockConfig.condition<br/>with merged existing inputs
        validateInputsForBlock->>validateInputsForBlock: Check field exists in schema
        validateInputsForBlock->>validateInputsForBlock: Validate value type (no condition check)
        validateInputsForBlock-->>editWorkflow: {validInputs, errors}
        editWorkflow->>editWorkflow: Apply valid inputs to block.subBlocks
    end
    
    alt Invalid reference (e.g., block not found)
        editWorkflow->>logSkippedItem: logSkippedItem(skippedItems, itemData)
        logSkippedItem->>validationLogger: warn(message, context)
        logSkippedItem->>logSkippedItem: skippedItems.push(item)
    end
    
    editWorkflow-->>Copilot: {success, workflowState, validationErrors, skippedItems}
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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sg312 Sg312 merged commit 4fd5f00 into staging Dec 5, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/copilot-validation branch December 7, 2025 02:15
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