Filter bots before application listeners enrich the event - #43
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/22-pipeline-priorities #43 +/- ##
================================================================
+ Coverage 67.79% 68.76% +0.96%
Complexity 135 135
================================================================
Files 30 30
Lines 413 413
================================================================
+ Hits 280 284 +4
+ Misses 133 129 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
force-pushed
the
fix/22-pipeline-priorities
branch
from
September 7, 2026 11:37
a448cb6 to
5850beb
Compare
loevgaard
force-pushed
the
fix/23-filters-early
branch
from
September 7, 2026 11:37
7360860 to
939221d
Compare
loevgaard
force-pushed
the
fix/22-pipeline-priorities
branch
from
September 7, 2026 12:03
5850beb to
f495dfc
Compare
loevgaard
force-pushed
the
fix/23-filters-early
branch
from
September 7, 2026 12:03
939221d to
f7c16ec
Compare
The filters ran after the application's listeners, so enrichment work was done for bot traffic and then thrown away. Move the filter band above PRIORITY_ENRICH, keeping the no-pixels check late because application listeners may add pixels themselves. Fixes #23
loevgaard
force-pushed
the
fix/22-pipeline-priorities
branch
from
September 7, 2026 12:18
f495dfc to
3bc77c7
Compare
loevgaard
force-pushed
the
fix/23-filters-early
branch
from
September 7, 2026 12:18
f7c16ec to
04febac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23
Problem
The three request-based filters ran at -850, -875 and -900, i.e. after the application's own listeners at priority 0. Enrichment is normally the expensive part of the pipeline: loading the customer, the order, its lines and addresses. For bot traffic all of that work was done and then thrown away when a filter stopped propagation a moment later.
Change
PRIORITY_FILTERmoves from -900 to 600, which puts the three filters between the request populators andPRIORITY_ENRICH. They only readuserData->clientUserAgent, which is populated atPRIORITY_POPULATE, so they have everything they need. Their relative order is unchanged.PopulatePixelsSubscribermoves from 700 to 500 so the filters sit between the request populators and it, which also means the pixel provider is not consulted for bot traffic.StopPropagationIfNoPixelsHasBeenAddedSubscriberdeliberately stays late at -950: an application listener may add pixels itself, so that check has to run after enrichment.Tests
FilterBotsSubscriberTestcovers the filter itself and, with a realEventDispatcher, asserts that a listener registered atPRIORITY_ENRICHis never invoked for a bot request. The pipeline order tests are updated to the new layout, and now also assert the filters still run after the request properties they filter on are populated.