refactor: remove dead parallel abstraction from tool renderer subsystem - #479
refactor: remove dead parallel abstraction from tool renderer subsystem#479tunahorse wants to merge 1 commit into
Conversation
ToolRendererProtocol was a ~90-line runtime_checkable Protocol that exactly duplicated the BaseToolRenderer ABC method-for-method, yet was never used as an annotation, isinstance check, or bound anywhere. Renderers all subclass the ABC, so the Protocol was a second copy of the same interface to keep in sync for no benefit. Also removes two helpers with zero callers (pad_lines, which duplicated BaseToolRenderer.pad_viewport_lines, and list_renderers) and trims the package __init__ re-export list to what external code actually imports: get_renderer plus the submodule imports that register each renderer. Verified by repo-wide grep (zero usages of every removed symbol outside its definition) and the full test suite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HF5Lg9K7LhXLFstq2CKkKq
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.py📄 CodeRabbit inference engine (Custom checks)
Files:
src/tunacode/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/tunacode/ui/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
⚙️ CodeRabbit configuration file
Files:
**/*📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThe renderer package now exposes only lookup-focused imports, while the base module removes protocol-related typing and updates its documentation. Renderer registration continues through side-effect imports. ChangesRenderer API cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 9✅ Passed checks (9 passed)
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 |
Description
Removes a dead parallel abstraction layer from
src/tunacode/ui/renderers/tools/(net −133 lines, no behavior change):ToolRendererProtocol(~90 lines inbase.py): aruntime_checkableProtocol that duplicated theBaseToolRendererABC method-for-method, docstrings included. All six renderers subclass the ABC; the Protocol was never used as a type annotation, isinstance check, or generic bound anywhere insrc,tests, orscripts— it was a second copy of the same seven-method interface to keep in sync for no benefit.pad_lines: free function duplicatingBaseToolRenderer.pad_viewport_linesline-for-line, zero callers.list_renderers: zero callers.__init__.pyre-export surface: previously re-exported 13 symbols under# noqa: F401, but external code only importsget_renderer(inpanels.py) andrender_bash(directly from its submodule). The init now exportsget_rendererplus the six submodule imports whose side effect registers each renderer, with a docstring explaining the registration mechanism.Every removed symbol was verified dead via repo-wide grep (zero usages outside its definition site) before deletion.
Pre-PR Checklist
git fetch origin && git rebase origin/master)uv run pre-commit run --all-files)Type of Change
Testing
uv run pytest) — 325 passed, 2 skippedTest Coverage
get_rendererreturns a renderer forbash,discover,hashline_edit,read_file,web_fetch,write_file).Pre-commit Checks
ruff formatruff checkwithout warningsChecklist
@documentation/and.claude/directories — N/A, removed symbols are not documented therepyproject.toml— no dependency changesDocumentation Updates
@documentation/— N/A.claude/— N/AAdditional Notes
Audit also surfaced six exception classes in
src/tunacode/exceptions.pywith zero references (StateError,ServiceError,GitOperationError,ModelConfigurationError,SetupValidationError,ToolBatchingJSONError, ~70 lines) — left out of this PR to keep it a single focused change; can follow up separately.🤖 Generated with Claude Code
https://claude.ai/code/session_01HF5Lg9K7LhXLFstq2CKkKq
Generated by Claude Code
Summary
get_rendererand renderer imports needed for registration.ToolRendererProtocol,pad_lines, andlist_renderersabstractions.