fix: remove hardcoded 48-character limit from text inputs#143
Conversation
Code Review by Qodo
1. console.log in checkBatchInputs
|
| return false | ||
| } | ||
| const headerData = data[0] | ||
| console.log('Checking batch inputs:', { dataLength: data.length, headerData }) |
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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
| if (type === PipelineInputVarType.multiFiles) | ||
| setFieldValue('maxLength', DEFAULT_FILE_UPLOAD_SETTING.max_length) | ||
| } | ||
| if (type === PipelineInputVarType.paragraph) | ||
| setFieldValue('maxLength', DEFAULT_VALUE_MAX_LEN) | ||
| }, [setFieldValue]) |
There was a problem hiding this comment.
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
Benchmark PR from agentic-review-benchmarks#5