Skip to content

Commit

Permalink
Specify parsing of trigger_specs' trigger_data and event_report_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
apasel422 committed Oct 20, 2023
1 parent 71c9752 commit 4abf1c2
Showing 1 changed file with 75 additions and 9 deletions.
84 changes: 75 additions & 9 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,19 @@ A <dfn>trigger-data matching mode</dfn> is one of the following:

</dl>

<h3 id="trigger-specs-header">Trigger specs</h3>

A <dfn>trigger spec</dfn> is a [=struct=] with the following items:

<dl dfn-for="trigger spec">
: <dfn>event-level report windows</dfn>
:: A [=report window list=].

</dl>

A <dfn>trigger spec map</dfn> is a [=map=] whose keys are unsigned 32-bit
integers and values are [=trigger specs=].

<h3 dfn-type=dfn>Attribution source</h3>

An attribution source is a [=struct=] with the following items:
Expand Down Expand Up @@ -1148,6 +1161,10 @@ the maximum [=string/length=] of an [=attribution source=]'s [=attribution sourc
and an [=aggregatable trigger data=]'s [=aggregatable trigger data/source keys=]'s [=set/items=].
Its value is 25.

<dfn>Max distinct trigger data per source</dfn> is a positive integer that
controls the maximum [=map/size=] of a [=trigger spec map=] for an
[=attribution source=]. Its value is 32.

# Vendor-Specific Values # {#vendor-specific-values}

<dfn>Max aggregation keys per source registration</dfn> is a positive integer that
Expand All @@ -1160,7 +1177,9 @@ controls how many [=attribution sources=] can be in the

<dfn>Default trigger data cardinality</dfn> is a [=map=] that
controls the valid range of [=event-level trigger configuration/trigger data=].
The keys are «[=source type/navigation=], [=source type/event=]». The values are positive integers.
The keys are «[=source type/navigation=], [=source type/event=]». The values are
positive integers less than or equal to
[=max distinct trigger data per source=].

<dfn>Randomized response epsilon</dfn> is a non-negative double that controls
the randomized response probability of an [=attribution source=]. If [=automation local testing mode=] is true,
Expand Down Expand Up @@ -1790,7 +1809,7 @@ a [=moment=] |sourceTime|, and a [=duration=] |eventReportWindow|:
1. Set |lastEnd| to |lastEnd| + |deadline|.
1. Return |windows|.

To <dfn>parse report windows</dfn> given a [=map=] |map|, a [=moment=] |sourceTime|,
To <dfn>parse top-level report windows</dfn> given a [=map=] |map|, a [=moment=] |sourceTime|,
a [=source type=] |sourceType|, and a [=duration=] |expiry|:

1. If |map|["`event_report_window`"] [=map/exists=] and
Expand All @@ -1803,16 +1822,21 @@ a [=source type=] |sourceType|, and a [=duration=] |expiry|:
1. If |map|["`event_report_windows`"] does not [=map/exist=], return the result
of [=obtaining default effective windows=] given |sourceType|, |sourceTime|,
and |expiry|.
1. Let |values| be |map|["`event_report_windows`"].
1. If |values| is not a [=map=], return an error.
1. Return the result of [=parsing report windows=] with
|map|["`event_report_windows`"], |sourceTime|, and |expiry|.

To <dfn>parse report windows</dfn> given a |value|, a
[=moment=] |sourceTime|, and a [=duration=] |expiry|:

1. If |value| is not a [=map=], return an error.
1. Let |startDuration| be 0 seconds.
1. If |values|["`start_time`"] [=map/exists=]:
1. Let |start| be |values|["`start_time`"].
1. If |value|["`start_time`"] [=map/exists=]:
1. Let |start| be |value|["`start_time`"].
1. If |start| is not a non-negative integer, return an error.
1. Set |startDuration| to |start| seconds.
1. If |startDuration| is greater than |expiry|, return an error.
1. If |values|["`end_times`"] does not [=map/exist=] or is not a [=list=], return an error.
1. Let |endDurations| be |values|["`end_times`"].
1. If |value|["`end_times`"] does not [=map/exist=] or is not a [=list=], return an error.
1. Let |endDurations| be |value|["`end_times`"].
1. If the [=list/size=] of |endDurations| is greater than [=max settable event-level report windows=], return an error.
1. If |endDurations| [=list/is empty=], return an error.
1. Let |windows| be an [=list/is empty|empty=] [=list=].
Expand All @@ -1833,6 +1857,48 @@ a [=source type=] |sourceType|, and a [=duration=] |expiry|:
1. Set |startDuration| to |endDuration|.
1. Return |windows|.

To <dfn>parse trigger specs</dfn> given a [=map=] |map|, a [=moment=]
|sourceTime|, a [=duration=] |expiry|, a [=report window list=]
|defaultReportWindows|, and an unsigned 32-bit integer |defaultTriggerDataCardinality|:

1. [=Assert=]: |defaultTriggerDataCardinality| is greater than 0 and less than
or equal to [=max distinct trigger data per source=].
1. Let |specs| be a new [=map=].
1. If |map|["`trigger_specs`"] does not [=map/exist=]:
1. Let |spec| be a new [=trigger spec=] with the following items:
: [=trigger spec/event-level report windows=]
:: |defaultReportWindows|
1. For each integer |triggerData| between 0 (inclusive) and
|defaultTriggerDataCardinality| (exclusive):
1. [=map/Set=] |specs|[|triggerData|] to |spec|.
1. Return |specs|.
1. If |map|["`trigger_specs`"] is not a [=list=] or its
[=list/size=] is greater than [=max distinct trigger data per source=],
return an error.
1. [=list/iterate|For each=] |item| of |map|["`trigger_specs`"]:
1. If |item| is not a [=map=], return an error.
1. Let |spec| be a new [=trigger spec=] with the following items:
: [=trigger spec/event-level report windows=]
:: |defaultReportWindows|
1. If |item|["`event_report_windows`"] [=map/exists=]:
1. Let |reportWindows| be the result of
[=parsing report windows=] with |item|["`event_report_windows`"],
|sourceTime|, and |expiry|.
1. If |reportWindows| is an error, return it.
1. Set |spec|'s [=trigger spec/event-level report windows=] to
|reportWindows|.
1. If |item|["`trigger_data`"] does not [=map/exist=], is not a [=list=], or
[=list/is empty=], or its [=list/size=] is greater than
[=max distinct trigger data per source=], return an error.
1. [=list/iterate|For each=] |triggerData| of |map|["`trigger_data`"]:
1. If |triggerData| is not an integer or cannot be represented by an
unsigned 32-bit integer, or |specs|[|triggerData|] [=map/exists=],
return an error.
1. [=map/Set=] |specs|[|triggerData|] to |spec|.
1. If |specs|'s [=map/size=] is greater than
[=max distinct trigger data per source=], return an error.
1. Return |specs|.

To <dfn noexport>parse source-registration JSON</dfn> given a [=byte sequence=]
|json|, a [=suitable origin=] |sourceOrigin|, a [=suitable origin=] |reportingOrigin|, a
[=source type=] |sourceType|, and a [=moment=] |sourceTime|:
Expand Down Expand Up @@ -1881,7 +1947,7 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=byte sequence=]
1. Let |debugReportingEnabled| be false.
1. If |value|["`debug_reporting`"] [=map/exists=] and is a [=boolean=], set
|debugReportingEnabled| to |value|["`debug_reporting`"].
1. Let |eventReportWindows| be the result of [=parsing report windows=] with |value|, |sourceTime|, |sourceType|, and |expiry|.
1. Let |eventReportWindows| be the result of [=parsing top-level report windows=] with |value|, |sourceTime|, |sourceType|, and |expiry|.
1. If |eventReportWindows| is an error, return null.
1. Let |aggregatableReportWindow| be a new [=report window=] with the following items:

Expand Down

0 comments on commit 4abf1c2

Please sign in to comment.