Release: dev → main (download restarts, misfiled attachments, undated posts) #259

Merged
bvandeusen merged 7 commits from dev into main 2026-09-25 12:19:51 -04:00
Showing only changes of commit 42a60e3e74 - Show all commits
+11 -5
View File
@@ -239,8 +239,8 @@ async def test_tick_downloads_unseen_and_marks_seen(source_id, sync_engine, tmp_
# plan #704: structured run_stats carry the real counts.
assert result.run_stats["downloaded_count"] == 2
assert result.posts_processed == 1
# The media wait for phase 3 to import them; only the post key is in yet.
assert _count_ledger(sync_engine, source_id) == 1
# The media and the post record both wait for phase 3 to import them (#4436).
assert _count_ledger(sync_engine, source_id) == 0
result.mark_seen_after_import()
# 2 media keys + 1 synthetic post key (body/links recaptured per post).
assert _count_ledger(sync_engine, source_id) == 3
@@ -648,8 +648,10 @@ async def test_recovery_tier2_disk_still_skips(source_id, sync_engine, tmp_path)
assert result.files_downloaded == 0
assert downloader.download_calls == 0
assert result.written_paths == []
# Disk-skip reconciles the media key + the synthetic post key (recovery
# recaptures the body/links per post) = 2.
# Disk-skip reconciles the media key at once; the synthetic post key
# (recovery recaptures the body/links per post) waits for phase 3 (#4436).
assert _count_ledger(sync_engine, source_id) == 1
result.mark_seen_after_import()
assert _count_ledger(sync_engine, source_id) == 2
@@ -1203,7 +1205,10 @@ async def test_tick_captures_media_less_post_once(source_id, sync_engine, tmp_pa
assert result.success is True
assert len(result.post_record_paths) == 1
assert downloader.post_records == 1
# The synthetic `post:ptext` key was marked seen (gates re-capture).
# The synthetic `post:ptext` key is marked once phase 3 has upserted the
# record (#4436), and then gates re-capture.
assert _count_ledger(sync_engine, source_id) == 0
result.mark_seen_after_import()
assert _count_ledger(sync_engine, source_id) == 1
# Second walk: already recorded → gated, no re-write, no new ledger row.
@@ -1543,6 +1548,7 @@ async def test_revisits_do_not_feed_the_body_drift_canary(
url="https://patreon.com/ingest", mode="tick", revisit_days=30,
)
assert first.success is True
first.mark_seen_after_import() # phase 3 ran
# Second walk: every post is a revisit, and every body comes back empty.
client2 = _FakeClient([(None, posts)], published=published, empty_body=True)