Skip to content

Conversation

@tcdent
Copy link
Owner

@tcdent tcdent commented Jan 18, 2026

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.

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

3 participants