From d22499bfcc50f798eababe0325e1a39c96507975 Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Fri, 25 Aug 2023 19:02:40 +0300 Subject: [PATCH 1/9] Fix penalty algorithm Fixes #229 --- index.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 69941a3..5b10b67 100644 --- a/index.html +++ b/index.html @@ -1051,16 +1051,22 @@

Data delivery

and {{PressureRecord/[[Time]]}} set to |timestamp|.
  • - If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists, - set observer.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] to |record| - and [=iteration/continue=]. + Increase |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|].
  • If running [=passes rate obfuscation test=] with |observer| and |source| returns false:
      +
    1. + If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists, + set observer.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] to |record| + and [=iteration/continue=]. +
    2. Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record|.
    3. +
    4. + Reset |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|]. +
    5. Create timer of |observer|.{{PressureObserver/[[PenaltyDuration]]}} duration with the following callback:
        From ced5fb2d99fc1b55ae0f1463584f16ca6f959aab Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Mon, 28 Aug 2023 08:32:10 +0300 Subject: [PATCH 2/9] Fix comment from Rakuco. Fixes #229 --- index.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 5b10b67..39f2946 100644 --- a/index.html +++ b/index.html @@ -1050,22 +1050,20 @@

        Data delivery

        {{PressureRecord/[[State]]}} set to |state| and {{PressureRecord/[[Time]]}} set to |timestamp|. -
      1. - Increase |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|]. -
      2. If running [=passes rate obfuscation test=] with |observer| and |source| returns false:
        1. - If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists, - set observer.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] to |record| - and [=iteration/continue=]. -
        2. + Let |replacingRecord| be true if |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists + or false otherwise.
        3. Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record|.
        4. - Reset |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|]. + If |replacingRecord| is true, [=iteration/continue=]. +
        5. +
        6. + Set |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|] to 0.
        7. Create timer of |observer|.{{PressureObserver/[[PenaltyDuration]]}} duration with the following callback: From 6caac9f9b225266cdffb0c9d099a11e5c74da2a7 Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Mon, 28 Aug 2023 15:11:44 +0300 Subject: [PATCH 3/9] Fix corner-cases when new state changes are coming during penalty. LastRecordMap needs to be updated more often than only in "Queue a PressureRecord", otherwise, next "data delivery" cannot keep track with previous state value. --- index.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 39f2946..3625de1 100644 --- a/index.html +++ b/index.html @@ -1051,16 +1051,24 @@

          Data delivery

          and {{PressureRecord/[[Time]]}} set to |timestamp|.
        8. - If running [=passes rate obfuscation test=] with |observer| and |source| returns false: + If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists
          1. - Let |replacingRecord| be true if |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists - or false otherwise. + Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|. +
          2. +
          3. + Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record| and [=iteration/Continue=]. +
          4. +
          +
        9. +
        10. + If running [=passes rate obfuscation test=] with |observer| and |source| returns false: +
          1. Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record|.
          2. - If |replacingRecord| is true, [=iteration/continue=]. + Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|.
          3. Set |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|] to 0. @@ -1074,6 +1082,9 @@

            Data delivery

          4. Run [=queue a record=] with |observer|, |source|, |record|.
          5. +
          6. + Clear |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. +
        11. From 58e8f0231b3bab082caecfc0a09bb54fb7967742 Mon Sep 17 00:00:00 2001 From: "Arnaud (Arno) Mandy" Date: Mon, 28 Aug 2023 19:53:01 +0300 Subject: [PATCH 4/9] Update index.html Co-authored-by: Raphael Kubo da Costa --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3625de1..34497ff 100644 --- a/index.html +++ b/index.html @@ -1057,7 +1057,7 @@

          Data delivery

          Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|.
        12. - Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record| and [=iteration/Continue=]. + Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record| and [=iteration/continue=].
      3. From bfdb92e67b0c8c243e26a815f62a9150cee1feae Mon Sep 17 00:00:00 2001 From: "Arnaud (Arno) Mandy" Date: Mon, 28 Aug 2023 19:53:10 +0300 Subject: [PATCH 5/9] Update index.html Co-authored-by: Raphael Kubo da Costa --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 34497ff..e7b1039 100644 --- a/index.html +++ b/index.html @@ -1051,7 +1051,7 @@

        Data delivery

        and {{PressureRecord/[[Time]]}} set to |timestamp|.
      4. - If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] exists + If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] [=map/exists]:
        1. Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|. From 9d84e389afb85eaf9692843764f1082efbd9fe26 Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Wed, 30 Aug 2023 10:22:17 +0300 Subject: [PATCH 6/9] Fix wording and unobserve, disconnect steps. Fixes: #229 --- index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index e7b1039..b14271c 100644 --- a/index.html +++ b/index.html @@ -617,6 +617,9 @@

          The unobserve() method

        2. [=map/Remove=] |this|.{{PressureObserver/[[LastRecordMap]]}}[|source|].
        3. +
        4. + [=map/Remove=] |this|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. +
        5. [=list/For each=] (|promiseSource|, |pendingPromise|) of [=this=].{{PressureObserver/[[PendingObservePromises]]}}, if |source| is equal to |promiseSource|, [=reject=] |pendingPromise| with an {{AbortError}}. @@ -646,6 +649,9 @@

          The disconnect() method

        6. [=map/Clear=] |this|.{{PressureObserver/[[LastRecordMap]]}}.
        7. +
        8. + [=map/Clear=] |this|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}. +
        9. [=list/For each=] (|promiseSource|, |pendingPromise|) of [=this=].{{PressureObserver/[[PendingObservePromises]]}}, [=reject=] |pendingPromise| with an {{AbortError}}. @@ -1053,9 +1059,6 @@

          Data delivery

        10. If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] [=map/exists]:
            -
          1. - Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|. -
          2. Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record| and [=iteration/continue=].
          3. @@ -1067,9 +1070,6 @@

            Data delivery

          4. Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record|.
          5. -
          6. - Set |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] to |record|. -
          7. Set |observer|.{{PressureObserver/[[ChangesCountMap]]}}[|source|] to 0.
          8. @@ -1077,13 +1077,13 @@

            Data delivery

            Create timer of |observer|.{{PressureObserver/[[PenaltyDuration]]}} duration with the following callback:
            1. - Let |record| be the result of taking |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. + Let |record| be |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|].
            2. Run [=queue a record=] with |observer|, |source|, |record|.
            3. - Clear |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. + Remove |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|].
            From 3dd5ec89397a069b70477d879c95133bac55ebed Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Wed, 30 Aug 2023 11:42:47 +0300 Subject: [PATCH 7/9] small fix on map remove Fixes: #229 --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index b14271c..3da6474 100644 --- a/index.html +++ b/index.html @@ -1083,7 +1083,7 @@

            Data delivery

            Run [=queue a record=] with |observer|, |source|, |record|.
          9. - Remove |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. + [=map/Remove=] |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|].
        11. From 50175e7ec19503d09777bdba21eb7a8802544355 Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Wed, 30 Aug 2023 12:42:40 +0300 Subject: [PATCH 8/9] fix Put Continue as a separate step. --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3da6474..9432cf5 100644 --- a/index.html +++ b/index.html @@ -1060,7 +1060,10 @@

          Data delivery

          If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] [=map/exists]:
          1. - Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record| and [=iteration/continue=]. + Set |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|] to |record|. +
          2. +
          3. + [=iteration/Continue=].
          From 4f93f02fbc12098043de086f3da976603060e7af Mon Sep 17 00:00:00 2001 From: Arnaud Mandy Date: Thu, 31 Aug 2023 11:48:38 +0300 Subject: [PATCH 9/9] fix rakuco s comment on unobserve/disconnect remove observer.[[AfterPenaltyRecordMap]][source] could be cleared by unobserve/disconnect, it requires a check. --- index.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 9432cf5..75c7981 100644 --- a/index.html +++ b/index.html @@ -1080,13 +1080,18 @@

          Data delivery

          Create timer of |observer|.{{PressureObserver/[[PenaltyDuration]]}} duration with the following callback:
          1. - Let |record| be |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. -
          2. -
          3. - Run [=queue a record=] with |observer|, |source|, |record|. -
          4. -
          5. - [=map/Remove=] |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. + If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] [=map/exists]: +
              +
            1. + Let |record| be |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. +
            2. +
            3. + [=map/Remove=] |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[|source|]. +
            4. +
            5. + Run [=queue a record=] with |observer|, |source|, |record|. +
            6. +