We found an example of a case where the clearSources fix from before wasn't sufficient. Due to the recursive nature of the algorithm, we were setting sources correctly, but were getting extra sources in trim. This caused the trim behavior to differ. The fix is to clone the extended selector fully, which will prevent sources from being added to the one in our extension subset map. To do this, I implemented a cloneFully on Complex_Selector and a clone on Compound_Selector.
Add debug code to check for sources problems at the root of the cause.