4638 fix(frontend): disable auto-coercion in text editor#4659
4638 fix(frontend): disable auto-coercion in text editor#4659IshaanAggrawal wants to merge 2 commits into
Conversation
|
@IshaanAggrawal is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughTestcaseDrillInFieldRenderer now coerces text edits using coerceTextEdit(inferLogicalType(value)); VariableCard's TextLeafEditor forwards raw text strings to onChange without coercion. Imports, comments, and callback dependency lists were updated accordingly. ChangesText edit coercion changes
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/agenta-entity-ui/src/testcase/TestcaseDrillInFieldRenderer.tsx (1)
223-225: ⚡ Quick winUpdate stale comment to match the new non-coercing behavior (Lines 223-225).
This comment says native type is preserved via
inferPrimitiveFromTextinTextEditor.handleChange, but that path was removed in this PR. Keeping this comment is misleading for future edits.Proposed fix
- // primitive values through TextEditor so the editor doesn't swap mid-typing. - // The native type is still preserved via inferPrimitiveFromText in - // TextEditor.handleChange, so the type chip stays accurate. Uncomment the + // primitive values through TextEditor so the editor doesn't swap mid-typing. + // Text/Markdown editors intentionally emit raw strings; native type coercion + // is only applied in explicit JSON/YAML code modes. Uncomment the
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ef79dad0-f0c4-4915-a3e3-0374f6af094d
📒 Files selected for processing (1)
web/packages/agenta-entity-ui/src/testcase/TestcaseDrillInFieldRenderer.tsx
f96576e to
65e1348
Compare
mmabrouk
left a comment
There was a problem hiding this comment.
CleanShot.2026-06-12.at.13.49.18.mp4
I have tried this locally and it's quite flacky. Is it the same for you?
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/agenta-playground-ui/src/components/PlaygroundInputsBody/VariableCard.tsx (1)
31-31:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove unused import
coerceTextEdit.The
coerceTextEditfunction is imported but no longer used after removing the coercion logic from theTextLeafEditor.handleChangecallback. Please remove this import for consistency with the cleanup performed inTestcaseDrillInFieldRenderer.tsx.🧹 Proposed fix
import { FormView, ViewTypeSelect, buildEmptyShapeFromSchema, - coerceTextEdit, inferLogicalType, isChatMessagesArray, parseJsonEdit,
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 578ce354-fdf1-4353-bd6c-70fc0cffa954
📒 Files selected for processing (1)
web/packages/agenta-playground-ui/src/components/PlaygroundInputsBody/VariableCard.tsx
|
✅ Thanks @IshaanAggrawal! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon. |
|
@mmabrouk Please check i have update the video |
mmabrouk
left a comment
There was a problem hiding this comment.
The behavior here is wrong. The rule is simple:
- If the mode is text or markdown -> we cannot change the type in this view. If it's
5and a string, it will stay always a string, - If the mode is json or yaml -> the type of the field can change according to what is edited in json. Meaning a string
"true"after being edited totruewill become a bool, and a number5after being edit to"5"will become a string - Number and bools can only be seen as json or yaml. You don't have a text/markdown view for these.
412c6e1 to
e58d1c3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 964c1158-03f4-4217-be1d-852a329e6657
📒 Files selected for processing (2)
web/packages/agenta-entity-ui/src/testcase/TestcaseDrillInFieldRenderer.tsxweb/packages/agenta-playground-ui/src/components/PlaygroundInputsBody/VariableCard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- web/packages/agenta-playground-ui/src/components/PlaygroundInputsBody/VariableCard.tsx
a65dbf7 to
bdcce3c
Compare
c3a0296 to
a2e9150
Compare
a586959 to
a60bf3f
Compare
…com/IshaanAggrawal/agenta into fix/4638-text-mode-no-type-coercion
a60bf3f to
79ad2e5
Compare
Summary
What changed: Removed auto-coercion from the
TextEditorcomponents in both the Testcase Drawer and the Playground variable cards. They now strictly pass raw strings without attempting to infer primitives.Why was this change needed: Typing values like
Falseor5while the selector was set to Text mode was incorrectly mutating the underlying variable type tobooleanornumber.What problem does it solve: Fixes an issue in both the playground cards and the test case drawer where type chips would improperly update when the user intended for inputs to remain as plain strings.
Root cause: The text handlers in
TestcaseDrillInFieldRenderer.tsxandVariableCard.tsxwere usinginferPrimitiveFromText()andcoerceTextEdit()for default view modes, causing intended strings to auto-coerce.Fixes #4638
Verified locally
False,5,true) remain strings when using the Text or Markdown view modes across both the Drawer and the Playground Cards.inferPrimitiveFromTextandcoerceTextEdit) were cleaned up inTestcaseDrillInFieldRenderer.tsxandVariableCard.tsx.Demo
Screen.Recording.2026-06-15.132631.mp4
QA follow-up
False. The type chip should staystringand the stored value should be"False".5,true,0. All should remain strings.false. The type chip should update toboolean.5. The type chip should update tonumber.