From ed7247481ad978bffee486d2ae2b5d7739ec435d Mon Sep 17 00:00:00 2001 From: Aaron Gibson Date: Tue, 30 Jun 2026 13:37:18 +0200 Subject: [PATCH 1/5] catch ValueError on changed = "latest" --- .../src/oonipipeline/tasks/updaters/asnmeta_updater.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py index 1822f402..a14183c5 100644 --- a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py +++ b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py @@ -39,7 +39,13 @@ def fetch_data() -> List[dict]: for asn, history in j.items(): asn = int(asn) for v in history: - changed = datetime.strptime(v[2], "%Y%m%d").date() + try: + changed = datetime.strptime(v[2], "%Y%m%d").date() + except ValueError: + if v == "latest": + changed = v + else: + raise rows.append( { "asn": asn, From 447bf35f693ac746c3645d0b05fcb9463b642808 Mon Sep 17 00:00:00 2001 From: Aaron Gibson Date: Tue, 30 Jun 2026 13:50:28 +0200 Subject: [PATCH 2/5] add reference to #164 --- oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py index a14183c5..d39c5b9d 100644 --- a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py +++ b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py @@ -42,6 +42,8 @@ def fetch_data() -> List[dict]: try: changed = datetime.strptime(v[2], "%Y%m%d").date() except ValueError: + # Accept "latest" for changed + # fixes https://github.com/ooni/data/issues/164 if v == "latest": changed = v else: From 23d676ef33884874d9cc951f186cb6ff99818fbf Mon Sep 17 00:00:00 2001 From: Aaron Gibson Date: Wed, 1 Jul 2026 08:14:21 +0200 Subject: [PATCH 3/5] asnmeta: compare correct item ('changed') in history --- oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py index d39c5b9d..390856af 100644 --- a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py +++ b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py @@ -44,7 +44,7 @@ def fetch_data() -> List[dict]: except ValueError: # Accept "latest" for changed # fixes https://github.com/ooni/data/issues/164 - if v == "latest": + if v[2] == "latest": changed = v else: raise From 5839b1748197d3b0ed0824d0bf59969d01b0c155 Mon Sep 17 00:00:00 2001 From: Aaron Gibson Date: Wed, 1 Jul 2026 08:21:02 +0200 Subject: [PATCH 4/5] fix assignment --- oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py index 390856af..3df8a78f 100644 --- a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py +++ b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py @@ -45,7 +45,7 @@ def fetch_data() -> List[dict]: # Accept "latest" for changed # fixes https://github.com/ooni/data/issues/164 if v[2] == "latest": - changed = v + changed = v[2] else: raise rows.append( From 43c5de74a3f84465b568f40ee9b5a37ee6220677 Mon Sep 17 00:00:00 2001 From: Aaron Gibson Date: Wed, 1 Jul 2026 11:51:22 +0200 Subject: [PATCH 5/5] set changed = None, "latest" is not a valid date "latest" will not be accepted as a date when inserted into asn meta table. --- .../src/oonipipeline/tasks/updaters/asnmeta_updater.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py index 3df8a78f..0d8b94c7 100644 --- a/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py +++ b/oonipipeline/src/oonipipeline/tasks/updaters/asnmeta_updater.py @@ -42,12 +42,7 @@ def fetch_data() -> List[dict]: try: changed = datetime.strptime(v[2], "%Y%m%d").date() except ValueError: - # Accept "latest" for changed - # fixes https://github.com/ooni/data/issues/164 - if v[2] == "latest": - changed = v[2] - else: - raise + changed = None rows.append( { "asn": asn,