fix: pass border parameter to display and handle special sources properly

BUG FIXES:

1. Border parameter not being passed to display.show()
   - Display backends support border parameter but app.py wasn't passing it
   - Now app.py passes params.border to display.show(border=params.border)
   - Enables border-test preset to actually render borders

2. WebSocket and Multi displays didn't support border parameter
   - Updated WebSocket Protocol to include border parameter
   - Updated MultiDisplay.show() to accept and forward border parameter
   - Updated test to expect border parameter in mock calls

3. app.py didn't properly handle special sources (empty, pipeline-inspect)
   - Border-test preset with source='empty' was still fetching headlines
   - Pipeline-inspect source was never using the introspection data source
   - Now app.py detects special sources and uses appropriate data source stages:
     * 'empty' source → EmptyDataSource stage
     * 'pipeline-inspect' → PipelineIntrospectionSource stage
     * Other sources → traditional items-based approach
   - Uses SourceItemsToBufferStage for special sources instead of RenderStage
   - Sets pipeline on introspection source after build to avoid circular dependency

TESTING:

- All 463 tests pass
- Linting passes
- Manual test: `uv run mainline.py --preset border-test` now correctly shows empty source
- border-test preset now properly initializes without fetching unnecessary content

The issue was that the enhanced app.py code from the original diff didn't make it into
the refactor commit. This fix restores that functionality.
This commit is contained in:
2026-03-16 19:53:58 -07:00
parent e0bbfea26c
commit 637cbc5515
4 changed files with 71 additions and 29 deletions

View File

@@ -165,10 +165,10 @@ class TestMultiDisplay:
multi = MultiDisplay([mock_display1, mock_display2])
buffer = ["line1", "line2"]
multi.show(buffer)
multi.show(buffer, border=False)
mock_display1.show.assert_called_once_with(buffer)
mock_display2.show.assert_called_once_with(buffer)
mock_display1.show.assert_called_once_with(buffer, border=False)
mock_display2.show.assert_called_once_with(buffer, border=False)
def test_clear_forwards_to_all_displays(self):
"""clear forwards to all displays."""