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 <noreply@anthropic.com>