@@ -5,15 +5,21 @@ import (
55
66 hs "github.com/prebid/prebid-server/v4/hooks/hookstage"
77 "github.com/prebid/prebid-server/v4/openrtb_ext"
8+ "github.com/prebid/prebid-server/v4/rules"
89 "github.com/prebid/prebid-server/v4/util/randomutil"
910)
1011
1112type RequestWrapper = openrtb_ext.RequestWrapper
1213type ModelGroup = cacheModelGroup [RequestWrapper , ProcessedAuctionHookResult ]
1314
15+ type includeBiddersState struct {
16+ allowedBidders map [string ]struct {}
17+ contexts []rules.ResultFunctionMeta
18+ }
19+
1420type ProcessedAuctionHookResult struct {
1521 HookResult hs.HookResult [hs.ProcessedAuctionRequestPayload ]
16- AllowedBidders map [ string ] struct {}
22+ IncludeBidders includeBiddersState
1723}
1824
1925func handleProcessedAuctionHook (
@@ -24,7 +30,9 @@ func handleProcessedAuctionHook(
2430 HookResult : hs.HookResult [hs.ProcessedAuctionRequestPayload ]{
2531 ChangeSet : hs.ChangeSet [hs.ProcessedAuctionRequestPayload ]{},
2632 },
27- AllowedBidders : make (map [string ]struct {}),
33+ IncludeBidders : includeBiddersState {
34+ allowedBidders : make (map [string ]struct {}),
35+ },
2836 }
2937
3038 for _ , ruleSet := range ruleSets {
@@ -39,11 +47,15 @@ func handleProcessedAuctionHook(
3947 result .HookResult .Errors = append (result .HookResult .Errors , err .Error ())
4048 }
4149
42- if len (result .AllowedBidders ) > 0 {
43- result .HookResult .ChangeSet .ProcessedAuctionRequest ().Bidders ().Add (result .AllowedBidders )
50+ if len (result .IncludeBidders . allowedBidders ) > 0 {
51+ result .HookResult .ChangeSet .ProcessedAuctionRequest ().Bidders ().Add (result .IncludeBidders . allowedBidders )
4452 }
4553 }
4654
55+ // Once every ruleset has run the final allow-list is known, so surface a debug warning naming the
56+ // bidders that were implicitly removed by include rules (present in the request but not allowed).
57+ appendInclusionWarnings (payload .Request , & result )
58+
4759 return result .HookResult , nil
4860}
4961
0 commit comments