After experimenting with different arrangements I have settled on a design that is very simple and cannot overflow the rain barrel. The main concept of the design is to align the rain diverter with the desired water level in the barrel. From the diverter run a hose to the bottom of the barrel. Water will drain out of the diverter until the water level in the barrel is the same as the diverter.
This design will work with diverters that have a ported reservoir (most). The commercial rain diverters are engineered to have a properly sized overflow port that simply spills water into the downspout once the reservoir is full.