Skip to content

Commit

Permalink
Add more specific constraints to the signal scoring logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Mar 25, 2024
1 parent 1de4276 commit 2dd123d
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1354,39 +1354,42 @@ def score_signal(msm: dict) -> dict:
# https://github.com/ooni/probe/issues/2344
tv = g_or(msm, "test_version", "0.0.0")

if parse_version(tv) <= parse_version("0.2.4"):
# Caveat: this breaks reprocessing but it's also fine because
# we do not want to reprocess measurements
msmt_start_time = msm.get("measurement_start_time")
if msmt_start_time is None:
scores["accuracy"] = 0.0
return scores
start_time = datetime.strptime(msmt_start_time, "%Y-%m-%d %H:%M:%S")

if (
parse_version(tv) <= parse_version("0.2.4")
and parse_version(tv) > parse_version("0.2.3")
and start_time >= datetime(2023, 11, 7)
):
# See https://github.com/ooni/probe/issues/2636
# See https://github.com/ooni/probe-cli/pull/1421
scores["accuracy"] = 0.0
return scores

if parse_version(tv) <= parse_version("0.2.3"):
# Caveat: this breaks reprocessing but it's also fine because
# we do not want to reprocess measurements
if parse_version(tv) <= parse_version("0.2.3") and start_time >= datetime(
2023, 11, 7
):
# https://github.com/ooni/probe/issues/2627
scores["accuracy"] = 0.0
return scores

if parse_version(tv) < parse_version("0.2.2"):
start_time = msm.get("measurement_start_time")
if start_time is None:
scores["accuracy"] = 0.0
else:
start_time = datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S")
if start_time >= datetime(2022, 10, 19):
scores["accuracy"] = 0.0
if parse_version(tv) < parse_version("0.2.2") and start_time >= datetime(
2022, 10, 19
):
scores["accuracy"] = 0.0

# https://github.com/ooni/backend/issues/679
# engine_version < 3.17.2 and measurement_start_time > 2023-05-02
annot = g_or(msm, "annotations", {})
ev = g_or(annot, "engine_version", "0.0.0")
if parse_version(ev) < parse_version("3.17.2"):
st = g_or(msm, "measurement_start_time", "2023-05-05 00:00:00")
start_time = datetime.strptime(st, "%Y-%m-%d %H:%M:%S")
if start_time >= datetime(2023, 5, 2):
scores["accuracy"] = 0.0
if parse_version(ev) < parse_version("3.17.2") and start_time >= datetime(
2023, 5, 2
):
scores["accuracy"] = 0.0

except Exception:
scores["accuracy"] = 0.0
Expand Down

0 comments on commit 2dd123d

Please sign in to comment.