# Composite Nesting Support ## Phase 1: Store — Cycle & Depth Validation - [x] Add `get_transitive_dependencies()` to ColorStripStore - [x] Add `validate_nesting()` with cycle detection + depth limit (MAX_DEPTH=4) ## Phase 2: API — Validation in Create/Update - [x] Call `validate_nesting()` in create handler for composite sources - [x] Call `validate_nesting()` in update handler for composite sources ## Phase 3: Runtime — Depth Guard in Stream - [x] Add `depth` parameter to CompositeColorStripStream - [x] Pass depth through ColorStripStreamManager.acquire() - [x] Cap depth at runtime to prevent runaway nesting ## Phase 4: Frontend — Allow Composites in Layer Dropdown - [x] Remove `source_type !== 'composite'` filter (keep self-exclusion) - [x] Update docstring in composite_stream.py ## Phase 5: Tests - [x] Cycle detection tests (A→B→A, self-reference) - [x] Depth limit tests (chain exceeding MAX_DEPTH) - [x] Valid nesting tests (A→B both composite, no cycle) ## Phase 6: Lint & Build - [x] Ruff check passes - [x] TypeScript build passes - [x] All existing tests pass (715/715)