Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#417

@greptile-apps
Copy link

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR removes the hardcoded 48-character limit (DEFAULT_VALUE_MAX_LEN) from text inputs across the web application, allowing max_length to be optional on input fields. Most changes correctly remove the default fallback value from templates and input components.

Key Changes:

  • Removed DEFAULT_VALUE_MAX_LEN from VAR_ITEM_TEMPLATE, VAR_ITEM_TEMPLATE_IN_WORKFLOW, and VAR_ITEM_TEMPLATE_IN_PIPELINE in web/config/index.ts
  • Updated input components to use maxLength={max_length} instead of maxLength={max_length || DEFAULT_VALUE_MAX_LEN}
  • Added comprehensive test coverage for undefined maxLength behavior

Critical Issues Found:

  • web/app/components/share/text-generation/index.tsx:261 contains a logic bug where item[varIndex].length > varItem.max_length will fail when max_length is undefined, causing incorrect validation during batch CSV upload
  • web/app/components/app/configuration/prompt-value-panel/index.tsx:166 changed number input from type="number" to type="text", which breaks native number validation
  • Debug console.log statement left in production code at web/app/components/share/text-generation/index.tsx:199

Compliance Violations:

Confidence Score: 2/5

  • This PR has critical logic bugs that will cause runtime errors in batch validation
  • Score reflects a well-intentioned refactoring with good test coverage, but contains a critical bug in batch validation logic where comparing string length to undefined will cause incorrect behavior. Additionally, changing number input type breaks validation, and debug code was left in production.
  • Pay close attention to web/app/components/share/text-generation/index.tsx (batch validation bug) and web/app/components/app/configuration/prompt-value-panel/index.tsx (number input type change)

Important Files Changed

Filename Overview
web/app/components/share/text-generation/index.tsx Removed default max length fallback and added debug console.log; critical bug where undefined max_length causes comparison error
web/app/components/share/text-generation/run-once/index.tsx Removed default max length fallback for text inputs; paragraph textarea missing maxLength prop
web/app/components/app/configuration/prompt-value-panel/index.tsx Changed number input from type=number to type=text which breaks number validation; removed default max length fallback

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant Input/Textarea
    participant Validation
    
    User->>Component: Enter text in input field
    Component->>Component: Check if max_length is defined
    
    alt max_length is defined
        Component->>Input/Textarea: Pass maxLength={max_length}
        Input/Textarea->>Input/Textarea: Apply character limit
        Input/Textarea-->>User: Enforce max length
    else max_length is undefined (NEW)
        Component->>Input/Textarea: Pass maxLength={undefined}
        Input/Textarea->>Input/Textarea: No character limit applied
        Input/Textarea-->>User: Allow unlimited input
    end
    
    User->>Component: Submit batch data (CSV)
    Component->>Validation: checkBatchInputs(data)
    Validation->>Validation: For each row, check max_length
    
    alt max_length is undefined (BUG)
        Validation->>Validation: item.length > undefined
        Validation-->>Component: TypeError/NaN comparison
    else max_length is defined
        Validation->>Validation: item.length > max_length
        Validation-->>Component: Valid comparison result
    end
Loading

Copy link

@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.

Additional Comments (1)

  1. web/app/components/share/text-generation/run-once/index.tsx, line 146-151 (link)

    style: paragraph textarea missing maxLength prop - should be added for consistency with other input types

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

11 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

return false
}
const headerData = data[0]
console.log('Checking batch inputs:', { dataLength: data.length, headerData })
Copy link

Choose a reason for hiding this comment

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

syntax: remove debug console.log statement

Suggested change
console.log('Checking batch inputs:', { dataLength: data.length, headerData })

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/share/text-generation/index.tsx
Line: 199:199

Comment:
**syntax:** remove debug console.log statement

```suggestion
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

if (varItem.type === 'string') {
const maxLen = varItem.max_length || DEFAULT_VALUE_MAX_LEN
if (item[varIndex].length > maxLen) {
if (item[varIndex].length > varItem.max_length) {
Copy link

Choose a reason for hiding this comment

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

logic: comparison will fail when max_length is undefined - need to check if max_length exists before comparing

Suggested change
if (item[varIndex].length > varItem.max_length) {
if (varItem.max_length && item[varIndex].length > varItem.max_length) {
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/share/text-generation/index.tsx
Line: 261:261

Comment:
**logic:** comparison will fail when `max_length` is undefined - need to check if `max_length` exists before comparing

```suggestion
          if (varItem.max_length && item[varIndex].length > varItem.max_length) {
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 166 to +167
<Input
type="number"
type="text"
Copy link

Choose a reason for hiding this comment

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

logic: changed input type from number to text but maxLength doesn't apply to numeric values - this breaks number validation. Was changing the number input type to text intentional, or should number inputs remain as type=number?

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/app/configuration/prompt-value-panel/index.tsx
Line: 166:167

Comment:
**logic:** changed input type from `number` to `text` but `maxLength` doesn't apply to numeric values - this breaks number validation. Was changing the number input type to text intentional, or should number inputs remain as type=number?

How can I resolve this? If you propose a fix, please make it concise.

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