Skip to content

fix(inputs): canonical params + manual validations + params resolution cleanups#3141

Merged
icecrasher321 merged 7 commits intostagingfrom
fix/onedrive
Feb 5, 2026
Merged

fix(inputs): canonical params + manual validations + params resolution cleanups#3141
icecrasher321 merged 7 commits intostagingfrom
fix/onedrive

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Feb 5, 2026

Summary

  • Validate required fields based on mode selected.
  • Params should only reference canonical params if existent
  • Regex based tests to ensure this
  • Remove manual required throws in params and enforce at subblock level

Type of Change

  • Bug fix

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 Feb 5, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 5, 2026 6:49am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

Fixed canonical parameter validation for OneDrive and Google Drive blocks by ensuring operation-specific canonical param IDs are used throughout. The changes address a bug where required field validation failed when using canonical parameters (basic/advanced mode pairs) because the serializer was checking the wrong field names.

Key changes:

  • Updated OneDrive block to use operation-specific canonical param IDs (createFolderParentId, downloadFileId, etc.) instead of generic ones
  • Updated Google Drive block with the same pattern and added required: true flags to file selectors in basic mode
  • Fixed serializer to look up canonical param values using the canonical ID mapping when validating required fields
  • Added SingleFileSelector component for improved single-file upload UX with clear button
  • Added clear button to SelectorCombobox component for better UX consistency

Confidence Score: 4/5

  • This PR is safe to merge with low risk
  • The changes correctly fix canonical parameter validation and follow established patterns. The serializer fix is critical and well-implemented. The UI changes add useful features without breaking existing functionality. Minor concern: the change removes fileReference from OneDrive inputs without clear justification in the PR description
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/onedrive.ts Fixed canonical param IDs for create_folder and download operations to use operation-specific naming
apps/sim/blocks/blocks/google_drive.ts Updated all operations with unique canonical param IDs and added required flags to file selectors
apps/sim/serializer/index.ts Fixed required field validation to check canonical param values instead of original subBlock IDs

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Block Editor UI
    participant SubBlock as SubBlock Component
    participant Serializer
    participant BlockConfig as OneDrive/GoogleDrive Block

    User->>UI: Select operation (e.g., "download")
    UI->>SubBlock: Render file-selector with canonicalParamId="downloadFileId"
    SubBlock->>SubBlock: buildCanonicalIndex() maps subBlock.id -> canonicalId
    
    alt Basic Mode
        User->>SubBlock: Select file from dropdown
        SubBlock->>SubBlock: Store value in downloadFileSelector
    else Advanced Mode
        User->>SubBlock: Enter file ID manually
        SubBlock->>SubBlock: Store value in downloadManualFileId
    end
    
    User->>UI: Execute workflow
    UI->>Serializer: serialize(block, params)
    Serializer->>Serializer: validateRequiredFields()
    
    Note over Serializer: Check if subBlock is required
    Serializer->>Serializer: Get canonicalId from canonicalIdBySubBlockId[subBlock.id]
    Serializer->>Serializer: Look up params[canonicalId] instead of params[subBlock.id]
    
    alt Value exists
        Serializer->>BlockConfig: params.downloadFileId exists
        BlockConfig->>BlockConfig: Resolve operation-specific fileId
        BlockConfig-->>Serializer: Valid params with fileId
    else Value missing
        Serializer-->>UI: Error: "Missing required fields"
    end
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.

3 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 5, 2026

Additional Comments (5)

apps/sim/blocks/blocks/onedrive.ts
should be 'createFolderParentId' to match the input declaration on line 411 and follow the same pattern as Google Drive

      canonicalParamId: 'createFolderParentId',
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/onedrive.ts
Line: 183:183

Comment:
should be `'createFolderParentId'` to match the input declaration on line 411 and follow the same pattern as Google Drive

```suggestion
      canonicalParamId: 'createFolderParentId',
```

How can I resolve this? If you propose a fix, please make it concise.

apps/sim/blocks/blocks/onedrive.ts
should be 'createFolderParentId' to match the input declaration on line 411 and follow the same pattern as Google Drive

      canonicalParamId: 'createFolderParentId',
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/onedrive.ts
Line: 204:204

Comment:
should be `'createFolderParentId'` to match the input declaration on line 411 and follow the same pattern as Google Drive

```suggestion
      canonicalParamId: 'createFolderParentId',
```

How can I resolve this? If you propose a fix, please make it concise.

apps/sim/blocks/blocks/onedrive.ts
should be 'downloadFileId' to match the input declaration on line 414 and follow the same pattern as Google Drive

      canonicalParamId: 'downloadFileId',
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/onedrive.ts
Line: 261:261

Comment:
should be `'downloadFileId'` to match the input declaration on line 414 and follow the same pattern as Google Drive

```suggestion
      canonicalParamId: 'downloadFileId',
```

How can I resolve this? If you propose a fix, please make it concise.

apps/sim/blocks/blocks/onedrive.ts
should be 'downloadFileId' to match the input declaration on line 414 and follow the same pattern as Google Drive

      canonicalParamId: 'downloadFileId',
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/onedrive.ts
Line: 283:283

Comment:
should be `'downloadFileId'` to match the input declaration on line 414 and follow the same pattern as Google Drive

```suggestion
      canonicalParamId: 'downloadFileId',
```

How can I resolve this? If you propose a fix, please make it concise.

apps/sim/blocks/blocks/onedrive.ts
this params function uses the old field IDs (folderSelector, manualFolderId, fileSelector, manualFileId) that no longer exist after the canonical param refactoring. It needs to be updated to destructure and handle the new canonical param IDs per-operation, similar to how Google Drive was fixed.

The function should:

  1. Destructure the new canonical params like uploadFolderId, listFolderId, createFolderParentId, downloadFileId, deleteFileId
  2. Resolve folderId based on the operation type (upload/create_file → uploadFolderId, list → listFolderId, create_folder → createFolderParentId)
  3. Resolve fileId based on the operation type (download → downloadFileId, delete → deleteFileId)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/onedrive.ts
Line: 356:396

Comment:
this params function uses the old field IDs (`folderSelector`, `manualFolderId`, `fileSelector`, `manualFileId`) that no longer exist after the canonical param refactoring. It needs to be updated to destructure and handle the new canonical param IDs per-operation, similar to how Google Drive was fixed.

The function should:
1. Destructure the new canonical params like `uploadFolderId`, `listFolderId`, `createFolderParentId`, `downloadFileId`, `deleteFileId`
2. Resolve `folderId` based on the operation type (upload/create_file → uploadFolderId, list → listFolderId, create_folder → createFolderParentId)
3. Resolve `fileId` based on the operation type (download → downloadFileId, delete → deleteFileId)

How can I resolve this? If you propose a fix, please make it concise.

@icecrasher321
Copy link
Collaborator Author

@greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 changed the title fix(onedrive): canonical param required validation fix(inputs): canonical params + manual validations + params resolution cleanups Feb 5, 2026
@icecrasher321
Copy link
Collaborator Author

@cursor review

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@icecrasher321 icecrasher321 merged commit ea3bab1 into staging Feb 5, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/onedrive branch February 5, 2026 23:18
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