Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spec] Add basic B&A response handling #1260

Merged
merged 9 commits into from
Sep 10, 2024
187 changes: 182 additions & 5 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ The <dfn for=Navigator method>runAdAuction(|config|)</dfn> method steps are:
1. Let |auctionReportInfo| be a new [=auction report info=].
1. If |winnerInfo| is not failure, then:
1. Set |auctionReportInfo| to the result of running [=collect forDebuggingOnly reports=] with
|bidDebugReportInfoList| and |winnerInfo|.
|bidDebugReportInfoList|, |auctionConfig|'s [=auction config/seller=], and |winnerInfo|.
1. Set |auctionReportInfo|'s [=auction report info/real time reporting contributions map=] to
|realTimeContributionsMap|.
1. If |winnerInfo| is failure, then [=queue a global task=] on [=DOM manipulation task source=],
Expand Down Expand Up @@ -2821,14 +2821,141 @@ a [=list=] of [=interest groups=] |bidIgs|, and a [=list=] of [=bid debug report
1. Let |requestContexts| be the value of |global|'s [=associated Document's=] [=node navigable's=]
[=traversable navigable's=] [=traversable navigable/saved Bidding and Auction request context=].
1. If |requestContexts|[|requestId|] does not [=map/exist=], return null.
1. Let |response| be the result of deserializing |auctionConfig|'s [=auction config/server response=]
according to the Bidding and Auction Services IETF standard.
1. Set |requestContext| to |requestContexts|[|requestId|]
1. Try to deserialize |auctionConfig|'s [=auction config/server response=] into
a new [=server auction response=], |response|, using |requestContext| as the
context, according to the Bidding and Auction Services IETF standard. If
deserialization is not successful, return failure.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved

Issue: TODO: Link deserialization to IETF standard when available.
(<a href="https://github.com/WICG/turtledove/issues/1254">WICG/turtledove#1254</a>)
1. Construct bids based on |response|.
1. Add the bids form the |response| to |bidIgs|.
1. If |response|'s [=server auction response/is chaff=] field is True, return failure.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. If |response|'s [=server auction response/top level seller=] is not Null, return failure.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved

Issue: TODO: Handle Bidding and Auction Services as component auctions.
(<a href="https://github.com/WICG/turtledove/issues/1254">WICG/turtledove#1254</a>)
1. Let |winningGroup| be the [=interest group=] in the [=user agent=]'s [=interest group set=]
with the [=interest group/owner=] equal to |response|'s
[=server auction response/interest group owner=] and the [=interest group/name=]
equal to |response|'s [=server auction response/interest group name=]. If there is no such group,
return failure.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. Let |winningAd| be the [=interest group ad=] from |winningGroup|'s [=interest group/ads=]
where the [=interest group ad/render url=] equals |response|'s [=server auction response/ad render url=].
If there is no matching ad, return failure.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. Let |winningAdComponents| be a new [=list=] of [=interest group ad=].
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. [=list/For each=] |componentAd| in |response|'s [=server auction response/ad components=]:
1. Let |ad| be the [=interest group ad=] from |winningGroup|'s
[=interest group/ad components=] where the [=interest group ad/render url=]
equals |componentAd|. If there is no matching element, return failure.
1. [=list/Append=] |ad| onto |winningAdComponents|.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. Let |winningBid| be a new [=generated bid=] with the following [=struct/items=]:
: [=generated bid/id=]
:: (0, 0)
: [=generated bid/for k-anon auction=]
:: TODO
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
: [=generated bid/bid=]
:: A new [=bid with currency=] with the following [=struct/items=]:
: [=bid with currency/value=]
:: |response|'s [=server auction response/bid=]
: [=bid with currency/currency=]
:: |response|'s [=server auction response/bid currency=]

: [=generated bid/bid in seller currency=]
:: TODO
: [=generated bid/ad=]
:: |response|'s [=server auction response/ad render url=]
: [=generated bid/ad descriptor=]
:: |winningAd|
: [=generated bid/ad component descriptors=]
:: |winningAdComponents|
: [=generated bid/ad cost=]
:: Null
: [=generated bid/modeling signals=]
:: Null
: [=generated bid/interest group=]
:: |winningGroup|
: [=generated bid/bid ad=]
:: |winningAd|
: [=generated bid/modified bid=]
:: Null
: [=generated bid/bid duration=]
:: 0
: [=generated bid/component seller=]
:: Null
: [=generated bid/target number of ad components=]
:: Null
: [=generated bid/number of mandatory ad components=]
:: Null
1. Let |buyerReportingResult| be a new [=reporting result=] with the following [=struct/items=]:
: [=reporting result/report url=]
:: The value of |response|'s [=server auction response/buyer reporting=]'s [=server auction reporting info/reporting url=].
: [=reporting result/reporting beacon map=]
:: The value of |response|'s [=server auction response/buyer reporting=]'s [=server auction reporting info/beacon urls=].
: [=reporting result/reporting macro map=]
:: Null

1. Let |sellerReportingResult| be a new [=reporting result=] with the following [=struct/items=]:
: [=reporting result/report url=]
:: The value of |response|'s [=server auction response/top level seller reporting=]'s [=server auction reporting info/reporting url=].
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
: [=reporting result/reporting beacon map=]
:: The value of |response|'s [=server auction response/top level seller reporting=]'s [=server auction reporting info/beacon urls=].
: [=reporting result/reporting macro map=]
:: Null

1. Let |componentSellerReportingResult| be a new [=reporting result=] with the following [=struct/items=]:
: [=reporting result/report url=]
:: The value of |response|'s [=server auction response/component seller reporting=]'s [=server auction reporting info/reporting url=].
:: |response.winReportingURLs.componentSellerReportingUrls.reportingUrl|
qingxinwu marked this conversation as resolved.
Show resolved Hide resolved
: [=reporting result/reporting beacon map=]
:: The value of |response|'s [=server auction response/component seller reporting=]'s [=server auction reporting info/beacon urls=].
: [=reporting result/reporting macro map=]
:: Null
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved

1. Let |winningBidInfo| be a new [=leading bid info=] with the following [=struct/items=]:
: [=leading bid info/top score=]
:: |response|'s [=server auction response/score=].
: [=leading bid info/top non-k-anon-enforced score=]
:: TODO
: [=leading bid info/top bids count=]
:: TODO
: [=leading bid info/top non-k-anon-enforced bids count=]
:: TODO
: [=leading bid info/at most one top bid owner=]
:: TODO
: [=leading bid info/leading bid=]
:: |winningBid|
: [=leading bid info/leading non-k-anon-enforced bid=]
:: TODO
: [=leading bid info/auction config=]
:: |auctionConfig|
: [=leading bid info/second highest score=]
:: TODO
: [=leading bid info/highest scoring other bids count=]
:: TODO
: [=leading bid info/highest scoring other bid=]
:: TODO
: [=leading bid info/highest scoring other bid owner=]
:: TODO
: [=leading bid info/top level seller=]
:: TODO
: [=leading bid info/top level seller signals=]
:: TODO
: [=leading bid info/component seller=]
:: TODO
: [=leading bid info/scoring data version=]
:: TODO
: [=leading bid info/buyer reporting result=]
:: |buyerReportingResult|
: [=leading bid info/seller reporting result=]
:: |sellerReportingResult|
: [=leading bid info/component seller reporting result=]
:: |componentSellerReportingResult|
1. [=list/For each=] |igPair| in |response|'s [=server auction response/bidding groups=] field:
1. Find the interest group |ig| in the [=user agent=]'s [=interest group set=]
whose owner and name match those in |igPair|. If there are no matches continue.
brusshamilton marked this conversation as resolved.
Show resolved Hide resolved
1. [=list/Append=] |ig| to |bidIgs|.
1. Insert the debug reporting URLs from |response| into |bidDebugReportInfoList|.
qingxinwu marked this conversation as resolved.
Show resolved Hide resolved
1. Return |winningBidInfo|.

Issue: TODO: Spec out last few steps starting from constructing bids.
qingxinwu marked this conversation as resolved.
Show resolved Hide resolved
(<a href="https://github.com/WICG/turtledove/issues/1254">WICG/turtledove#1254</a>)
Expand Down Expand Up @@ -2970,6 +3097,56 @@ A <dfn>server auction request context</dfn> is a [=struct=] with the following [
(<a href="https://github.com/WICG/turtledove/issues/1254">WICG/turtledove#1254</a>)
</dl>

A <dfn>server auction response</dfn> is a [=struct=] with the following [=struct/items=]:
<dl dfn-for="server auction response">
: <dfn>is chaff</dfn>
:: A [=boolean=] field indicating whether this response should be ignored.
: <dfn>ad render url</dfn>
:: The [=URL=] of the ad for the winning bid.
: <dfn>ad components</dfn>
:: A [=list=] of [=URLs=] containing the ad components for the winning bid.
: <dfn>interest group name</dfn>
:: The winning interest group's name as a [=string=].
: <dfn>interest group owner</dfn>
:: The winning interest group's owner [=origin=].
: <dfn>bidding groups</dfn>
:: A [=list=] of interest group owner and interest group name pairs that bid
in this auction.
: <dfn>score</dfn>
:: {{double}} or Null. TODO
: <dfn>bid</dfn>
:: {{double}} or Null. TODO.
: <dfn>bid currency</dfn>
:: [=currency tag=] or Null. TODO.
: <dfn>top level seller</dfn>
:: An [=origin=] or Null. Null when the server response is not feeding into an
on-device auction. Otherwise the value is the expected top-level seller for
that auction.
: ad metadata
:: A JSON [=string=]. TODO
: buyer reporting id
:: TODO.
: buyer and seller reporting id
:: TODO.
: error
:: TODO.
: <dfn>buyer reporting</dfn>
:: [=server auction reporting info=]
: <dfn>top level seller reporting</dfn>
:: [=server auction reporting info=] or Null.
: <dfn>component seller reporting</dfn>
:: [=server auction reporting info=] or Null.
</dl>

A <dfn>server auction reporting info</dfn> is a [=struct=] with the following [=struct/items=]:
<dl dfn-for="server auction reporting info">
: <dfn>reporting url</dfn>
:: Null or a [=URL=]
: <dfn>beacon urls</dfn>
:: [=ordered map=] whose [=map/keys=] are [=strings=] and whose [=map/values=]
are [=URLs=] whose [=url/schemes=] are "`https`".
</dl>

<div algorithm="getInterestGroupAdAuctionData()">

The <dfn for=Navigator method>getInterestGroupAdAuctionData(|config|)</dfn> method steps are:
Expand Down
Loading