@@ -1243,8 +1243,22 @@ partial interface PrivateAggregation {
1243
1243
undefined contributeToHistogramOnEvent(
1244
1244
DOMString event, PAExtendedHistogramContribution contribution);
1245
1245
};
1246
+
1247
+ dictionary AuctionReportBuyersConfig {
1248
+ required bigint bucket;
1249
+ required double scale;
1250
+ };
1251
+
1252
+ partial dictionary AuctionAdConfig {
1253
+ sequence<bigint> auctionReportBuyerKeys;
1254
+ record<DOMString, AuctionReportBuyersConfig> auctionReportBuyers;
1255
+ };
1246
1256
</xmp>
1247
1257
1258
+ Note: `requiredSellerCapabilities` is defined in the <a
1259
+ href="https://wicg.github.io/turtledove/#dictdef-auctionadconfig"> Protected
1260
+ Audience spec</a> .
1261
+
1248
1262
Issue: Do we want to align naming with implementation?
1249
1263
1250
1264
The {{InterestGroupScriptRunnerGlobalScope/privateAggregation}} [=getter steps=]
@@ -1329,6 +1343,10 @@ partial dictionary AuctionAdInterestGroup {
1329
1343
};
1330
1344
</xmp>
1331
1345
1346
+ Note: `sellerCapabilities` is defined in the <a
1347
+ href="https://wicg.github.io/turtledove#dictdef-generatebidinterestgroup"> Protected
1348
+ Audience spec</a>
1349
+
1332
1350
Structures {#protected-audience-api-specific-structures}
1333
1351
--------------------------------------------------------
1334
1352
@@ -1344,14 +1362,21 @@ Extend the <a spec="turtledove">auction config</a> [=struct=] to add new fields:
1344
1362
: <dfn>batching scope map</dfn>
1345
1363
:: A [=map=] from a [=tuple=] consisting of an <dfn ignore>origin</dfn> (an
1346
1364
[=origin=] ) and a <dfn ignore>coordinator</dfn> (an [=aggregation
1347
- coordinator=] or null ) to a [=batching scope=] .
1365
+ coordinator=] ) to a [=batching scope=] .
1348
1366
1349
1367
Note: Does not include [=batching scopes=] for contributions conditional on
1350
1368
non-reserved events.
1351
1369
: <dfn>permissions policy state</dfn>
1352
1370
:: A [=permissions policy state=] .
1353
- : <dfn>seller Private Aggregation coordinator</dfn> (default null)
1354
- :: An [=aggregation coordinator=] or null.
1371
+ : <dfn>seller Private Aggregation coordinator</dfn>
1372
+ :: An [=aggregation coordinator=] . Defaults to the [=default aggregation
1373
+ coordinator=] .
1374
+ : <dfn>auction report buyer keys</dfn>
1375
+ :: A [=map=] from buyer [=origins=] to {{bigint}} s.
1376
+ : <dfn>auction report buyers</dfn>
1377
+ :: A [=map=] from [=strings=] to {{AuctionReportBuyersConfig}} s.
1378
+
1379
+ Issue: Consider replacing the strings above with specific enum types.
1355
1380
1356
1381
</dl>
1357
1382
@@ -1502,7 +1527,57 @@ The <a spec="turtledove">validate and convert auction ad config</a> steps are
1502
1527
modified to add the following steps just before the last step ("Return
1503
1528
<var ignore> auctionConfig</var> "), renumbering the later step as appropriate:
1504
1529
<div algorithm="protected-audience-validate-config-monkey-patch">
1505
- 7. If |config|[{{AuctionAdConfig/privateAggregationConfig}}] [=map/exists=] :
1530
+ 31. If |config|["<code>{{AuctionAdConfig/auctionReportBuyerKeys}}</code>"]
1531
+ [=map/exists=] :
1532
+ 1. Let |interestGroupBuyers| be |auctionConfig|'s <a spec="turtledove"
1533
+ for="auction config">interest group buyers</a> .
1534
+ 1. If |interestGroupBuyers| is null, set |interestGroupBuyers| to a new
1535
+ [=list=] .
1536
+ 1. [=list/For each=] |index| of [=the exclusive range|the range=] 0 to
1537
+ |config|["<code>{{AuctionAdConfig/auctionReportBuyerKeys}}</code>"] 's
1538
+ [=list/size=] , exclusive:
1539
+ 1. Let |key| be
1540
+ |config|["<code>{{AuctionAdConfig/auctionReportBuyerKeys}}</code>"][|index|] .
1541
+ 1. If |key| is not in the range [0, 2<sup>128</sup>−1] ,
1542
+ [=exception/throw=] a {{TypeError}} .
1543
+ 1. If |index| is equal to or greater than |interestGroupBuyers|' [=list/
1544
+ size=] , [=iteration/continue=] .
1545
+
1546
+ Note: [=iteration/Continue=] is used (instead of [=iteration/
1547
+ break=] ) to match validation logic for all given buyer keys.
1548
+ 1. Let |origin| be |interestGroupBuyers|[|index|] .
1549
+ 1. [=map/Set=] |auctionConfig|'s [=auction config/auction report buyer
1550
+ keys=] [|origin|] to |key|.
1551
+
1552
+ Issue: Check behavior when an origin is repeated in
1553
+ {{AuctionAdConfig/interestGroupBuyers}} .
1554
+ 1. If |config|["<code>{{AuctionAdConfig/auctionReportBuyers}}</code>"] [=map/
1555
+ exists=] :
1556
+ 1. [=map/For each=] |reportType| → |reportBuyerConfig| of
1557
+ |config|["<code>{{AuctionAdConfig/auctionReportBuyers}}</code>"] :
1558
+ 1. If « "`interestGroupCount`", "`bidCount`",
1559
+ "`totalGenerateBidLatency`", "`totalSignalsFetchLatency`" » does not
1560
+ [=list/contain=] |reportType|, [=iteration/continue=] .
1561
+
1562
+ Note: No error is thrown to allow forward compatibility if
1563
+ additional report types are added later.
1564
+
1565
+ Issue: Should these strings be dash delimited?
1566
+
1567
+ 1. If |reportBuyerConfig|["<code> {{AuctionReportBuyersConfig
1568
+ /bucket}} </code> "] is not in the range [0, 2<sup>128</sup>−1] ,
1569
+ [=exception/throw=] a {{TypeError}} .
1570
+
1571
+ Issue: Consider validating the case where the bucket used (after
1572
+ summing) is too large. Currently, the implementation appears to
1573
+ overflow. See <a
1574
+ href="https://github.com/WICG/turtledove/issues/1040">
1575
+ protected-audience/1040</a> .
1576
+ 1. [=map/Set=] |auctionConfig|'s [=auction config/auction report
1577
+ buyers=] [|reportType|] to |reportBuyerConfig|.
1578
+
1579
+ Issue: Handle `auctionReportBuyerDebugModeConfig` here.
1580
+ 1. If |config|[{{AuctionAdConfig/privateAggregationConfig}}] [=map/exists=] :
1506
1581
1. Let |aggregationCoordinator| be the result of [=obtaining the Private
1507
1582
Aggregation coordinator=] given
1508
1583
|config|[{{AuctionAdConfig/privateAggregationConfig}}] .
@@ -1525,9 +1600,6 @@ nested scope), renumbering this and later steps as necessary.
1525
1600
1526
1601
</div>
1527
1602
1528
- Issue: Need to handle `auctionReportBuyers` and `auctionReportBuyerKeys` here or
1529
- in the Protected Audience API spec.
1530
-
1531
1603
The <a spec="turtledove">evaluate a script</a> steps are modified in two ways.
1532
1604
First, we add the following steps after step 11 ("If
1533
1605
<var ignore> evaluationStatus</var> is an [=ECMAScript/abrupt completion=] ..."),
@@ -1553,15 +1625,10 @@ renumbering later steps as appropriate:
1553
1625
[=interest group/Private Aggregation coordinator=] .
1554
1626
1. Otherwise, set |aggregationCoordinator| to |auctionConfig|'s
1555
1627
[=auction config/seller Private Aggregation coordinator=] .
1556
- 1. Let |batchingScopeMap| be |auctionConfig|'s [=auction config/batching
1557
- scope map=] .
1558
- 1. Let |mapTuple| = (|origin|, |aggregationCoordinator|).
1559
- 1. If |batchingScopeMap|[|mapTuple|] does not [=map/exist=] :
1560
- 1. Set |batchingScopeMap|[|mapTuple|] to a new [=batching scope=] .
1561
- 1. If |aggregationCoordinator| is not null, [=set the aggregation
1562
- coordinator for a batching scope=] given
1563
- |aggregationCoordinator| and |batchingScopeMap|[|mapTuple|] .
1564
- 1. Return |batchingScopeMap|[|mapTuple|] .
1628
+ 1. If |aggregationCoordinator| is null, set |aggregationCoordinator| to
1629
+ the [=default aggregation coordinator=] .
1630
+ 1. Return the result of running [=get or create a batching scope=] given
1631
+ |origin|, |aggregationCoordinator| and |auctionConfig|.
1565
1632
: [=scoping details/get debug scope steps=]
1566
1633
:: An algorithm that returns |debugScope|.
1567
1634
@@ -1762,7 +1829,90 @@ an <a spec="turtledove">auction config</a> |auctionConfig| and a
1762
1829
details=]
1763
1830
1. [=Append an entry to the contribution cache|Append=] |entry| to
1764
1831
the [=contribution cache=] .
1832
+ 1. Let |sellerBatchingScope| be the result of [=get or create a batching
1833
+ scope|getting or creating a batching scope=] given |auctionConfig|'s <a
1834
+ spec="turtledove" for="auction config"> seller</a> , |auctionConfig|'s
1835
+ [=auction config/seller Private Aggregation coordinator=] , and
1836
+ |auctionConfig|.
1837
+ 1. Let |auctionReportBuyersDebugScope| be a new [=debug scope=] .
1838
+ 1. [=map/For each=] |reportType| → |reportBuyerConfig| of |auctionConfig|'s
1839
+ [=auction config/auction report buyers=] :
1840
+ 1. [=map/For each=] |buyerOrigin| → |buyerOffset| of |auctionConfig|'s
1841
+ [=auction config/auction report buyer keys=] :
1842
+ 1. Let |bucket| be the sum of |buyerOffset| and |reportBuyerConfig|'s
1843
+ {{AuctionReportBuyersConfig/bucket}} .
1844
+
1845
+ Issue: Handle overflow here or in validation. See <a
1846
+ href="https://github.com/WICG/turtledove/issues/1040">
1847
+ protected-audience/1040</a> .
1848
+ 1. Let |value| be the result (a {{double}} ) of switching on
1849
+ |reportType|:
1850
+ <dl class="switch">
1851
+ : "`interestGroupCount`"
1852
+ :: The number of interest groups in the [=user agent=] 's <a
1853
+ spec="turtledove"> interest group set</a> whose <a
1854
+ spec="turtledove" for="interest group"> owner</a> is
1855
+ |buyerOrigin|.
1856
+ : "`bidCount`"
1857
+ :: The number of valid bids generated by interest groups whose <a
1858
+ spec="turtledove" for="interest group"> owner</a> is
1859
+ |buyerOrigin|.
1860
+ : "`totalGenerateBidLatency`"
1861
+ :: The sum of execution time in milliseconds for all `generateBid()`
1862
+ calls in the auction for interest groups whose <a
1863
+ spec="turtledove" for="interest group"> owner</a> is
1864
+ |buyerOrigin|.
1865
+ : "`totalSignalsFetchLatency`"
1866
+ :: The total time spent fetching trusted buyer signals in
1867
+ milliseconds, or 0 if the interest group didn't fetch any
1868
+ trusted signals.
1869
+ : None of the above values
1870
+ :: [=Assert=] : false
1871
+
1872
+ Note: This enum value is validated in <a
1873
+ spec="turtledove"> validate and convert auction ad
1874
+ config</a> .
1875
+
1876
+ </dl>
1877
+
1878
+ Issue: More formally spec the values here.
1879
+ 1. Set |value| to the result of multiplying |reportBuyerConfig|'s
1880
+ {{AuctionReportBuyersConfig/scale}} with |value|.
1881
+ 1. Set |value| to the maximum of 0.0 and |value|.
1882
+ 1. Set |value| to the result of converting |value| to an integer by
1883
+ truncating its fractional part.
1884
+ 1. Set |value| to the minimum of |value| and 2<sup> 31</sup> −1.
1885
+ 1. Let |contribution| be a new {{PAHistogramContribution}} with the
1886
+ items:
1887
+ : {{PAHistogramContribution/bucket}}
1888
+ :: |bucket|
1889
+ : {{PAHistogramContribution/value}}
1890
+ :: |value|
1891
+
1892
+ 1. [=map/For each=] |ig| of the [=user agent=] 's <a spec="turtledove">
1893
+ interest group set</a> whose
1894
+ <a spec="turtledove" for="interest group">owner</a> is
1895
+ |buyerOrigin|:
1896
+ 1. If seller capabilities don't allow this reporting, [=iteration/
1897
+ continue=] .
1898
+
1899
+ Issue: Align behavior with seller capabilities handling once <a
1900
+ href="https://github.com/WICG/turtledove/issues/966">
1901
+ protected-audience/966</a> is resolved.
1902
+ 1. Let |entry| be a new [=contribution cache entry=] with the items:
1903
+ : [=contribution cache entry/contribution=]
1904
+ :: |contribution|
1905
+ : [=contribution cache entry/batching scope=]
1906
+ :: |sellerBatchingScope|
1907
+ : [=contribution cache entry/debug scope=]
1908
+ :: |auctionReportBuyersDebugScope|
1909
+ 1. [=Append an entry to the contribution cache|Append=] |entry| to
1910
+ the [=contribution cache=] .
1765
1911
1912
+ Issue: Handle `auctionReportBuyerDebugModeConfig` here, may need to pass an
1913
+ override to [=mark a debug scope complete=] and possibly refactor to merge
1914
+ handling with {{PrivateAggregation/enableDebugMode()}} .
1915
+ 1. [=Mark a debug scope complete=] given |auctionReportBuyersDebugScope|.
1766
1916
1. [=map/For each=] (|origin|, |aggregationCoordinator|) → |batchingScope| of
1767
1917
|auctionConfig|'s [=auction config/batching scope map=] :
1768
1918
1. [=Process contributions for a batching scope=] given |batchingScope|,
@@ -1772,6 +1922,20 @@ Issue: Verify interaction with component auctions.
1772
1922
1773
1923
Issue: Use `[=map/For each=] ` where possible.
1774
1924
1925
+ To <dfn>get or create a batching scope</dfn> given an [=origin=] |origin|, an
1926
+ [=aggregation coordinator=] |aggregationCoordinator| and an <a
1927
+ spec="turtledove"> auction config</a> |auctionConfig|, perform the following
1928
+ steps. They return a [=batching scope=] .
1929
+ 1. Let |batchingScopeMap| be |auctionConfig|'s [=auction config/batching scope
1930
+ map=] .
1931
+ 1. Let |tuple| be (|origin|, |aggregationCoordinator|).
1932
+ 1. If |batchingScopeMap|[|tuple|] does not [=map/exist=] :
1933
+ 1. Set |batchingScopeMap|[|tuple|] to a new [=batching scope=] .
1934
+ 1. If |aggregationCoordinator| is not null, [=set the aggregation
1935
+ coordinator for a batching scope=] given |aggregationCoordinator| and
1936
+ |batchingScopeMap|[|tuple|] .
1937
+ 1. Return |batchingScopeMap|[|tuple|] .
1938
+
1775
1939
To <dfn>fill in the contribution</dfn> given a
1776
1940
{{PAExtendedHistogramContribution}} |contribution| and a
1777
1941
<a spec="turtledove">leading bid info</a> |leadingBidInfo|, perform the
0 commit comments