Release: dev → main (first public release) #258

Merged
bvandeusen merged 94 commits from dev into main 2026-09-25 10:02:40 -04:00
Showing only changes of commit 970d17f98a - Show all commits
+14 -12
View File
@@ -1156,14 +1156,16 @@ def _iso(days_ago):
return (datetime.now(UTC) - timedelta(days=days_ago)).isoformat() return (datetime.now(UTC) - timedelta(days=days_ago)).isoformat()
def _seed_seen(sync_engine, source_id, media): def _seed_all_seen(sync_engine, source_id, media):
factory = sessionmaker(sync_engine, expire_on_commit=False) """Several media through the module's existing one-key `_seed_seen`.
with factory() as s:
A distinct NAME, not a second definition: the first version of this shadowed
`_seed_seen` from the bottom of the file, and the two #830 recapture tests
that pass it a `post_id=` kwarg broke on a TypeError. A helper defined below
the tests that use it is invisible at the point of use.
"""
for m in media: for m in media:
s.add(PatreonSeenMedia( _seed_seen(sync_engine, source_id, _ledger_key(m), post_id=m.post_id)
source_id=source_id, filehash=_ledger_key(m), post_id=m.post_id,
))
s.commit()
@pytest.mark.asyncio @pytest.mark.asyncio
@@ -1174,7 +1176,7 @@ async def test_a_run_of_seen_items_does_not_stop_a_tick_inside_the_window(
around at the second and never looked at the third, which is exactly where around at the second and never looked at the third, which is exactly where
an edited post lives.""" an edited post lives."""
seen = [_media(f"p{i}", 1) for i in range(1, 4)] seen = [_media(f"p{i}", 1) for i in range(1, 4)]
_seed_seen(sync_engine, source_id, seen) _seed_all_seen(sync_engine, source_id, seen)
client = _FakeClient( client = _FakeClient(
[(None, [(m.post_id, [m]) for m in seen])], [(None, [(m.post_id, [m]) for m in seen])],
@@ -1201,7 +1203,7 @@ async def test_the_early_out_still_fires_once_the_walk_is_below_the_horizon(
did. Asserted beside the test above because the window is only correct if did. Asserted beside the test above because the window is only correct if
BOTH conditions are required; either one alone is a different feature.""" BOTH conditions are required; either one alone is a different feature."""
seen = [_media(f"p{i}", 1) for i in range(1, 4)] seen = [_media(f"p{i}", 1) for i in range(1, 4)]
_seed_seen(sync_engine, source_id, seen) _seed_all_seen(sync_engine, source_id, seen)
client = _FakeClient( client = _FakeClient(
[(None, [(m.post_id, [m]) for m in seen])], [(None, [(m.post_id, [m]) for m in seen])],
@@ -1226,7 +1228,7 @@ async def test_a_window_of_zero_is_the_behaviour_that_shipped_before_it(
"""The off switch. Recent posts, a window of 0 → the walk stops on the """The off switch. Recent posts, a window of 0 → the walk stops on the
count alone, so an operator who wants the old cheap tick has one.""" count alone, so an operator who wants the old cheap tick has one."""
seen = [_media(f"p{i}", 1) for i in range(1, 4)] seen = [_media(f"p{i}", 1) for i in range(1, 4)]
_seed_seen(sync_engine, source_id, seen) _seed_all_seen(sync_engine, source_id, seen)
client = _FakeClient( client = _FakeClient(
[(None, [(m.post_id, [m]) for m in seen])], [(None, [(m.post_id, [m]) for m in seen])],
@@ -1252,7 +1254,7 @@ async def test_a_backfill_ignores_the_window_because_it_never_early_outs(
every body — a horizon there would be a third answer to a two-answer every body — a horizon there would be a third answer to a two-answer
question.""" question."""
seen = [_media(f"p{i}", 1) for i in range(1, 4)] seen = [_media(f"p{i}", 1) for i in range(1, 4)]
_seed_seen(sync_engine, source_id, seen) _seed_all_seen(sync_engine, source_id, seen)
client = _FakeClient( client = _FakeClient(
[(None, [(m.post_id, [m]) for m in seen])], [(None, [(m.post_id, [m]) for m in seen])],
@@ -1407,7 +1409,7 @@ async def test_a_post_whose_date_will_not_parse_falls_back_to_the_count(
into the window. It reads as "not provably recent", which leaves that post into the window. It reads as "not provably recent", which leaves that post
on the behaviour it had before the window existed.""" on the behaviour it had before the window existed."""
seen = [_media(f"p{i}", 1) for i in range(1, 4)] seen = [_media(f"p{i}", 1) for i in range(1, 4)]
_seed_seen(sync_engine, source_id, seen) _seed_all_seen(sync_engine, source_id, seen)
client = _FakeClient( client = _FakeClient(
[(None, [(m.post_id, [m]) for m in seen])], [(None, [(m.post_id, [m]) for m in seen])],