Skip to content

fix: remove hardcoded 48-character limit from text inputs#143

Open
tomerqodo wants to merge 2 commits intoqodo_action_req_1_base_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5from
qodo_action_req_1_head_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5
Open

fix: remove hardcoded 48-character limit from text inputs#143
tomerqodo wants to merge 2 commits intoqodo_action_req_1_base_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5from
qodo_action_req_1_head_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#5

@qodo-code-review
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. console.log in checkBatchInputs 📘 Rule violation ✧ Quality
Description
• The TextGeneration component contains a console.log(...) call in production frontend code.
• This violates the requirement to avoid console statements in production, and it may expose
  user-provided CSV/header data in the browser console.
Code

web/app/components/share/text-generation/index.tsx[199]

+    console.log('Checking batch inputs:', { dataLength: data.length, headerData })
Evidence
PR Compliance ID 28 forbids console.* usage in production frontend code. The added console.log
at web/app/components/share/text-generation/index.tsx:199 directly violates this rule.

AGENTS.md
web/app/components/share/text-generation/index.tsx[193-201]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Production frontend code contains a `console.log(...)` statement.

## Issue Context
The repo compliance rules forbid `console.*` in production frontend code.

## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[193-201]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. max_length used without guard 📘 Rule violation ✓ Correctness
Description
• The batch validation compares item[varIndex].length against varItem.max_length and assigns
  maxLength = varItem.max_length without checking for undefined.
• Since max_length is typed as optional, this can break strict TypeScript compilation and makes
  the control flow depend on undefined coercion at runtime.
Code

web/app/components/share/text-generation/index.tsx[R260-264]

        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) {
            moreThanMaxLengthVarName = varItem.name
-            maxLength = maxLen
+            maxLength = varItem.max_length
            errorRowIndex = index + 1
Evidence
PR Compliance ID 17 requires strict TypeScript compilation. The PromptVariable type defines
max_length?: number, but the new code uses varItem.max_length as if it were always a number
(comparison and assignment), which is not strict-safe.

AGENTS.md
web/models/debug.ts[51-59]
web/app/components/share/text-generation/index.tsx[257-265]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`varItem.max_length` is optional but is used as a required number in a comparison and assignment, which can fail strict TypeScript compilation and relies on runtime coercion.

## Issue Context
`PromptVariable.max_length` is declared as `max_length?: number`.

## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[257-266]
- web/models/debug.ts[51-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Pipeline paragraph maxLength unset 🐞 Bug ✓ Correctness
Description
• In the RAG pipeline input-field editor, maxLength is required by the Zod schema for both
  text-input and paragraph.
• The UI configuration only shows maxLength for text-input, and the PR removed the previous
  type-change logic that auto-filled maxLength when switching to paragraph.
• Result: if a user switches to paragraph before setting maxLength, the required field can
  remain unset and submission will fail with a validation error while the field is hidden.
Code

web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[R86-89]

      if (type === PipelineInputVarType.multiFiles)
        setFieldValue('maxLength', DEFAULT_FILE_UPLOAD_SETTING.max_length)
    }
-    if (type === PipelineInputVarType.paragraph)
-      setFieldValue('maxLength', DEFAULT_VALUE_MAX_LEN)
  }, [setFieldValue])
Evidence
The schema requires maxLength for paragraph, but the form’s visible configuration only includes
maxLength for textInput, and the type-change handler no longer sets it for paragraph.
Additionally, new form state derives maxLength from VAR_ITEM_TEMPLATE_IN_PIPELINE, which no
longer includes a default max length, making an unset hidden required field plausible.

web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts[43-48]
web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[79-89]
web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[135-146]
web/app/components/rag-pipeline/components/panel/input-field/editor/utils.ts[5-33]
web/config/index.ts[222-228]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Pipeline input-field editor requires `maxLength` for `paragraph` via schema, but the UI hides `maxLength` for `paragraph` and no longer auto-populates it on type change.

### Issue Context
This can make the form impossible to submit when users switch to `paragraph` before setting `maxLength`.

### Fix Focus Areas
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[79-89]
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[135-146]
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts[43-48]
- web/app/components/rag-pipeline/components/panel/input-field/editor/utils.ts[5-33]
- web/config/index.ts[222-228]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Qodo Logo

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

Choose a reason for hiding this comment

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

Action required

1. console.log in checkbatchinputs 📘 Rule violation ✧ Quality

• The TextGeneration component contains a console.log(...) call in production frontend code.
• This violates the requirement to avoid console statements in production, and it may expose
  user-provided CSV/header data in the browser console.
Agent prompt
## Issue description
Production frontend code contains a `console.log(...)` statement.

## Issue Context
The repo compliance rules forbid `console.*` in production frontend code.

## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[193-201]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 260 to 264
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) {
moreThanMaxLengthVarName = varItem.name
maxLength = maxLen
maxLength = varItem.max_length
errorRowIndex = index + 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. max_length used without guard 📘 Rule violation ✓ Correctness

• The batch validation compares item[varIndex].length against varItem.max_length and assigns
  maxLength = varItem.max_length without checking for undefined.
• Since max_length is typed as optional, this can break strict TypeScript compilation and makes
  the control flow depend on undefined coercion at runtime.
Agent prompt
## Issue description
`varItem.max_length` is optional but is used as a required number in a comparison and assignment, which can fail strict TypeScript compilation and relies on runtime coercion.

## Issue Context
`PromptVariable.max_length` is declared as `max_length?: number`.

## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[257-266]
- web/models/debug.ts[51-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 86 to 89
if (type === PipelineInputVarType.multiFiles)
setFieldValue('maxLength', DEFAULT_FILE_UPLOAD_SETTING.max_length)
}
if (type === PipelineInputVarType.paragraph)
setFieldValue('maxLength', DEFAULT_VALUE_MAX_LEN)
}, [setFieldValue])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Pipeline paragraph maxlength unset 🐞 Bug ✓ Correctness

• In the RAG pipeline input-field editor, maxLength is required by the Zod schema for both
  text-input and paragraph.
• The UI configuration only shows maxLength for text-input, and the PR removed the previous
  type-change logic that auto-filled maxLength when switching to paragraph.
• Result: if a user switches to paragraph before setting maxLength, the required field can
  remain unset and submission will fail with a validation error while the field is hidden.
Agent prompt
### Issue description
Pipeline input-field editor requires `maxLength` for `paragraph` via schema, but the UI hides `maxLength` for `paragraph` and no longer auto-populates it on type change.

### Issue Context
This can make the form impossible to submit when users switch to `paragraph` before setting `maxLength`.

### Fix Focus Areas
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[79-89]
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts[135-146]
- web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts[43-48]
- web/app/components/rag-pipeline/components/panel/input-field/editor/utils.ts[5-33]
- web/config/index.ts[222-228]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

1 participant