Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Dec 5, 2025

Summary

Fix import/export. Add copilot 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 8:53pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 5, 2025

Greptile Overview

Greptile Summary

Fixed array validation errors during workflow import/export by converting empty strings to null in subblock values, and removed unused GDrive and Mermaid diagram features.

  • Import Fix: Added normalizeSubblockValues() function to convert empty strings to null for backwards compatibility with workflows exported before the sanitization fix
  • Export Fix: Updated credential-extractor.ts to clear sensitive fields with null instead of empty strings, preventing Zod validation errors like "Expected array, received string"
  • Cleanup: Removed GDrive tools (list_gdrive_files, read_gdrive_file, gdrive_request_access) and diagram generation (generate_diagram) from client/server tools, registry, and UI components
  • Dependencies: Removed mermaid and react-google-drive-picker packages

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-focused on fixing a specific validation bug and removing unused features. The fix correctly addresses the root cause by normalizing empty strings to null for backwards compatibility, and all related code (registry, tools, UI components) has been consistently cleaned up
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/stores/workflows/json/importer.ts 5/5 Added normalizeSubblockValues to fix array errors by converting empty strings to null for backwards compatibility
apps/sim/lib/workflows/credentials/credential-extractor.ts 5/5 Changed credential sanitization to use null instead of empty strings for cleared values
apps/sim/lib/copilot/registry.ts 5/5 Removed GDrive and diagram generation tools from registry (tool IDs, schemas, SSE schemas, and result schemas)
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx 5/5 Removed GDrive picker integration and Mermaid diagram rendering from tool call component
apps/sim/stores/panel/copilot/store.ts 5/5 Removed GDrive and diagram tool registrations from copilot store

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowImporter
    participant NormalizeSubblockValues
    participant RegenerateIds
    participant CredentialExtractor
    
    Note over User,CredentialExtractor: Import/Export Flow with Array Error Fix
    
    User->>WorkflowImporter: Import workflow JSON
    WorkflowImporter->>WorkflowImporter: Parse JSON content
    WorkflowImporter->>NormalizeSubblockValues: Normalize subblock values
    Note over NormalizeSubblockValues: Convert empty strings to null<br/>Prevents "Expected array, received string" errors
    NormalizeSubblockValues-->>WorkflowImporter: Return normalized blocks
    
    WorkflowImporter->>RegenerateIds: Regenerate IDs (if enabled)
    RegenerateIds->>RegenerateIds: Map old IDs to new IDs
    RegenerateIds->>RegenerateIds: Update blocks, edges, loops, parallels
    RegenerateIds-->>WorkflowImporter: Return workflow with new IDs
    
    WorkflowImporter-->>User: Import complete
    
    User->>CredentialExtractor: Export/Share workflow
    CredentialExtractor->>CredentialExtractor: Sanitize credentials
    Note over CredentialExtractor: Clear sensitive fields with null<br/>instead of empty strings
    CredentialExtractor->>CredentialExtractor: Clear OAuth credentials → null
    CredentialExtractor->>CredentialExtractor: Clear secret fields → null
    CredentialExtractor->>CredentialExtractor: Clear workspace-specific fields → null
    CredentialExtractor-->>User: Export sanitized workflow
    
    Note over User,CredentialExtractor: Removed Features (No longer in flow)
    Note over User,CredentialExtractor: ❌ GDrive tools (list/read/request access)
    Note over User,CredentialExtractor: ❌ Mermaid diagram generation
    Note over User,CredentialExtractor: ❌ Google Drive picker integration
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.

15 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sg312 Sg312 merged commit 7752bea into staging Dec 5, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/import-export 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