Skip to content

improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code - #1819

Merged
icecrasher321 merged 2 commits into
stagingfrom
improvement/block-outputs-code
Nov 6, 2025
Merged

improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code#1819
icecrasher321 merged 2 commits into
stagingfrom
improvement/block-outputs-code

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • Show input, conversationId, files if explicitly defined in start block.
  • Cleanup / centralize types

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

vercelBot commented Nov 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 6, 2025 0:02am

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Fixed a bug where chat-related fields (input, conversationId, files) were being hidden from the UI dropdown even when explicitly defined in a start block's inputFormat.

Key Changes:

  • Bug Fix: Modified shouldFilterReservedField() in block-outputs.ts:178-196 to check if reserved fields are explicitly defined in inputFormat before filtering them out. Previously, these fields were unconditionally hidden from the dropdown for start_trigger blocks.
  • Code Organization: Extracted complex logic into smaller, focused helper functions (getUnifiedStartOutputs, getLegacyStarterOutputs, shouldClearBaseOutputs, applyInputFormatToOutputs, shouldFilterReservedField, etc.) making the code more maintainable and testable.
  • Type Consolidation: Created apps/sim/lib/workflows/types.ts to centralize workflow-related type definitions (InputFormatField, LoopType, ParallelType, user file properties) eliminating duplicate type definitions across 6 files.
  • String Literal Cleanup: Replaced hardcoded trigger type strings with TRIGGER_TYPES constants throughout the codebase (added GENERIC_WEBHOOK to the constants).

The refactoring maintains backward compatibility while improving code quality and fixing the reported issue.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured with clear intent. The bug fix properly addresses the issue by adding a conditional check instead of removing filtering entirely. The refactoring extracts logic into pure functions without changing behavior. Type consolidation eliminates duplication and improves maintainability. All changes are backward compatible and the PR was manually tested.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/lib/workflows/types.ts5/5New file created to centralize workflow-related type definitions including InputFormatField, loop/parallel types, and file property constants
apps/sim/lib/workflows/block-outputs.ts5/5Major refactor with bug fix - chat fields now shown if explicitly in inputFormat; extracted helper functions for clarity; uses centralized types
apps/sim/lib/workflows/triggers.ts5/5Added GENERIC_WEBHOOK to TRIGGER_TYPES constant and updated usages to reference the constant instead of hardcoded string

Sequence Diagram

sequenceDiagram
participant UI as UI Component
participant GBO as getBlockOutputs
participant GSO as getUnifiedStartOutputs
participant SFR as shouldFilterReservedField
participant GOP as getBlockOutputPaths
UI->>GBO: Request outputs for start_trigger block
GBO->>GBO: Check if block is UNIFIED start type
GBO->>GSO: Get unified start outputs
GSO->>GSO: Clone UNIFIED_START_OUTPUTS (input, conversationId, files)
GSO->>GSO: Normalize inputFormat fields
GSO->>GSO: Apply inputFormat fields on top of base outputs
GSO-->>GBO: Return merged outputs
GBO-->>UI: Return complete outputs
UI->>GOP: Request output paths for tag dropdown
GOP->>GBO: Get all outputs
GOP->>GOP: Traverse output tree
loop For each field
GOP->>SFR: Should filter this reserved field?
alt Field is reserved AND not in inputFormat
SFR-->>GOP: Filter out (hidden from dropdown)
else Field is explicitly defined in inputFormat
SFR-->>GOP: Keep field (show in dropdown)
end
end
GOP-->>UI: Return filtered paths
Loading

12 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
icecrasher321 merged commit 5c611c6 into stagingNov 6, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/block-outputs-code branch November 6, 2025 01:24
waleedlatif1 pushed a commit that referenced this pull request Nov 7, 2025
…nputFormat, cleanup code (#1819)
* improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code"
* fix type error
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
…nputFormat, cleanup code (#1819)
* improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code"
* fix type error
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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.

1 participant

@icecrasher321