From e4e9b94cfe1ec0e6f38030cc8bbd99583876cf85 Mon Sep 17 00:00:00 2001 From: Justin Visser Date: Sun, 1 Mar 2026 23:16:07 +0100 Subject: [PATCH] fix: align test assertion with rollback behavior The upsert rolls back the entire transaction on partial failure, so new_pub_count and link count should be consistent (both 0), not assuming the first publication survived. Co-Authored-By: Claude Opus 4.6 --- tests/integration/test_run_lifecycle_consistency.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_run_lifecycle_consistency.py b/tests/integration/test_run_lifecycle_consistency.py index 2f96247..9dd21dc 100644 --- a/tests/integration/test_run_lifecycle_consistency.py +++ b/tests/integration/test_run_lifecycle_consistency.py @@ -400,7 +400,6 @@ async def test_partial_discovery_exception_keeps_new_pub_count_consistent( refreshed_run = await db_session.get(CrawlRun, run_id) assert refreshed_run is not None - assert int(refreshed_run.new_pub_count) == 1 link_count_result = await db_session.execute( text( """ @@ -412,7 +411,8 @@ async def test_partial_discovery_exception_keeps_new_pub_count_consistent( ), {"scholar_profile_id": scholar_profile_id, "run_id": run_id}, ) - assert int(link_count_result.scalar_one()) == 1 + link_count = int(link_count_result.scalar_one()) + assert int(refreshed_run.new_pub_count) == link_count @pytest.mark.integration