refactor(remove): Delete RenderStage and ItemsStage classes (Phase 4.3)
- Delete RenderStage class (124 lines) - used legacy rendering - Delete ItemsStage class (32 lines) - deprecated bootstrap mechanism - Delete create_items_stage() function (3 lines) - Add ListDataSource class to wrap pre-fetched items (38 lines) - Update app.py to use ListDataSource + DataSourceStage instead of ItemsStage - Remove deprecated test methods for RenderStage and ItemsStage - Tests pass (508 core tests, legacy failures pre-existing)
This commit is contained in:
@@ -586,47 +586,6 @@ class TestPipelinePresets:
|
||||
class TestStageAdapters:
|
||||
"""Tests for pipeline stage adapters."""
|
||||
|
||||
def test_render_stage_capabilities(self):
|
||||
"""RenderStage declares correct capabilities."""
|
||||
from engine.pipeline.adapters import RenderStage
|
||||
|
||||
stage = RenderStage(items=[], name="render")
|
||||
assert "render.output" in stage.capabilities
|
||||
|
||||
def test_render_stage_dependencies(self):
|
||||
"""RenderStage declares correct dependencies."""
|
||||
from engine.pipeline.adapters import RenderStage
|
||||
|
||||
stage = RenderStage(items=[], name="render")
|
||||
assert "source" in stage.dependencies
|
||||
|
||||
def test_render_stage_process(self):
|
||||
"""RenderStage.process returns buffer."""
|
||||
from engine.pipeline.adapters import RenderStage
|
||||
from engine.pipeline.core import PipelineContext
|
||||
|
||||
items = [
|
||||
("Test Headline", "test", 1234567890.0),
|
||||
]
|
||||
stage = RenderStage(items=items, width=80, height=24)
|
||||
ctx = PipelineContext()
|
||||
|
||||
result = stage.process(None, ctx)
|
||||
assert result is not None
|
||||
assert isinstance(result, list)
|
||||
|
||||
def test_items_stage(self):
|
||||
"""ItemsStage provides items to pipeline."""
|
||||
from engine.pipeline.adapters import ItemsStage
|
||||
from engine.pipeline.core import PipelineContext
|
||||
|
||||
items = [("Headline 1", "src1", 123.0), ("Headline 2", "src2", 124.0)]
|
||||
stage = ItemsStage(items, name="headlines")
|
||||
ctx = PipelineContext()
|
||||
|
||||
result = stage.process(None, ctx)
|
||||
assert result == items
|
||||
|
||||
def test_display_stage_init(self):
|
||||
"""DisplayStage.init initializes display."""
|
||||
from engine.display.backends.null import NullDisplay
|
||||
@@ -765,55 +724,6 @@ class TestEffectPluginStage:
|
||||
class TestFullPipeline:
|
||||
"""End-to-end tests for the full pipeline."""
|
||||
|
||||
def test_pipeline_with_items_and_effect(self):
|
||||
"""Pipeline executes items->effect flow."""
|
||||
from engine.effects.types import EffectConfig, EffectPlugin
|
||||
from engine.pipeline.adapters import EffectPluginStage, ItemsStage
|
||||
from engine.pipeline.controller import Pipeline, PipelineConfig
|
||||
|
||||
class TestEffect(EffectPlugin):
|
||||
name = "test"
|
||||
config = EffectConfig()
|
||||
|
||||
def process(self, buf, ctx):
|
||||
return [f"processed: {line}" for line in buf]
|
||||
|
||||
def configure(self, config):
|
||||
pass
|
||||
|
||||
pipeline = Pipeline(config=PipelineConfig(enable_metrics=False))
|
||||
|
||||
# Items stage
|
||||
items = [("Headline 1", "src1", 123.0)]
|
||||
pipeline.add_stage("source", ItemsStage(items, name="headlines"))
|
||||
|
||||
# Effect stage
|
||||
pipeline.add_stage("effect", EffectPluginStage(TestEffect(), name="test"))
|
||||
|
||||
pipeline.build()
|
||||
|
||||
result = pipeline.execute(None)
|
||||
assert result.success is True
|
||||
assert "processed:" in result.data[0]
|
||||
|
||||
def test_pipeline_with_items_stage(self):
|
||||
"""Pipeline with ItemsStage provides items through pipeline."""
|
||||
from engine.pipeline.adapters import ItemsStage
|
||||
from engine.pipeline.controller import Pipeline, PipelineConfig
|
||||
|
||||
pipeline = Pipeline(config=PipelineConfig(enable_metrics=False))
|
||||
|
||||
# Items stage provides source
|
||||
items = [("Headline 1", "src1", 123.0), ("Headline 2", "src2", 124.0)]
|
||||
pipeline.add_stage("source", ItemsStage(items, name="headlines"))
|
||||
|
||||
pipeline.build()
|
||||
|
||||
result = pipeline.execute(None)
|
||||
assert result.success is True
|
||||
# Items are passed through
|
||||
assert result.data == items
|
||||
|
||||
def test_pipeline_circular_dependency_detection(self):
|
||||
"""Pipeline detects circular dependencies."""
|
||||
from engine.pipeline.controller import Pipeline
|
||||
@@ -857,33 +767,6 @@ class TestFullPipeline:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def test_datasource_stage_capabilities_match_render_deps(self):
|
||||
"""DataSourceStage provides capability that RenderStage can depend on."""
|
||||
from engine.data_sources.sources import HeadlinesDataSource
|
||||
from engine.pipeline.adapters import DataSourceStage, RenderStage
|
||||
|
||||
# DataSourceStage provides "source.headlines"
|
||||
ds_stage = DataSourceStage(HeadlinesDataSource(), name="headlines")
|
||||
assert "source.headlines" in ds_stage.capabilities
|
||||
|
||||
# RenderStage depends on "source"
|
||||
r_stage = RenderStage(items=[], width=80, height=24)
|
||||
assert "source" in r_stage.dependencies
|
||||
|
||||
# Test the capability matching directly
|
||||
from engine.pipeline.controller import Pipeline, PipelineConfig
|
||||
|
||||
pipeline = Pipeline(config=PipelineConfig(enable_metrics=False))
|
||||
pipeline.add_stage("source", ds_stage)
|
||||
pipeline.add_stage("render", r_stage)
|
||||
|
||||
# Build capability map and test matching
|
||||
pipeline._capability_map = pipeline._build_capability_map()
|
||||
|
||||
# "source" should match "source.headlines"
|
||||
match = pipeline._find_stage_with_capability("source")
|
||||
assert match == "source", f"Expected 'source', got {match}"
|
||||
|
||||
|
||||
class TestPipelineMetrics:
|
||||
"""Tests for pipeline metrics collection."""
|
||||
|
||||
Reference in New Issue
Block a user