Skip to content

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

Open
tomerqodo wants to merge 2 commits intoqodo_claude_vs_qodo_base_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5from
qodo_claude_vs_qodo_head_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5
Open

fix: remove hardcoded 48-character limit from text inputs#156
tomerqodo wants to merge 2 commits intoqodo_claude_vs_qodo_base_fix_remove_hardcoded_48-character_limit_from_text_inputs_pr5from
qodo_claude_vs_qodo_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

Review Summary by Qodo

Remove hardcoded 48-character limit and use dynamic max_length property

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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"]
Loading

Grey Divider

File Changes

1. web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts 🐞 Bug fix +0/-3

Remove paragraph type max_length assignment

web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts


2. web/config/index.ts ⚙️ Configuration changes +0/-3

Remove max_length from variable templates

web/config/index.ts


3. web/utils/var.ts 🐞 Bug fix +1/-1

Remove max_length destructuring from workflow variable

web/utils/var.ts


View more (8)
4. web/app/components/app/configuration/config-var/config-modal/index.tsx 🐞 Bug fix +0/-3

Remove paragraph type max_length default assignment

web/app/components/app/configuration/config-var/config-modal/index.tsx


5. web/app/components/app/configuration/config-var/index.tsx 🐞 Bug fix +0/-3

Remove default max_length for text input variables

web/app/components/app/configuration/config-var/index.tsx


6. web/app/components/app/configuration/debug/chat-user-input.tsx 🐞 Bug fix +3/-3

Use max_length property directly without fallback

web/app/components/app/configuration/debug/chat-user-input.tsx


7. web/app/components/app/configuration/prompt-value-panel/index.tsx 🐞 Bug fix +3/-4

Use max_length directly and fix number input type

web/app/components/app/configuration/prompt-value-panel/index.tsx


8. web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.spec.tsx 🧪 Tests +0/-21

Remove paragraph type max_length test case

web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.spec.tsx


9. web/app/components/share/text-generation/index.tsx 🐞 Bug fix +4/-4

Remove DEFAULT_VALUE_MAX_LEN and use max_length directly

web/app/components/share/text-generation/index.tsx


10. web/app/components/share/text-generation/run-once/index.spec.tsx 🧪 Tests +42/-0

Add tests for maxLength attribute behavior

web/app/components/share/text-generation/run-once/index.spec.tsx


11. web/app/components/share/text-generation/run-once/index.tsx 🐞 Bug fix +1/-2

Use max_length property without fallback constant

web/app/components/share/text-generation/run-once/index.tsx


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 10, 2026

Code Review by Qodo

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

Grey Divider


Action required

1. console.log in checkBatchInputs 📘 Rule violation ✧ Quality
Description
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.
Code

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

+    console.log('Checking batch inputs:', { dataLength: data.length, headerData })
Evidence
PR Compliance ID 23 forbids console.* statements in production frontend code. The TextGeneration
component adds a console.log call inside checkBatchInputs.

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

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, 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


2. Unguarded max_length compare 🐞 Bug ✓ Correctness
Description
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.
Code

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

+          if (item[varIndex].length > varItem.max_length) {
            moreThanMaxLengthVarName = varItem.name
-            maxLength = maxLen
+            maxLength = varItem.max_length
            errorRowIndex = index + 1
Evidence
PromptVariable.max_length is declared optional, and the web tsconfig has strict: true; therefore
number > (number | undefined) and assigning (number | undefined) into a number are TypeScript
errors. The newly added code does both without any guard or defaulting.

web/app/components/share/text-generation/index.tsx[249-275]
web/models/debug.ts[51-66]
web/tsconfig.json[22-29]

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

## 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



Remediation recommended

3. maxLength zero blocks input 🐞 Bug ✓ Correctness
Description
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.
Code

web/app/components/share/text-generation/run-once/index.tsx[142]

+                        maxLength={item.max_length}
Evidence
The base Input component spreads props onto the native <input>, so a numeric maxLength={0}
becomes an enforced DOM constraint. The codebase also contains cases where max_length is checked via
truthiness before applying length limiting/slicing, which would intentionally treat 0 as “no limit”;
passing 0 directly to maxLength contradicts that and can break user input.

web/app/components/share/text-generation/run-once/index.tsx[136-144]
web/app/components/base/input/index.tsx[84-111]
web/app/components/base/chat/embedded-chatbot/hooks.tsx[188-257]
web/app/components/rag-pipeline/components/panel/input-field/editor/index.spec.tsx[1317-1327]

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

## 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


Grey Divider

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

Grey Divider

Grey Divider

Previous review results

Review updated until commit fc5f36e

Results up to commit N/A


Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again
Grey Divider Grey Divider

Qodo Logo

@tomerqodo
Copy link
Copy Markdown
Author

/agentic_review

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 10, 2026

Persistent review updated to latest commit fc5f36e

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

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

Comment on lines +261 to 264
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. 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}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

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

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