Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Resolution should be consistent with input format and throwing InvalidFieldErrors, vs passing

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 Jan 26, 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 26, 2026 11:34pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR fixes input format field resolution for trigger blocks by ensuring custom inputFormat fields are included in the output schema for resolution.

Key Changes:

  • block-data.ts: Added getInputFormatFields() helper and logic to merge inputFormat fields into output schemas for specific trigger types (start_trigger, api_trigger, webhook, etc.)
  • normalize.ts: Stopped removing the value field from input format items during sanitization, preserving default values for runtime use

Issues Found:

  • Tests in normalize.test.ts (lines 373-385) expect both value and collapsed to be removed, but the code now only removes collapsed - this will cause test failures

Confidence Score: 3/5

  • This PR is mostly safe but has a test inconsistency that will cause failures
  • The logic changes are sound and address the stated bug (making resolution consistent with input format fields), but the test suite was not updated to match the new behavior in sanitizeInputFormat(), which will cause test failures when run
  • Pay attention to apps/sim/lib/workflows/comparison/normalize.test.ts - tests need updating to match the code changes

Important Files Changed

Filename Overview
apps/sim/executor/utils/block-data.ts Added logic to merge inputFormat fields into output schemas for specific trigger types, enabling proper field resolution for custom input format fields
apps/sim/lib/workflows/comparison/normalize.ts Stopped removing value field from input format items during sanitization, but tests not updated to reflect this change

Sequence Diagram

sequenceDiagram
    participant Executor as Block Executor
    participant BlockData as getBlockSchema()
    participant Normalize as normalizeInputFormatValue()
    participant Schema as Block Output Schema
    participant Resolver as Block Resolver
    
    Note over Executor,Resolver: Field Resolution Flow
    
    Executor->>BlockData: Get schema for trigger block
    BlockData->>BlockData: Check if trigger in TRIGGERS_WITH_INPUT_FORMAT_OUTPUTS
    alt Is input format trigger
        BlockData->>Normalize: normalizeInputFormatValue(inputFormat)
        Normalize-->>BlockData: Filtered input format fields (with value field preserved)
        BlockData->>BlockData: Convert fields to OutputSchema
        BlockData->>Schema: Merge base outputs + inputFormat fields
        Schema-->>BlockData: Merged schema
    else Standard trigger
        BlockData->>Schema: Use block.outputs directly
        Schema-->>BlockData: Standard schema
    end
    
    BlockData-->>Executor: Output schema
    
    Note over Executor,Resolver: Later: Variable Resolution
    
    Resolver->>Resolver: Resolve reference (e.g., <start.myField>)
    Resolver->>Schema: Check if path exists in schema
    alt Field in schema
        Schema-->>Resolver: Field exists
        Resolver-->>Executor: Return value
    else Field not in schema
        Schema-->>Resolver: Field missing
        Resolver->>Resolver: Throw InvalidFieldError
    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.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

@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 3cc9b1a into staging Jan 27, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/input-format-fields branch January 27, 2026 02:37
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