test: the patreon ingester tests run phase 3's seen-marking before counting post keys (#4436)
CI and images / lint (push) Successful in 4s
CI and images / extension-version (push) Successful in 4s
CI and images / extension-test (push) Successful in 21s
CI and images / frontend-build (push) Successful in 22s
CI and images / backend-lint-and-test (push) Successful in 33s
CI and images / integration (push) Successful in 2m24s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-agent (push) Successful in 6s
CI and images / build-web (push) Successful in 1m42s
CI and images / smoke-web (push) Successful in 52s
CI and images / promote (push) Successful in 1s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVjrnpQjRgHdvq95rASoiR
This commit is contained in:
2026-09-25 11:41:16 -04:00
co-authored by Claude Opus 5.5
parent 621c2b8315
commit 42a60e3e74
+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. # plan #704: structured run_stats carry the real counts.
assert result.run_stats["downloaded_count"] == 2 assert result.run_stats["downloaded_count"] == 2
assert result.posts_processed == 1 assert result.posts_processed == 1
# The media wait for phase 3 to import them; only the post key is in yet. # The media and the post record both wait for phase 3 to import them (#4436).
assert _count_ledger(sync_engine, source_id) == 1 assert _count_ledger(sync_engine, source_id) == 0
result.mark_seen_after_import() result.mark_seen_after_import()
# 2 media keys + 1 synthetic post key (body/links recaptured per post). # 2 media keys + 1 synthetic post key (body/links recaptured per post).
assert _count_ledger(sync_engine, source_id) == 3 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 result.files_downloaded == 0
assert downloader.download_calls == 0 assert downloader.download_calls == 0
assert result.written_paths == [] assert result.written_paths == []
# Disk-skip reconciles the media key + the synthetic post key (recovery # Disk-skip reconciles the media key at once; the synthetic post key
# recaptures the body/links per post) = 2. # (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 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 result.success is True
assert len(result.post_record_paths) == 1 assert len(result.post_record_paths) == 1
assert downloader.post_records == 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 assert _count_ledger(sync_engine, source_id) == 1
# Second walk: already recorded → gated, no re-write, no new ledger row. # 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, url="https://patreon.com/ingest", mode="tick", revisit_days=30,
) )
assert first.success is True 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. # Second walk: every post is a revisit, and every body comes back empty.
client2 = _FakeClient([(None, posts)], published=published, empty_body=True) client2 = _FakeClient([(None, posts)], published=published, empty_body=True)