Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#417

Summary by CodeRabbit

  • Bug Fixes

    • Input fields no longer auto-apply default character limits; fields now require explicit max_length settings.
  • Changes

    • Number input fields now accept arbitrary text instead of numeric-only input.
  • Tests

    • Added tests verifying maxLength behavior when explicitly set or undefined.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

This pull request removes the DEFAULT_VALUE_MAX_LEN constant usage across the application, eliminating automatic fallback to a default maximum length for input fields. Components now respect explicit max_length values without applying defaults when the property is undefined.

Changes

Cohort / File(s) Summary
Configuration Templates
web/config/index.ts
Removed max_length: DEFAULT_VALUE_MAX_LEN property from three exported VAR_ITEM_TEMPLATE objects (VAR_ITEM_TEMPLATE, VAR_ITEM_TEMPLATE_IN_WORKFLOW, VAR_ITEM_TEMPLATE_IN_PIPELINE), eliminating the default length constraint at the template level.
Config Modal & Variable Setup
web/app/components/app/configuration/config-var/config-modal/index.tsx, web/app/components/app/configuration/config-var/index.tsx, web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
Removed imports of DEFAULT_VALUE_MAX_LEN and deleted logic that auto-applied default max_length when switching to paragraph or textInput types. Paragraph and text input types no longer receive automatic length defaults.
Chat & Input Panels
web/app/components/app/configuration/debug/chat-user-input.tsx, web/app/components/app/configuration/prompt-value-panel/index.tsx
Removed DEFAULT_VALUE_MAX_LEN imports and changed maxLength prop from fallback logic (max_length || DEFAULT_VALUE_MAX_LEN) to direct assignment (max_length). Prompt value panel also swapped number input type from "number" to "text" to align with string-based value handling.
Text Generation Components
web/app/components/share/text-generation/index.tsx, web/app/components/share/text-generation/run-once/index.tsx
Removed DEFAULT_VALUE_MAX_LEN imports and replaced max-length calculations with direct references to max_length property. Added debug logging for batch input data length in text generation index.
Utility Updates
web/utils/var.ts
Changed destructuring in getNewVarInWorkflow from excluding max_length to capturing all properties via rest operator, preserving max_length in the returned object structure.
Test Suite Updates
web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.spec.tsx, web/app/components/share/text-generation/run-once/index.spec.tsx
Removed test case validating auto-assignment of max_length on paragraph type change. Added two new tests verifying undefined max_length renders without maxLength attribute and defined max_length applies correctly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 No more defaults to hide away,
Let values speak what they say!
Undefined now flows free,
Explicit and clear as can be,
Hopping toward clarity today! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a minimal reference to a benchmark PR with no actual content explaining the changes, rationale, or impact. Provide a detailed summary of changes, explain why the hardcoded limit was removed, describe the new behavior, and include screenshots showing the before/after impact if applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing a hardcoded 48-character limit from text inputs across multiple components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/app/components/share/text-generation/index.tsx (1)

193-200: Remove or guard the debug console.log.
This runs in production clients and can add noise (and potentially expose data in captured logs).

🧹 Suggested guard
-    console.log('Checking batch inputs:', { dataLength: data.length, headerData })
+    if (process.env.NODE_ENV === 'development')
+      console.log('Checking batch inputs:', { dataLength: data.length, headerData })
🧹 Nitpick comments (2)
web/utils/var.ts (1)

32-40: Limit template field propagation for non-text inputs.
Spreading the entire template risks inheriting text-only fields if the template grows later. Consider explicitly selecting base fields for non-textInput types.

♻️ Proposed refactor
-export const getNewVarInWorkflow = (key: string, type = InputVarType.textInput): InputVar => {
-  const { ...rest } = VAR_ITEM_TEMPLATE_IN_WORKFLOW
-  if (type !== InputVarType.textInput) {
-    return {
-      ...rest,
-      type,
-      variable: key,
-      label: key.slice(0, getMaxVarNameLength(key)),
-    }
-  }
+export const getNewVarInWorkflow = (key: string, type = InputVarType.textInput): InputVar => {
+  const { variable, label, required, options } = VAR_ITEM_TEMPLATE_IN_WORKFLOW
+  const base = { variable, label, required, options }
+  if (type !== InputVarType.textInput) {
+    return {
+      ...base,
+      type,
+      variable: key,
+      label: key.slice(0, getMaxVarNameLength(key)),
+    }
+  }
   return {
     ...VAR_ITEM_TEMPLATE_IN_WORKFLOW,
     type,
     variable: key,
     label: key.slice(0, getMaxVarNameLength(key)),
     placeholder: '',
     default: '',
     hint: '',
   }
 }
web/app/components/app/configuration/prompt-value-panel/index.tsx (1)

138-174: Confirm numeric UX after switching to type="text".
If the field is still intended to be numeric-only, consider restoring numeric keyboard and lightweight validation via inputMode/pattern (or verify downstream validation handles non-numeric input).

✅ Suggested tweak (if numeric-only)
-                    {type === 'number' && (
-                      <Input
-                        type="text"
+                    {type === 'number' && (
+                      <Input
+                        type="text"
+                        inputMode="numeric"
+                        pattern="\d*"
                         value={inputs[key] ? `${inputs[key]}` : ''}
                         onChange={(e) => { handleInputValueChange(key, e.target.value) }}
                         placeholder={name}
                         autoFocus={index === 0}
                         maxLength={max_length}
                       />
                     )}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40f2fd0 and ec35128.

📒 Files selected for processing (11)
  • web/app/components/app/configuration/config-var/config-modal/index.tsx
  • web/app/components/app/configuration/config-var/index.tsx
  • web/app/components/app/configuration/debug/chat-user-input.tsx
  • web/app/components/app/configuration/prompt-value-panel/index.tsx
  • web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
  • web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.spec.tsx
  • web/app/components/share/text-generation/index.tsx
  • web/app/components/share/text-generation/run-once/index.spec.tsx
  • web/app/components/share/text-generation/run-once/index.tsx
  • web/config/index.ts
  • web/utils/var.ts
💤 Files with no reviewable changes (5)
  • web/app/components/app/configuration/config-var/config-modal/index.tsx
  • web/config/index.ts
  • web/app/components/app/configuration/config-var/index.tsx
  • web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.spec.tsx
  • web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
🧰 Additional context used
🧬 Code graph analysis (2)
web/app/components/share/text-generation/run-once/index.spec.tsx (1)
web/models/debug.ts (1)
  • PromptConfig (79-82)
web/utils/var.ts (1)
web/config/index.ts (1)
  • VAR_ITEM_TEMPLATE_IN_WORKFLOW (214-220)
🔇 Additional comments (5)
web/app/components/share/text-generation/run-once/index.tsx (1)

137-143: LGTM — maxLength now respects per-variable configuration.
This aligns with removing the global fallback and lets undefined mean “no limit.”

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

239-280: Tests look solid for maxLength behavior.
Good coverage for both undefined and explicit max_length cases.

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

84-119: LGTM — maxLength now directly reflects max_length.
Consistent with the new “no fallback” behavior.

web/app/components/share/text-generation/index.tsx (2)

28-30: LGTM on the config import cleanup.
No issues with this update.


257-264: LGTM — max_length now directly controls batch length validation.
Behavior is consistent with the removal of the default length fallback.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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