Ouch. My head's pretty bruised now after a morning of diabolical boolean logic. Should help in the long run though.
In the SCS Framework (a compound document framework for Zope), I had previously had a pre-canned query in the crucial 'partcontainer.listParts()' method, with a little bit of support for matching parts on their Major and Minor types. It was becoming apparent that this was a pattern I needed in some other parts of the system (like rendering), so I changed things around into a combination Visitor/Command pattern, in the form of PartMatcher and PartFilter respectively. Then I realized they could be unified into a single class (PartFilter).
And I have to give thanks, again, to the unit tests. I had a bunch of tests in place already that tested listParts() based on its old behavior, and they failed a few times when switching to the new. Some of the failures were name/import errors from shuffling the code around. Others were from boolean logic head games gone bad. Everything is running smoothly again now.