How to use DEBUG=1 and COMPARE=<filename> to debug the matching results of your engine #2165
Replies: 4 comments 7 replies
-
@remusao @ameshkov @antonok-edm @gorhill Replace Cliqz above with tsurlfilter, Brave, or uBlock Origin and you've got a way to find and analyze issues more quickly. I would compare results against either Adblock Plus or uBlock Origin since they are both extremely stable and most correct in their implementations. |
Beta Was this translation helpful? Give feedback.
-
Okay, I don't get what's wrong, check this out:
All the differences look like this:
The question is why neither adblockplus nor ublock apply |
Beta Was this translation helpful? Give feedback.
-
uBO does not support That option solely exists to work around anti-blockers, and it's essentially a directive to to tell the blocker to surrender by blocking less. uBO's approach has been to defuse the anti-blockers (using scriptlets, redirect rules), rather than not blocking to a point which satisfies the anti-blockers.
Probably same as #2125 (comment). |
Beta Was this translation helpful? Give feedback.
-
@mjethani some of the differences are due to missing |
Beta Was this translation helpful? Give feedback.
-
Suppose you are working on the Cliqz ad blocking engine and you want to see if your changes are causing any false positives or any false negatives.
You can start by getting the debug output of another engine that you think gives correct results. This could be a previous stable version of Cliqz, or it could be a different engine like uBlock Origin. Let's take uBlock Origin as an example:
The above command should produce a file called
ublock.debug.json
.Now you can compare the results from Cliqz with those from uBlock Origin:
This should produce a much smaller file called
cliqz.diff.json
.An entry in the file may look like this:
What the value of the
kind
field tells us is that we have a false negative.compareMatchDebug
tells us the filter that was matched by uBlock Origin but not by Cliqz.matchDebug
tells us what filter Cliqz matched, if any. Even though it's clearly a false negative, in some cases it can be so due to an incorrectly matched exception.And that's all there is to it.
The new
DEBUG=1
andCOMPARE=<filename>
options should make development faster by making mistakes easier to catch and analyze.Beta Was this translation helpful? Give feedback.
All reactions