From 01347cbbbfb6d3233f3ce8d90b62767afcbdcbc1 Mon Sep 17 00:00:00 2001 From: Ilya Bogin Date: Sat, 25 Jul 2026 13:30:46 +0300 Subject: [PATCH] test(e2e): bound date-only *_before filters at next-day start A date-only cutoff on /v1/search is inclusive of that whole day: a bare acquired_before=2026-05-01 still returns pages acquired at 2026-05-01T14:31Z, while a full timestamp (2026-05-01T00:00:00Z) cuts at the exact instant. The tests asserted the exact-instant reading, so they only passed while no same-day result happened to rank into the top 10 -- test_acquired_before broke in the 2026-07-25 nightly for exactly that reason. Bound both *_before tests at the start of the next day. test_published_before was equally exposed and would have failed on any result published during 2024-01-01. Co-Authored-By: Claude Opus 5 (1M context) --- tests/e2e/test_search.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/e2e/test_search.py b/tests/e2e/test_search.py index 84d5fbe..cf7a178 100644 --- a/tests/e2e/test_search.py +++ b/tests/e2e/test_search.py @@ -101,8 +101,11 @@ def test_acquired_after(kn): def test_acquired_before(kn): + # A date-only cutoff is inclusive of that whole day (a bare 2026-05-01 keeps + # 2026-05-01T14:31Z), so the bound is the start of the next day. Pass a full + # timestamp to cut at an exact instant. for r in _non_empty_results(kn, "AI news", "--acquired-before", "2026-05-01"): - assert parse_ts(r["acquired_at"]) <= utc(2026, 5, 1), r["url"] + assert parse_ts(r["acquired_at"]) < utc(2026, 5, 2), r["url"] def test_published_after(kn): @@ -112,9 +115,10 @@ def test_published_after(kn): def test_published_before(kn): + # Same whole-day-inclusive cutoff as test_acquired_before. for r in _non_empty_results(kn, "rust async", "--published-before", "2024-01-01"): if r.get("published_at") is not None: - assert parse_ts(r["published_at"]) <= utc(2024, 1, 1), r["url"] + assert parse_ts(r["published_at"]) < utc(2024, 1, 2), r["url"] def test_relative_date(kn):