fix: remove hardcoded 48-character limit from text inputs#156
Conversation
Review Summary by QodoRemove hardcoded 48-character limit and use dynamic max_length property
WalkthroughsDescription• Remove hardcoded 48-character limit from text input fields • Replace DEFAULT_VALUE_MAX_LEN constant with dynamic max_length property • Update input components to use max_length only when explicitly set • Add tests for maxLength attribute behavior in run-once component Diagramflowchart LR
A["Remove DEFAULT_VALUE_MAX_LEN imports"] --> B["Update variable templates"]
B --> C["Modify input components"]
C --> D["Use max_length property directly"]
D --> E["Add conditional maxLength attributes"]
E --> F["Update tests"]
File Changes1. web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
|
Code Review by Qodo
1. console.log in checkBatchInputs
|
|
/agentic_review |
|
Persistent review updated to latest commit fc5f36e |
| 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
Production frontend code logs batch input details using console.log, which is prohibited for production readiness. This can leak data to user consoles and violates the no-console compliance requirement.
Agent Prompt
## Issue description
Production frontend code contains a `console.log` statement, which is disallowed.
## Issue Context
`console.*` output should not ship in production builds.
## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[193-200]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| 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. Unguarded max_length compare 🐞 Bug ✓ Correctness
TextGeneration.checkBatchInputs compares item[varIndex].length to varItem.max_length even though max_length is optional, which fails TypeScript strict compilation. It also assigns varItem.max_length into a number variable (maxLength), compounding the type error.
Agent Prompt
## Issue description
`checkBatchInputs` compares a string length to an optional `max_length` and assigns it into a `number` variable under `strict` TypeScript settings. This will fail compilation.
## Issue Context
`PromptVariable.max_length` is optional (`number | undefined`). In strict mode, you must narrow it before use.
## Fix Focus Areas
- web/app/components/share/text-generation/index.tsx[249-275]
- web/models/debug.ts[51-66]
- web/tsconfig.json[22-29]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| value={inputs[item.key]} | ||
| onChange={(e: ChangeEvent<HTMLInputElement>) => { handleInputsChange({ ...inputsRef.current, [item.key]: e.target.value }) }} | ||
| maxLength={item.max_length || DEFAULT_VALUE_MAX_LEN} | ||
| maxLength={item.max_length} |
There was a problem hiding this comment.
3. Maxlength zero blocks input 🐞 Bug ✓ Correctness
Several inputs now pass maxLength={max_length} directly; if max_length is 0, the native input
receives maxLength=0 and users cannot type any characters. Elsewhere in the codebase max_length
is used in a truthy guard, implying 0 is a valid sentinel that should disable limiting rather than
forbidding input.
Agent Prompt
## Issue description
Passing `maxLength={0}` to native inputs prevents any text entry. Some code paths treat `max_length` as a truthy-guarded limit, which implicitly treats `0` as “no limit/unset”, so the UI should avoid setting a DOM maxLength when `max_length` is 0.
## Issue Context
This PR changed multiple components from `max_length || DEFAULT_VALUE_MAX_LEN` to `max_length`, which is correct for `undefined` but risky for a legitimate `0` value.
## Fix Focus Areas
- web/app/components/share/text-generation/run-once/index.tsx[136-144]
- web/app/components/app/configuration/debug/chat-user-input.tsx[84-120]
- web/app/components/app/configuration/prompt-value-panel/index.tsx[138-174]
- web/app/components/base/input/index.tsx[84-111]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#5