Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Jan 28, 2026

Summary

  • Models fix to check max_tokens correctly
  • Parse json for block logs

Type of Change

  • Other: UX Improvement

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 28, 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 28, 2026 1:57am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR improves type safety and log display by correctly handling JSON inputs across 24 block integrations and the block executor.

Key Changes:

  • Changed input type declarations from 'string' to 'json' for parameters that accept JSON objects/arrays across all block integrations (Apollo, Elasticsearch, GitHub, MongoDB, PostHog, Mailchimp, etc.)
  • Added new parseJsonInputs() method in block-executor.ts that parses JSON strings for log display
  • Applied JSON parsing to block logs at three key points: initial input logging, success callback, and error callback
  • The parsing is defensive: only attempts to parse strings that look like JSON (start with { or [), wrapped in try-catch to gracefully handle invalid JSON

Impact:

  • Block logs will now display parsed JSON objects/arrays instead of raw JSON strings, improving readability
  • Type declarations now accurately reflect that these inputs expect JSON structures
  • No changes to actual block execution logic - parsing is purely for display purposes

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - changes are primarily type annotations and defensive log formatting
  • Score of 4 reflects that the changes are well-contained and defensive (try-catch protection), but the isJSONString heuristic could be improved to avoid unnecessary parse attempts on non-JSON strings
  • No files require special attention - all changes follow the same safe pattern

Important Files Changed

Filename Overview
apps/sim/executor/execution/block-executor.ts Added parseJsonInputs method to parse JSON strings for log display; method uses isJSONString check and safely handles parse errors
apps/sim/blocks/blocks/apollo.ts Added 14 new input fields with type 'json' for arrays and objects used in Apollo operations
apps/sim/blocks/blocks/elasticsearch.ts Changed 6 input types from 'string' to 'json' for document, query, sort, operations, settings, and mappings
apps/sim/blocks/blocks/mongodb.ts Changed 5 input types from 'string' to 'json' for query, sort, filter, update, and pipeline parameters
apps/sim/blocks/blocks/posthog.ts Changed 10 input types from 'string' to 'json' and added 5 new json-type inputs for properties, filters, and configurations
apps/sim/blocks/blocks/mailchimp.ts Added 9 new json-type inputs for contact, campaign settings, recipients, merge fields, and batch operations

Sequence Diagram

sequenceDiagram
    participant User
    participant BlockExecutor
    participant VariableResolver
    participant parseJsonInputs
    participant BlockLog
    participant onBlockComplete

    User->>BlockExecutor: Execute block with inputs
    BlockExecutor->>VariableResolver: resolveInputs(ctx, params)
    VariableResolver-->>BlockExecutor: resolvedInputs (strings)
    
    alt Block logging enabled
        BlockExecutor->>parseJsonInputs: parseJsonInputs(resolvedInputs)
        parseJsonInputs->>parseJsonInputs: Check each value with isJSONString()
        parseJsonInputs->>parseJsonInputs: JSON.parse() on JSON-like strings
        parseJsonInputs-->>BlockExecutor: parsed inputs (objects/arrays)
        BlockExecutor->>BlockLog: Set blockLog.input with parsed data
    end
    
    BlockExecutor->>BlockExecutor: Execute block operation
    
    alt Success path
        BlockExecutor->>parseJsonInputs: parseJsonInputs(resolvedInputs)
        parseJsonInputs-->>BlockExecutor: parsed inputs
        BlockExecutor->>onBlockComplete: callback(ctx, node, block, parsed inputs, output)
    else Error path
        BlockExecutor->>parseJsonInputs: parseJsonInputs(input)
        parseJsonInputs-->>BlockExecutor: parsed inputs
        BlockExecutor->>BlockLog: Set blockLog.input with parsed data
        BlockExecutor->>onBlockComplete: callback(ctx, node, block, parsed inputs, errorOutput)
    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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

@icecrasher321
Copy link
Collaborator Author

@cursor review

@icecrasher321 icecrasher321 changed the title improvement(block-inputs): must parse json accurately improvement(block-inputs): must parse json accurately + models max_tokens fix Jan 28, 2026
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
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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@icecrasher321 icecrasher321 merged commit 65bc216 into staging Jan 28, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/json-inputs-blocks branch January 28, 2026 02:30
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