Skip to content

Commit

Permalink
[spec] Add basic B&A response handling (WICG#1260)
Browse files Browse the repository at this point in the history
* Add basic response handling

* Apply suggestions from code review

Co-authored-by: qingxinwu <[email protected]>

* Apply suggestions from code review

Co-authored-by: qingxinwu <[email protected]>

* address comments

* Apply suggestions from code review

Co-authored-by: qingxinwu <[email protected]>

* Address comments

---------

Co-authored-by: qingxinwu <[email protected]>
  • Loading branch information
brusshamilton and qingxinwu authored Sep 10, 2024
1 parent dff7cef commit fde4556
Showing 1 changed file with 176 additions and 6 deletions.
182 changes: 176 additions & 6 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,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 @@ -2780,17 +2780,137 @@ 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. Let |requestContext| be |requestContexts|[|requestId|].
1. Let |response| be the [=server auction response=] which is the result of
deserializing |auctionConfig|'s [=auction config/server response=]
with |requestContext| according to the Bidding and Auction Services IETF standard.

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| is failure, then return failure.
1. If |response|'s [=server auction response/is chaff=] is true, return failure.
1. If |response|'s [=server auction response/top level seller=] is not null, return failure.

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=]
whose [=interest group/owner=] is |response|'s [=server auction response/interest group owner=] and
[=interest group/name=] is |response|'s [=server auction response/interest group name=]. Return failure if none found.
1. If |winningGroup|'s [=interest group/ads=] is null, then return failure.
1. Let |winningAd| be null.
1. [=list/For each=] |ad| of |winningGroup|'s [=interest group/ads=]:
1. If |response|'s [=server auction response/ad render url=] is |ad|'s [=interest group ad/render url=], then set
|winningAd| to |ad|, and [=iteration/break=].
1. If |winningAd| is null, then return failure.
1. Let |winningAdComponents| be a new [=list=] of [=interest group ads=].
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| to |winningAdComponents|.
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
: [=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/number of mandatory ad components=]
:: [=list/Size=] of |winningAdComponents|
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=].

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=].
: [=reporting result/reporting beacon map=]
:: The value of |response|'s [=server auction response/top level seller reporting=]'s [=server auction reporting info/beacon urls=].

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=].
: [=reporting result/reporting beacon map=]
:: The value of |response|'s [=server auction response/component seller reporting=]'s [=server auction reporting info/beacon urls=].

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. Let |ig| be the [=interest group=] in the [=user agent=]'s [=interest group set=] whose
[=interest group/owner=] is |igPair|'s [=interest group/owner=] and [=interest group/name=] is |igPair|'s
[=interest group/name=]. [=iteration/Continue=] if none found.
1. [=list/Append=] |ig| to |bidIgs|.
1. Insert the debug reporting URLs from |response| into |bidDebugReportInfoList|.

Issue: TODO: Spec out last few steps starting from constructing bids.
Issue: TODO: Handle forDebuggingOnly reports from server auction.
(<a href="https://github.com/WICG/turtledove/issues/1254">WICG/turtledove#1254</a>)
1. Return |winningBidInfo|.

</div>

Expand Down Expand Up @@ -2929,6 +3049,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

0 comments on commit fde4556

Please sign in to comment.