From f69a8b47318745425140602efa93b2138f6a76b5 Mon Sep 17 00:00:00 2001 From: I Luk Kim Date: Thu, 12 Mar 2026 17:22:10 -0700 Subject: [PATCH] fix: use TEST-prefixed IDs in integration tests to avoid real-data conflicts Integration tests used ISSUER::0000320193 (Apple's real CIK) and SYM::AAPL::XNYS as hardcoded IDs. After the real pipeline inserts actual AAPL data, subsequent test runs fail with UniqueViolationError since the db_session rollback only undoes intra-test writes. Changed to ISSUER::TEST::0000320193 and SYM::AAPL::XNYS (distinct from the real SYM::AAPL::US) while keeping ticker="AAPL" so the Oracle price service returns real price data for label/feature tests. Co-Authored-By: Claude Sonnet 4.6 --- tests/integration/test_feature_pipeline.py | 12 ++++++------ tests/integration/test_filing_pipeline.py | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/integration/test_feature_pipeline.py b/tests/integration/test_feature_pipeline.py index 7bf3ab7..0262954 100644 --- a/tests/integration/test_feature_pipeline.py +++ b/tests/integration/test_feature_pipeline.py @@ -23,19 +23,19 @@ async def test_feature_snapshot_created(db_session, sample_parser_output): from libs.oracle_client.client import OracleClient from libs.oracle_client.price import PriceService - issuer = IssuerMaster(issuer_id="ISSUER::0000320193", issuer_name="Apple Inc.", ticker="AAPL") + issuer = IssuerMaster(issuer_id="ISSUER::TEST::0000320193", issuer_name="Apple Inc.", ticker="AAPL") db_session.add(issuer) symbol = SymbolMaster( symbol_id="SYM::AAPL::XNYS", - issuer_id="ISSUER::0000320193", + issuer_id="ISSUER::TEST::0000320193", ticker="AAPL", venue="XNYS", ) db_session.add(symbol) doc = Document( - document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC001", + document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC001", source_name="sec", form_type="8-K", filing_date=dt.date(2026, 1, 29), @@ -101,19 +101,19 @@ async def test_financial_v1_snapshot_created(db_session, sample_parser_output): from libs.oracle_client.financial import FinancialService from libs.oracle_client.price import PriceService - issuer = IssuerMaster(issuer_id="ISSUER::0000320193", issuer_name="Apple Inc.", ticker="AAPL") + issuer = IssuerMaster(issuer_id="ISSUER::TEST::0000320193", issuer_name="Apple Inc.", ticker="AAPL") db_session.add(issuer) symbol = SymbolMaster( symbol_id="SYM::AAPL::XNYS", - issuer_id="ISSUER::0000320193", + issuer_id="ISSUER::TEST::0000320193", ticker="AAPL", venue="XNYS", ) db_session.add(symbol) doc = Document( - document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC002", + document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC002", source_name="sec", form_type="8-K", filing_date=dt.date(2026, 1, 29), diff --git a/tests/integration/test_filing_pipeline.py b/tests/integration/test_filing_pipeline.py index 2aeb8db..2424d02 100644 --- a/tests/integration/test_filing_pipeline.py +++ b/tests/integration/test_filing_pipeline.py @@ -75,20 +75,20 @@ async def test_event_parse_lifecycle(db_session): """Create issuer → document → event → event_parse chain.""" from libs.db.models import Document, Event, EventParse, IssuerMaster - # Create issuer + # Create issuer — use TEST prefix to avoid conflicts with real pipeline data issuer = IssuerMaster( - issuer_id="ISSUER::0000320193", + issuer_id="ISSUER::TEST::0000320193", issuer_name="Apple Inc.", - ticker="AAPL", + ticker="AAPL_TEST", ) db_session.add(issuer) await db_session.flush() # Create document doc = Document( - document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC001", + document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC001", source_name="sec", - issuer_id="ISSUER::0000320193", + issuer_id="ISSUER::TEST::0000320193", form_type="8-K", filing_date=dt.date(2026, 1, 29), accession_no="ACC001", @@ -99,9 +99,9 @@ async def test_event_parse_lifecycle(db_session): # Create event event = Event( - event_id="EVT::DOC::sec::ISSUER::0000320193::2026-01-29::ACC001::earnings_release::0", + event_id="EVT::test::ISSUER::TEST::2026-01-29::ACC001::earnings_release::0", primary_document_id=doc.document_id, - issuer_id="ISSUER::0000320193", + issuer_id="ISSUER::TEST::0000320193", event_type="earnings_release", event_direction="bullish", event_date=dt.date(2026, 1, 29),