Skip to content

Commit

Permalink
fix(core.py): relax riseupvpn scoring logic
Browse files Browse the repository at this point in the history
This diff relaxes the riseupvpn scoring logic because we have
determined in ooni/probe-cli#1125 (comment)
that we want this experiment to just collect data useful to riseup.

Note that I needed to change test_aggregation.py as a result of these
changes because the number of ok and anomaly results changed.

Closes #745.
  • Loading branch information
bassosimone committed Oct 17, 2023
1 parent 6ecccef commit c761c29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 35 deletions.
4 changes: 2 additions & 2 deletions api/tests/integ/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ def test_aggregation_x_axis_only_hour(client, log):
"dimension_count": 1,
"result": [
{
"anomaly_count": 688,
"anomaly_count": 687,
"confirmed_count": 42,
"failure_count": 721,
"measurement_count": 9990,
"measurement_start_day": "2021-07-09T00:00:00Z",
"ok_count": 8539,
"ok_count": 8540,
},
{
"anomaly_count": 0,
Expand Down
20 changes: 3 additions & 17 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,23 +1432,9 @@ def score_riseupvpn(msm: dict) -> dict:
"""Calculate measurement scoring for RiseUp VPN
Returns a scores dict
"""
# https://github.com/ooni/backend/issues/541
scores = init_scores()
tk = g_or(msm, "test_keys", {})
tstatus = tk.get("transport_status") or {}
obfs4 = tstatus.get("obfs4")
openvpn = tstatus.get("openvpn")
anomaly = (
tk.get("api_status") == "blocked"
or tk.get("ca_cert_status") is False
or obfs4 == "blocked"
or openvpn == "blocked"
)
if anomaly:
scores["blocking_general"] = 1.0

scores["extra"] = dict(test_runtime=msm.get("test_runtime"))
return scores
# originally, there was scoring: https://github.com/ooni/backend/issues/541
# on 2023-10-17, we disabled scoring: https://github.com/ooni/backend/issues/745
return {}


def score_openvpn(msm: dict) -> dict:
Expand Down
9 changes: 1 addition & 8 deletions fastpath/fastpath/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,14 +1217,7 @@ def test_score_torsf():
def test_score_riseupvpn():
for can_fn, msm in minicans("riseupvpn", date(2021, 10, 15), date(2021, 10, 16), 1):
scores = fp.score_measurement(msm)
assert scores == {
"blocking_general": 0.0,
"blocking_global": 0.0,
"blocking_country": 0.0,
"blocking_isp": 0.0,
"blocking_local": 0.0,
"extra": {"test_runtime": 3.8260852},
}
assert scores == {}
assert msm["report_id"] == "20211015T005140Z_riseupvpn_AR_7303_n1_gc8so3BXiS9thxBJ"
return

Expand Down
9 changes: 1 addition & 8 deletions fastpath/fastpath/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,7 @@ def test_score_tor_list():
def test_score_riseupvpn():
msm = loadj("riseupvpn")
scores = fp.score_measurement(msm)
assert scores == {
"blocking_general": 1.0,
"blocking_global": 0.0,
"blocking_country": 0.0,
"blocking_isp": 0.0,
"blocking_local": 0.0,
"extra": {"test_runtime": 1.076507343},
}
assert scores == {}


# # test_name: meek_fronted_requests_test
Expand Down

0 comments on commit c761c29

Please sign in to comment.