Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Sanitize Trigger Inputs to remove system / UI fields from the 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 7:07pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

Improved log sanitization by filtering out UI-only and system fields from trigger block inputs. The parseJsonInputs method was renamed to sanitizeInputsForLog and enhanced to exclude system subblock IDs (credentials, webhook URL displays, sample payloads, setup scripts, schedule info) and the triggerMode flag. Additionally, UI state fields are now removed from inputFormat and tools arrays before logging.

  • Enhanced sanitizeInputsForLog to filter system fields using SYSTEM_SUBBLOCK_IDS and exclude triggerMode
  • Added scheduleInfo to the system subblock IDs list to prevent schedule status UI from appearing in logs
  • Reused existing sanitizeInputFormat and sanitizeTools functions from the normalize module to strip UI state
  • Maintained JSON string parsing behavior for improved log readability

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Well-structured refactoring that improves log quality by filtering unnecessary fields. The changes are focused, use existing utility functions, maintain backward compatibility, and only affect log output formatting without altering execution logic.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/triggers/constants.ts Added scheduleInfo to SYSTEM_SUBBLOCK_IDS to filter schedule status UI from logs
apps/sim/executor/execution/block-executor.ts Renamed and enhanced parseJsonInputs to sanitizeInputsForLog - now filters system fields and UI state

Sequence Diagram

sequenceDiagram
    participant BE as BlockExecutor
    participant R as VariableResolver
    participant SIF as sanitizeInputsForLog
    participant BL as BlockLog
    participant NF as normalize functions

    Note over BE: Block execution starts
    BE->>R: resolveInputs(ctx, nodeId, params, block)
    R-->>BE: resolvedInputs (raw)
    
    Note over BE: Sanitize inputs before logging
    BE->>SIF: sanitizeInputsForLog(resolvedInputs)
    
    alt Filter system fields
        SIF->>SIF: Check if key in SYSTEM_SUBBLOCK_IDS
        Note over SIF: Skip: triggerCredentials, webhookUrlDisplay,<br/>samplePayload, setupScript, scheduleInfo, etc.
        SIF->>SIF: Check if key === 'triggerMode'
        Note over SIF: Skip: triggerMode (internal flag)
    end
    
    alt Sanitize inputFormat
        SIF->>NF: sanitizeInputFormat(value)
        NF-->>SIF: Array without 'collapsed' UI state
    end
    
    alt Sanitize tools
        SIF->>NF: sanitizeTools(value)
        NF-->>SIF: Array without 'isExpanded' UI state
    end
    
    alt Parse JSON strings
        SIF->>SIF: Check isJSONString(value)
        SIF->>SIF: JSON.parse(value.trim())
        Note over SIF: Keep original on parse error
    end
    
    SIF-->>BE: sanitized inputs
    BE->>BL: blockLog.input = sanitized inputs
    Note over BL: Only logs relevant data,<br/>excludes UI/system fields
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, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit 78410ee into staging Jan 28, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/sanitize-inputs-logs branch January 29, 2026 00:27
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