Open
Conversation
Add comprehensive render tests for each tool block type to enable safe refactoring of shared rendering code: - Add lines_to_string() helper in transcript.rs for testing - Add render tests for ReadFileBlock (pending, running, complete, denied, bg, error) - Add render tests for WriteFileBlock - Add render tests for EditFileBlock (including single/multiple edits) - Add render tests for ShellBlock (including working_dir display) - Add render tests for FetchUrlBlock - Add render tests for FetchHtmlBlock - Add render tests for WebSearchBlock - Add render tests for OpenFileBlock (including line number display) - Add render tests for SpawnAgentBlock (including long task truncation) - Add render tests for ListBackgroundTasksBlock - Add render tests for GetBackgroundTaskBlock Each block type is tested for all status states (Pending, Running, Complete, Error, Denied) and background mode rendering. These tests capture the current rendering format to enable refactoring to shared rendering utilities.
Extract common rendering logic into render_tool_block() in transcript.rs, eliminating repetitive code across all 11 tool block implementations. Each tool's render() method now only needs to compute its specific args (as styled Spans) and pass them to the shared function which handles: - Status icon rendering - Background prefix [bg] - Tool name and argument formatting - Approval prompt for pending status - Result text output - Denied message display Net reduction of ~221 lines of duplicated rendering code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add comprehensive render tests for each tool block type to enable
safe refactoring of shared rendering code:
Each block type is tested for all status states (Pending, Running,
Complete, Error, Denied) and background mode rendering. These tests
capture the current rendering format to enable refactoring to shared
rendering utilities.