From https://datatracker.ietf.org/doc/html/rfc7643#section-2.3.2
Boolean
The literal "true" or "false"
Azure is sending stuff like this via PATCH
{"op":"Replace","path":"roles[primary eq \"True\"].value","value":"employee"}
Here, I would expect return value from ComparisonExpression#compareValue is true. Instead, it's "True".
I suggest using
filter_var($filter->compareValue, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)