From 4b4ee303642f0e0c4e8a5b8af6a5ebe681189dd5 Mon Sep 17 00:00:00 2001 From: Caleb Raitto Date: Thu, 12 Dec 2024 17:19:56 -0500 Subject: [PATCH 1/3] Fix an edge case with join / win history Due to join / bid history being floored to a multiple of UTC days, there's a possibility that the interest group outlives its history, even if it isn't rejoined. This leads to oddities like interest groups with a join count of 0. Fix this by letting history live for one more day. --- spec.bs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/spec.bs b/spec.bs index 7eb26cbe6..154d8fc2d 100644 --- a/spec.bs +++ b/spec.bs @@ -1757,11 +1757,11 @@ following steps. They return a failure if failing to fetch the script or wasm, o 1. Let |igGenerateBid| be the result of [=building an interest group passed to generateBid=] with |ig|. 1. Set |browserSignals|["{{BiddingBrowserSignals/joinCount}}"] to the sum of |ig|'s - [=interest group/join counts=] for all days within the last 30 days. + [=interest group/join counts=] for all days within the last 31 days in UTC, inclusive. 1. Set |browserSignals|["{{BiddingBrowserSignals/recency}}"] to the [=current coarsened wall time=] minus |ig|'s [=interest group/join time=], in milliseconds. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/bidCount}}"] to the sum of |ig|'s - [=interest group/bid counts=] for all days within the last 30 days. + [=interest group/bid counts=] for all days within the last 31 days in UTC, inclusive. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/adComponentsLimit}}"] to 40. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/multiBidLimit}}"] to |multiBidLimit|. 1. Let |prevWins| be a new [=sequence=]<{{PreviousWin}}>. @@ -3388,11 +3388,17 @@ A server auction interest group is a [=struct=] with the following [= A server auction browser signals is a [=struct=] with the following [=struct/items=]:
: bid count - :: A count of the number of bids for this interest group in the last 30 days. - Calculated by summing the [=interest group/bid counts=] for all days within the last 30 days. + :: A count of the number of bids for this interest group in the last 31 days. + Calculated by summing the [=interest group/bid counts=]. + + NOTE: An additional day is added (31 vs. 30 days) to ensure that history is kept for at least as + long as the max group lifetime, since bid counts are kept by UTC day. : join count - :: A count of the number of joins for this interest group in the last 30 days. + :: A count of the number of joins for this interest group in the last 31 days, inclusive. Calculated by summing the [=interest group/join counts=]. + + NOTE: An additional day is added (31 vs. 30 days) to ensure that history is kept for at least as + long as the max group lifetime, since join counts are kept by UTC day. : recency ms :: A [=duration=], in milliseconds, representing the [=current coarsened wall time=] at the time this object was constructed minus the corresponding [=interest group=]'s @@ -3557,9 +3563,11 @@ The getInterestGroupAdAuctionData(|configIDL|) m 1. [=list/Append=] |serverPrevWin| to |prevWins|. 1. Let |browserSignals| be a new [=server auction browser signals=] with the following [=struct/items=]: : [=server auction browser signals/bid count=] - :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 30 days + :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 31 days, + inclusive. : [=server auction browser signals/join count=] - :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 30 days + :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 31 days, + inclusive. : [=server auction browser signals/recency ms=] :: the [=current coarsened wall time=] minus |ig|'s [=interest group/join time=] in millseconds @@ -4881,8 +4889,10 @@ dictionary StorageInterestGroup : AuctionAdInterestGroup { 1. Let |encoded| be the result of running [=forgiving-base64 encode=] with |ig|'s [=interest group/additional bid key=]. 1. If |encoded| is failure, then return failure. 1. [=map/Set=] |resultIg|["{{AuctionAdInterestGroup/additionalBidKey}}"] to the result of running [=forgiving-base64 encode=] with |ig|'s [=interest group/additional bid key=]. - 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/joinCount}}"] to the sum of |ig|'s [=interest group/join counts=] for all days within the last 30 days. - 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/bidCount}}"] to the sum of |ig|'s [=interest group/bid counts=] for all days within the last 30 days. + 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/joinCount}}"] to the sum of |ig|'s [=interest + group/join counts=] for all days within the last 31 days, inclusive. + 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/bidCount}}"] to the sum of |ig|'s [=interest + group/bid counts=] for all days within the last 31 days, inclusive. 1. Let |resultPrevWins| be a new [=sequence=]<{{PreviousWin}}>. 1. [=list/For each=] |prevWin| of |ig|'s [=interest group/previous wins=] for all days within the the last 30 days: From eb0bc04d339cc400ef672a7da15311b2311c38cd Mon Sep 17 00:00:00 2001 From: Caleb Raitto Date: Thu, 16 Jan 2025 17:17:24 -0500 Subject: [PATCH 2/3] Update spec.bs --- spec.bs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/spec.bs b/spec.bs index 78d2b33a4..c8f1c678a 100644 --- a/spec.bs +++ b/spec.bs @@ -1771,11 +1771,11 @@ following steps. They return a failure if failing to fetch the script or wasm, o 1. Let |igGenerateBid| be the result of [=building an interest group passed to generateBid=] with |ig|. 1. Set |browserSignals|["{{BiddingBrowserSignals/joinCount}}"] to the sum of |ig|'s - [=interest group/join counts=] for all days within the last 31 days in UTC, inclusive. + [=interest group/join counts=] for all days within the last 30 days in UTC, inclusive. 1. Set |browserSignals|["{{BiddingBrowserSignals/recency}}"] to the [=current coarsened wall time=] minus |ig|'s [=interest group/join time=], in milliseconds. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/bidCount}}"] to the sum of |ig|'s - [=interest group/bid counts=] for all days within the last 31 days in UTC, inclusive. + [=interest group/bid counts=] for all days within the last 30 days in UTC, inclusive. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/adComponentsLimit}}"] to 40. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/multiBidLimit}}"] to |multiBidLimit|. 1. Let |prevWins| be a new [=sequence=]<{{PreviousWin}}>. @@ -3561,17 +3561,17 @@ A server auction interest group is a [=struct=] with the following [= A server auction browser signals is a [=struct=] with the following [=struct/items=]:
: bid count - :: A count of the number of bids for this interest group in the last 31 days. + :: A count of the number of bids for this interest group in the last 30 days. Calculated by summing the [=interest group/bid counts=]. - NOTE: An additional day is added (31 vs. 30 days) to ensure that history is kept for at least as - long as the max group lifetime, since bid counts are kept by UTC day. + NOTE: Since bid counts are kept by UTC day, interest groups that live long enough will have + early bid history expire before the interest group expires. : join count - :: A count of the number of joins for this interest group in the last 31 days, inclusive. + :: A count of the number of joins for this interest group in the last 30 days, inclusive. Calculated by summing the [=interest group/join counts=]. - NOTE: An additional day is added (31 vs. 30 days) to ensure that history is kept for at least as - long as the max group lifetime, since join counts are kept by UTC day. + NOTE: Since bid counts are kept by UTC day, interest groups that live long enough will have + early join history expire before the interest group expires. : recency ms :: A [=duration=], in milliseconds, representing the [=current coarsened wall time=] at the time this object was constructed minus the corresponding [=interest group=]'s @@ -3766,10 +3766,10 @@ The getInterestGroupAdAuctionData(|configIDL|) m 1. [=list/Append=] |serverPrevWin| to |prevWins|. 1. Let |browserSignals| be a new [=server auction browser signals=] with the following [=struct/items=]: : [=server auction browser signals/bid count=] - :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 31 days, + :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 30 days, inclusive. : [=server auction browser signals/join count=] - :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 31 days, + :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 30 days, inclusive. : [=server auction browser signals/recency ms=] :: the [=current coarsened wall time=] minus |ig|'s [=interest group/join time=] in @@ -5096,9 +5096,9 @@ dictionary StorageInterestGroup : AuctionAdInterestGroup { 1. If |encoded| is failure, then return failure. 1. [=map/Set=] |resultIg|["{{AuctionAdInterestGroup/additionalBidKey}}"] to the result of running [=forgiving-base64 encode=] with |ig|'s [=interest group/additional bid key=]. 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/joinCount}}"] to the sum of |ig|'s [=interest - group/join counts=] for all days within the last 31 days, inclusive. + group/join counts=] for all days within the last 30 days, inclusive. 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/bidCount}}"] to the sum of |ig|'s [=interest - group/bid counts=] for all days within the last 31 days, inclusive. + group/bid counts=] for all days within the last 30 days, inclusive. 1. Let |resultPrevWins| be a new [=sequence=]<{{PreviousWin}}>. 1. [=list/For each=] |prevWin| of |ig|'s [=interest group/previous wins=] for all days within the the last 30 days: From a4de8c3bafe961cba9bef9b188101b03b11db3b4 Mon Sep 17 00:00:00 2001 From: Caleb Raitto Date: Wed, 22 Jan 2025 15:36:39 -0500 Subject: [PATCH 3/3] Update spec.bs --- spec.bs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec.bs b/spec.bs index c8f1c678a..348af1b1b 100644 --- a/spec.bs +++ b/spec.bs @@ -2305,10 +2305,10 @@ contributions map=] |realTimeContributionsMap|, and a [=policy container=] |poli :: |auctionConfig|'s [=auction config/trusted scoring signals coordinator=] : [=trusted scoring signals request/owner origin=] - :: |generatedBid|'s [=generated bid=/interest group=]'s [=interest group/owner=] + :: |generatedBid|'s [=generated bid/interest group=]'s [=interest group/owner=] : [=trusted scoring signals request/joining origin=] - :: |generatedBid|'s [=generated bid=/interest group=]'s [=interest group/joining origin=] + :: |generatedBid|'s [=generated bid/interest group=]'s [=interest group/joining origin=] 1. If |auctionConfig|'s [=auction config/trusted scoring signals url=]'s [=url/origin=] is not [=same origin=] with |auctionConfig|'s [=auction config/seller=], then set |isCrossOrigin| to @@ -3567,7 +3567,7 @@ A server auction browser signals is a [=struct=] with the following [ NOTE: Since bid counts are kept by UTC day, interest groups that live long enough will have early bid history expire before the interest group expires. : join count - :: A count of the number of joins for this interest group in the last 30 days, inclusive. + :: A count of the number of joins for this interest group in the last 30 UTC days, inclusive. Calculated by summing the [=interest group/join counts=]. NOTE: Since bid counts are kept by UTC day, interest groups that live long enough will have @@ -3766,11 +3766,11 @@ The getInterestGroupAdAuctionData(|configIDL|) m 1. [=list/Append=] |serverPrevWin| to |prevWins|. 1. Let |browserSignals| be a new [=server auction browser signals=] with the following [=struct/items=]: : [=server auction browser signals/bid count=] - :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 30 days, + :: the sum of |ig|'s [=interest group/bid counts=] with a bid day within the last 30 UTC days, inclusive. : [=server auction browser signals/join count=] - :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 30 days, - inclusive. + :: the sum of |ig|'s [=interest group/join counts=] with a join day within the last 30 UTC + days, inclusive. : [=server auction browser signals/recency ms=] :: the [=current coarsened wall time=] minus |ig|'s [=interest group/join time=] in millseconds @@ -5096,9 +5096,9 @@ dictionary StorageInterestGroup : AuctionAdInterestGroup { 1. If |encoded| is failure, then return failure. 1. [=map/Set=] |resultIg|["{{AuctionAdInterestGroup/additionalBidKey}}"] to the result of running [=forgiving-base64 encode=] with |ig|'s [=interest group/additional bid key=]. 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/joinCount}}"] to the sum of |ig|'s [=interest - group/join counts=] for all days within the last 30 days, inclusive. + group/join counts=] for all days within the last 30 UTC days, inclusive. 1. [=map/Set=] |resultIg|["{{StorageInterestGroup/bidCount}}"] to the sum of |ig|'s [=interest - group/bid counts=] for all days within the last 30 days, inclusive. + group/bid counts=] for all days within the last 30 UTC days, inclusive. 1. Let |resultPrevWins| be a new [=sequence=]<{{PreviousWin}}>. 1. [=list/For each=] |prevWin| of |ig|'s [=interest group/previous wins=] for all days within the the last 30 days: @@ -8532,7 +8532,7 @@ headers. It's a [=struct=] with the following [=struct/items=]: :: A [=byte sequence=], null, or failure. Initially null. The body of the script. : origins authorized for cross origin trusted signals :: A [=list=] of [=origins=] or null. Initially null. Parsed value of - [:Ad-Auction-Allow-Trusted-Scoring-Signals-From:]. + [:Ad-Auction-Allow-Trusted-Scoring-Signals-From:]. : fetch duration :: A [=duration=] in milliseconds, denoting how long it took the fetch to complete.
@@ -8986,7 +8986,7 @@ requests into smaller number of fetches. It's a [=struct=] with the following [= : request map :: A [=map=] from a tuple of [=script fetcher=], a [=URL=] representating the trusted signals base [=URL=], {{unsigned short}} or null for experiment ID, [=origin=] or null for coordinator, - and [=origin=], representing the top frame's [=origin], to a [=list=] of [=trusted scoring + and [=origin=], representing the top frame's [=origin=], to a [=list=] of [=trusted scoring signals requests=]. This organizes fetches that can possibly be merged together. : url length limit :: A {{long}} denoting a user-configured limit which should not be exceeded due to combining of