From 899811709d422418352bddfed9b0ae7c4f37a823 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Thu, 22 May 2025 09:06:47 -0400 Subject: [PATCH] Wrap algorithms in
to generate variable references With this change, it is possible to click on a variable and see all its uses highlighted within the algorithm scope. https://speced.github.io/bikeshed/#var-and-algorithms --- api.bs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/api.bs b/api.bs index d863805..aedae62 100644 --- a/api.bs +++ b/api.bs @@ -886,8 +886,9 @@ defined in [[CLEAR-SITE-DATA#header]]. When the [[CLEAR-SITE-DATA#clear-response|clear site data for response]] algorithm is invoked, if the list of types [=set/contains=] \``"impressions"`\`, the [=clear impressions for a conversion site=] is invoked, -passing the |origin|. +passing the origin. +
To clear impressions for a conversion site, given an [=origin=] |origin|, run these steps: @@ -918,6 +919,7 @@ run these steps:

This process does not remove impressions that are saved with an empty [=set=] of [=impression/Conversion Sites=]. +

### Site Names ### {#site-name-algorithm} @@ -939,6 +941,7 @@ It is also possible for an implementation to internally represent sites using just the [=host=] part of the tuple.

+
To parse a site, returning either [=site=] or failure, given a [=string=] |input|, @@ -962,6 +965,7 @@ that contain more [=domain labels=] than the [=registrable domain=]. For example, "`extra.example.com`" is parsed as "`example.com`".

+
## State For Privacy Budget Management ## {#privacy-state} @@ -1017,6 +1021,7 @@ A privacy budget key is a [=tuple=] consisting of the following items +
To deduct privacy budget given a [=privacy budget key=] |key|, [[WEBIDL#idl-double|double]] |epsilon|, @@ -1051,6 +1056,7 @@ and integer |globalSensitivity|: to |currentValue| − |deduction| and return true. +
### Epoch Start Store ### {#s-epoch-start} @@ -1105,6 +1111,7 @@ rather than the more abstract [=epoch=]. for the corresponding [=epoch=] using the [=get the current epoch=] algoritm. +
To get the current epoch given a [=site=] |site|, and [=moment=] |t|, @@ -1124,6 +1131,7 @@ returning an [=epoch index=]: 1. Return |elapsed| as an integer, rounded towards negative Infinity. +
### Last Browsing History Clear Time ### {#last-clear} @@ -1165,8 +1173,9 @@ Resetting the budget is necessary to ensure that no information about the gap in browsing history is exposed. +
To get the starting epoch for attribution -given [=site=] site, +given [=site=] |site|, returning an [=epoch index=]: 1. Let |startEpoch| be a [=user agent=]-defined value @@ -1204,9 +1213,11 @@ returning an [=epoch index=]: 1. Return |startEpoch|. +
## Save Impression Algorithm ## {#save-impression-api-operation} +
The saveImpression(|options|) method steps are: @@ -1251,9 +1262,11 @@ does not return a status indicating whether the impression was recorded. This minimizes the ability to detect when the Private Attribution API is [[#opt-out|disabled]]. +
## Measure Conversion Algorithm ## {#measure-conversion-api-operation} +
The measureConversion(|options|) method steps are: @@ -1301,6 +1314,7 @@ The measureConversion(|options|) method 1. Return |encryptedReport|. +
### Attribution Logic ### {#s-logic} @@ -1313,7 +1327,7 @@ that specifies the [=attribution logic=]. Each attribution logic specifies a process for allocating values to histogram buckets, after the [=common matching logic=] is applied and privacy budgeting occurs. - +
To do attribution and fill a histogram, given |options|, [=site=] |topLevelSite|, and [=moment=] |now|: @@ -1355,13 +1369,18 @@ To do attribution and fill a histogram, given +
+ +
To create an all-zero histogram, given an integer |size|: 1. Return a [=list=] of [=list/size=] |size|, whose [=list/items=] are all 0. +
### Common Impression Matching Logic ### {#logic-matching} +
To perform common matching logic, given |options|, [=site=] |topLevelSite|, [=epoch index=] |epoch|, and [=moment=] |now|: @@ -1397,9 +1416,11 @@ To perform common matching logic, given 1. Return |matching|. +
#### Last-Touch Attribution #### {#last-touch-attribution} +
To fill a histogram with last-touch attribution, given a [=set=] of [=impressions=] |matchedImpressions|, an integer |histogramSize|, and an integer |value|: @@ -1417,6 +1438,7 @@ To fill a histogram with last-touch attribution, given a [=set=] of 1. Return |histogram|. +
## User Control and Visibility ## {#user-control}