Skip to content

Conversation

@aadamgough
Copy link
Collaborator

Summary

Fix for various variable references, file uploading in onedrive, confluence error handling. Fixed and tested as I went.

Fixes #(issue)

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 Dec 12, 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 12, 2025 2:20am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 12, 2025

Greptile Overview

Greptile Summary

This PR refactors tool outputs across multiple integrations (Asana, Confluence, OneDrive, HubSpot, Pipedrive, Google Groups, Google Vault) by flattening nested response structures and improving error handling.

Key Changes

  • Output Structure Refactoring: Changed from nested {success, output: {...}} to flat {success, ...properties} pattern across all tools. The transformResponse functions now destructure {success, error, ...output} and return flattened objects.
  • New Confluence Attachment Upload: Added complete implementation for uploading file attachments to Confluence pages with proper multipart form handling
  • Confluence Error Handling: Enhanced Space ID validation with regex check for numeric IDs and improved error messages to guide users toward using the list operation
  • OneDrive File Upload: Consolidated file processing using centralized utility functions; improved conditional parameter passing with spread operators
  • File Utilities: Added getExtensionFromMimeType() function for reverse MIME type lookups to ensure proper file extensions
  • Code Cleanup: Removed excessive inline comments across multiple files for better readability
  • Documentation: Removed outdated comment blocks from Apify documentation files across all locales

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured refactoring focused on standardizing tool output patterns. The developer tested manually as indicated in the PR description. All changes follow consistent patterns, improve code quality by removing redundant comments, and enhance error handling with better user guidance. The new Confluence attachment upload feature is properly implemented with validation and error handling. No breaking changes or security vulnerabilities introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/tools/asana/get_task.ts 5/5 Flattened output structure from nested output object to top-level properties; added detailed output schema definitions
apps/sim/app/api/tools/asana/get-task/route.ts 5/5 Returns flat response structure instead of nested output object; aligns with updated tool output definitions
apps/sim/tools/confluence/upload_attachment.ts 5/5 New tool added for uploading file attachments to Confluence pages; properly integrates with file utilities
apps/sim/app/api/tools/confluence/upload-attachment/route.ts 5/5 New API route for Confluence attachment uploads; handles file processing and multipart form submission correctly
apps/sim/app/api/tools/confluence/create-page/route.ts 5/5 Improved error handling for invalid Space IDs with validation and helpful error messages
apps/sim/tools/onedrive/upload.ts 5/5 Removed excessive code comments; improved conditional parameter passing with spread operators
apps/sim/lib/uploads/utils/file-utils.ts 5/5 Added new getExtensionFromMimeType utility function for reverse MIME type lookups
apps/sim/tools/hubspot/list_companies.ts 5/5 Flattened output structure; removed nested output wrapper for cleaner API responses
apps/sim/tools/pipedrive/get_all_deals.ts 5/5 Simplified output schema by removing nested structure and detailed property definitions

Sequence Diagram

sequenceDiagram
    participant Client
    participant ToolConfig
    participant APIRoute
    participant ExternalAPI
    participant FileUtils

    Note over Client,FileUtils: Tool Output Flattening Pattern
    Client->>ToolConfig: Execute tool (e.g., asana_get_task)
    ToolConfig->>APIRoute: POST request with params
    APIRoute->>ExternalAPI: Fetch data from external service
    ExternalAPI-->>APIRoute: Return API response
    APIRoute->>APIRoute: Transform to flat structure
    Note over APIRoute: Returns {success, ts, gid, name, ...}<br/>instead of {success, output: {...}}
    APIRoute-->>ToolConfig: Flat JSON response
    ToolConfig->>ToolConfig: transformResponse() extracts {success, error, ...output}
    ToolConfig-->>Client: Flattened output structure

    Note over Client,FileUtils: File Upload Flow (OneDrive/Confluence)
    Client->>ToolConfig: Upload file with params
    ToolConfig->>APIRoute: POST with file reference
    APIRoute->>FileUtils: processSingleFileToUserFile()
    FileUtils-->>APIRoute: UserFile object
    APIRoute->>FileUtils: downloadFileFromStorage()
    FileUtils-->>APIRoute: File buffer
    APIRoute->>FileUtils: getExtensionFromMimeType()
    FileUtils-->>APIRoute: File extension
    APIRoute->>APIRoute: Add extension to filename if needed
    APIRoute->>ExternalAPI: Upload file with proper headers
    ExternalAPI-->>APIRoute: Upload response
    APIRoute-->>Client: Success with file metadata

    Note over Client,FileUtils: Error Handling (Confluence)
    Client->>APIRoute: Create page with invalid spaceId
    APIRoute->>APIRoute: Validate spaceId format (numeric check)
    APIRoute-->>Client: Helpful error message with guidance
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.

80 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator

@greptile

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.

83 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@aadamgough aadamgough merged commit 030ae5c into staging Dec 12, 2025
9 checks passed
@aadamgough aadamgough deleted the fix/tool-params branch December 12, 2025 02:24
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.

4 participants