refactor(cli): centralize dense payload detection in tool mapping#28408
refactor(cli): centralize dense payload detection in tool mapping#28408Arjan-P wants to merge 1 commit into
Conversation
Move dense payload detection logic from UI components to `mapToDisplay`. Add `hasDensePayload` property to `IndividualToolCallDisplay` interface. Cleanup redundant helper functions in `ToolGroupMessage`.
|
📊 PR Size: size/S
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the determination of whether a tool call has a dense payload. The hasDensePayload calculation has been moved from the ToolGroupMessage UI component to the mapToDisplay hook in toolMapping.ts, and the result is now exposed as an optional boolean property on the IndividualToolCallDisplay interface. This successfully decouples the UI component from core internals like isFileDiff. I have no additional feedback to provide as the changes are clean and well-structured.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the UI layer to decouple it from backend data internals. By centralizing the logic for detecting 'dense' tool payloads within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the dense payload detection logic for tool calls. The hasDensePayload helper function and its import of isFileDiff have been removed from the ToolGroupMessage component. This logic is now handled during the mapping phase in toolMapping.ts, which computes and assigns the hasDensePayload boolean property directly to the IndividualToolCallDisplay objects. There are no review comments, and I have no feedback to provide.
Title:
refactor(ui): centralize dense payload detection in tool mappingSummary
Refactors the UI to reduce its awareness of backend data internals. It moves the complex payload density
detection logic from
ToolGroupMessageintomapToDisplayby introducing ahasDensePayloadbooleanproperty to the
IndividualToolCallDisplayinterface.Details
Previously, UI components (
ToolGroupMessage.tsx) contained brittle type guards (isFileDiff) and objectshape checks to determine if a tool output was "dense" (e.g., a diff or structured object). This logic is
now centralized in
mapToDisplay, making the UI component lighter and easier to maintain.Related Issues
#28260
How to Validate
Run the targeted UI tests to ensure no regressions in component rendering:
Pre-Merge Checklist