Bug: CameraStage doesn't propagate camera_y to PipelineContext #40

Closed
opened 2026-03-19 05:42:20 +00:00 by david · 0 comments
Owner

Problem

ViewportFilterStage reads camera position from ctx.get("camera_y", 0) but CameraStage never sets this value in the context state.

Root Cause

  1. ViewportFilterStage dependency: Filter uses camera_y to determine which items are visible (line 76 in transform.py)
  2. CameraStage isolation: CameraStage operates independently and doesn't communicate its state to other stages
  3. No state propagation: CameraStage never calls ctx.set("camera_y", camera.y) or ctx.set_state("camera_y", camera.y)

Expected Behavior

ViewportFilterStage should read the current camera position from context and filter items accordingly. For example, with camera_y = 100, items starting at position 100+ should be visible.

Current Behavior

ViewportFilterStage always reads camera_y = 0 because it's never updated, causing incorrect filtering.

Code Locations

  • engine/pipeline/adapters/transform.py: Line 76 - camera_y = ctx.get("camera_y", 0)
  • engine/pipeline/adapters/camera.py: CameraStage.process() doesn't set context state
  • engine/app/pipeline_runner.py: Line 631 - Initial camera_y = 0 set once, never updated

Test Case

From tests/test_viewport_filter_performance.py:216:

def test_camera_y_propagates_to_filter(self):
    ctx.set("camera_y", 100)
    # Should see different items visible with camera_y = 100

Proposed Fix

In CameraStage.process():

  1. After applying camera transformation, get camera.y position
  2. Call ctx.set_state("camera_y", self._camera.y) to propagate to other stages
  • Issue #38: Camera update never called
  • Issue #35: Pipeline Mutation API - stage communication

Acceptance Criteria

  • CameraStage sets camera_y in PipelineContext state
  • ViewportFilterStage reads updated camera_y values
  • Filtering behavior changes with camera position
## Problem `ViewportFilterStage` reads camera position from `ctx.get("camera_y", 0)` but `CameraStage` never sets this value in the context state. ## Root Cause 1. **ViewportFilterStage dependency**: Filter uses camera_y to determine which items are visible (line 76 in transform.py) 2. **CameraStage isolation**: CameraStage operates independently and doesn't communicate its state to other stages 3. **No state propagation**: CameraStage never calls `ctx.set("camera_y", camera.y)` or `ctx.set_state("camera_y", camera.y)` ## Expected Behavior `ViewportFilterStage` should read the current camera position from context and filter items accordingly. For example, with `camera_y = 100`, items starting at position 100+ should be visible. ## Current Behavior ViewportFilterStage always reads `camera_y = 0` because it's never updated, causing incorrect filtering. ## Code Locations - `engine/pipeline/adapters/transform.py`: Line 76 - `camera_y = ctx.get("camera_y", 0)` - `engine/pipeline/adapters/camera.py`: CameraStage.process() doesn't set context state - `engine/app/pipeline_runner.py`: Line 631 - Initial `camera_y = 0` set once, never updated ## Test Case From `tests/test_viewport_filter_performance.py:216`: ```python def test_camera_y_propagates_to_filter(self): ctx.set("camera_y", 100) # Should see different items visible with camera_y = 100 ``` ## Proposed Fix In CameraStage.process(): 1. After applying camera transformation, get `camera.y` position 2. Call `ctx.set_state("camera_y", self._camera.y)` to propagate to other stages ## Related Issues - Issue #38: Camera update never called - Issue #35: Pipeline Mutation API - stage communication ## Acceptance Criteria - [ ] CameraStage sets camera_y in PipelineContext state - [ ] ViewportFilterStage reads updated camera_y values - [ ] Filtering behavior changes with camera position
david closed this issue 2026-03-19 05:46:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: klubhaus/sideline#40