From a609fd7cbdc0939fc98e8f32347767d3fa383080 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Mon, 6 Jul 2026 15:54:16 +0900 Subject: [PATCH] fix(tests): seed tenant config with organization scope in postgres smoke test_get_emails_reply_tracking_real_postgres_smoke fails on develop: the request carries X-Organization-Id, so get_scoped_tenant_config filters on (user_id, organization_id), but the seeded TenantConfig had no organization_id. The lookup returned None, user_addresses was empty, and requires_reply / is_self_sent were computed against no addresses. The seed predates tenant-config organization scoping and was never updated. Verified against a fresh pgvector:pg16: the smoke test now passes (was failing on origin/develop); the full email API suite stays green (48). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_017RkKdtHRLG4wSLh6PVsp8J --- backend/tests/test_emails_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/tests/test_emails_api.py b/backend/tests/test_emails_api.py index 21c3d069a..7a54cc380 100644 --- a/backend/tests/test_emails_api.py +++ b/backend/tests/test_emails_api.py @@ -1374,6 +1374,10 @@ async def cleanup_seed_rows(): session.add( TenantConfig( user_id=user_id, + # Tenant configs are (user, organization) scoped; the endpoint + # looks the config up with the request's X-Organization-Id, so + # the seed must carry the same organization. + organization_id=organization_id, smtp_username="Smoke User ", imap_username=None, )