Revert "Revert "Merge branch 'avoid_adding_invalid_conditions_when_deserializing_filter'""

This reverts commit 2c341a784c87dc5c7ded80813df6f348033abd2f.