Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Path lookup should fail on invalid output.

We already have O(1) resolution lookup, so just uses that.

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 17, 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 17, 2026 8:14pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 17, 2026

Greptile Summary

Added schema-based validation to block output path resolution to catch typos early. When a path is not found in runtime data, the resolver now checks if the path exists in the block's output schema - throwing an error for invalid paths (likely typos) while returning undefined for valid but missing paths (optional fields). The implementation includes a robust isPathInOutputSchema function that handles nested objects, arrays with numeric indices, and various schema formats (properties, items, etc.). Tests were updated to support the new schema validation and comprehensive test cases were added.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-tested with comprehensive test coverage, the logic is sound and handles edge cases properly, backwards compatibility is preserved, and the improvement helps catch user errors early
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/variables/resolvers/block.ts Added schema validation to detect typos in block output paths, with proper handling for optional fields and backwards compatibility
apps/sim/executor/variables/resolvers/block.test.ts Added comprehensive test coverage for schema validation, including tests for invalid paths and optional fields

Sequence Diagram

sequenceDiagram
    participant User
    participant BlockResolver
    participant Schema as Output Schema
    participant Data as Runtime Data
    
    User->>BlockResolver: resolve("<block.field>")
    BlockResolver->>BlockResolver: Parse reference path
    BlockResolver->>Data: Look up block output
    
    alt Data contains path
        BlockResolver->>User: Return value
    else Data missing path
        BlockResolver->>BlockResolver: Check backwards compatibility
        alt Backwards compat matches
            BlockResolver->>User: Return adjusted value
        else No compat match
            BlockResolver->>Schema: Check if path exists in schema
            alt Path NOT in schema
                BlockResolver->>User: Throw error (typo detected)
            else Path in schema
                BlockResolver->>User: Return undefined (optional field)
            end
        end
    end
Loading

@icecrasher321 icecrasher321 merged commit 8740566 into staging Jan 17, 2026
10 checks passed
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