From 0c30b99a9a15ba18cc50c46255ef8ebd8b189c5a Mon Sep 17 00:00:00 2001 From: Yao Xiao Date: Thu, 27 Jun 2024 16:16:24 -0400 Subject: [PATCH 1/2] Update spec examples to reflect Chrome's current top-topics algorithm and the taxonomy version Update the spec to reflect the updated top-topics selection method, as requested in https://github.com/patcg-individual-drafts/topics/issues/313. Also update taxonomy example to v2 to reflect the current state in Chrome. --- spec.bs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/spec.bs b/spec.bs index bdfe099..3dc88dd 100644 --- a/spec.bs +++ b/spec.bs @@ -160,7 +160,7 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ The [=user agent/taxonomy=] and [=user agent/model=] may be shipped to the browser asynchronously with respect to the browser release, and may be unavailable at a given point. They must be updated atomically with respect to algorithms that access them (e.g. the [=calculate user topics=] algorithm). - Note: The initial taxonomy used in Chrome is taxonomy_v1.md and the expectation is that it will change over time. + Note: In Chrome versions M121 and later, the taxonomy used is taxonomy_v2.md. The expectation is that it will change over time. Each [=user agent=] has an associated topics algorithm configuration (identified by [=browsing topics types/configuration version=] configuration version). The initial value and meaning is browser defined. @@ -238,7 +238,7 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ Given a [=list=] of [=topics history entries=] historyEntriesForUserTopics, the browser should provide an algorithm to derive top 5 topics, that are believed to be valuable for the Topics callers. The algorithm should return a [=list=] of 5 [=topic ids=].
- Chrome's initial release scores topics by the frequency of page loads with that topic. + In Chrome versions M122 and later, topics are scored for ranking first by a binary priority level (see topics-utility-buckets-v1.md), and then by the frequency of page loads with that topic.
@@ -251,11 +251,26 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ 1. If |topicsCount|[|topicId|] does not exist: 1. Initialize |topicsCount|[|topicId|] to 0. 1. Increment |topicsCount|[|topicId|] by 1. - 1. Let |top5Topics| be a list containing the top up to 5 |topicId|s in |topicsCount|'s [=map/keys=], where the |topicId|s with more count are retrieved first. + 1. Let |prioritizedTopicsCount| be the result of [=map/sorting in ascending order=] |topicsCount|, with a less than algorithm [=compare topics based on priority and count=]. + 1. Let |top5Topics| be the first up to 5 keys of |prioritizedTopicsCount|. 1. If |top5Topics| has less than 5 entries: 1. Pad |top5Topics| with random topic ids from user agent's [=user agent/taxonomy=], until |top5Topics| has 5 entries. 1. Return |top5Topics|.
+ +
+ + To compare topics based on priority and count, given (|topic1|, |count1|) and (|topic2|, |count2|), perform the following steps. They return a boolean. + + 1. [=Assert=]: |count1| > 0. + 1. [=Assert=]: |count2| > 0. + 1. Let |highUtilityTopics| be « 57, 86, 126, 149, 172, 180, 196, 207, 239, 254, 263, 272, 289, 299, 332 ». + 1. If |highUtilityTopics| [=list/contains=] |topic1| and |highUtilityTopics| does not [=list/contain=] |topic2|, then return true. + 1. If |highUtilityTopics| does not [=list/contain=] |topic1| and |highUtilityTopics| [=list/contains=] |topic2|, then return false. + 1. Return |count1| > |count2|. + +
+
@@ -576,7 +591,7 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ 1. Append |innerList| to |topicsStructuredFieldsList|. 1. If |numVersionsInEpochs| is 0, then set |numVersionsInEpochs| to 1. 1. Let |maxNumberOfEpochs| be 3 (i.e. topics are selected from the last 3 epochs). - 1. Let |topicMaxLength| be number of base-10 digits in the maximum [=browsing topics types/topic id=] (e.g. for Chrome's initial taxonomy, |topicMaxLength| is 3, as the [=browsing topics types/topic id=] has maximum 3 digits). + 1. Let |topicMaxLength| be number of base-10 digits in the maximum [=browsing topics types/topic id=] (e.g. for Chrome's current taxonomy, |topicMaxLength| is 3, as the [=browsing topics types/topic id=] has maximum 3 digits). 1. Let |versionMaxLength| be the length of the current [=browsing topics types/maximum version string length=]. 1. Let |listItemsSeparatorLength| be 2 (i.e. structured fields use two characters (", ") to separate list items). 1. Let |perVersionedTopicsInnerListOverhead| be 5 (i.e. for "();v=") From 5b166814ef957abdfc03a7875eb59fb669f5fe91 Mon Sep 17 00:00:00 2001 From: Yao Xiao Date: Thu, 27 Jun 2024 16:48:32 -0400 Subject: [PATCH 2/2] fix a link --- spec.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.bs b/spec.bs index 3dc88dd..babb452 100644 --- a/spec.bs +++ b/spec.bs @@ -238,7 +238,7 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ Given a [=list=] of [=topics history entries=] historyEntriesForUserTopics, the browser should provide an algorithm to derive top 5 topics, that are believed to be valuable for the Topics callers. The algorithm should return a [=list=] of 5 [=topic ids=].
- In Chrome versions M122 and later, topics are scored for ranking first by a binary priority level (see topics-utility-buckets-v1.md), and then by the frequency of page loads with that topic. + In Chrome versions M122 and later, topics are scored for ranking first by a binary priority level (see topics-utility-buckets-v1.md), and then by the frequency of page loads with that topic.