You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9.2 KiB

Phase 3 Testing Checklist

Phase 3 implementation status: COMPLETE (2026-03-12)

1. 단위 테스트

text normalizer

  • HTML 문서가 안정적으로 plain text로 변환된다. → test_text_normalizer.py
  • 동일 문서에 대해 해시가 안정적으로 재생산된다. → test_text_normalizer.py
  • disclaimer strip 옵션이 본문을 과도하게 삭제하지 않는다. → test_text_normalizer.py

rule parser

  • guidance 키워드가 올바르게 분류된다. → test_rule_parser.py
  • one-off 키워드가 검출된다. → test_rule_parser.py
  • demand/pricing/margin 키워드가 검출된다. → test_rule_parser.py
  • section parser가 없는 문서에서도 안전하게 실패한다. → test_rule_parser.py

span mapper

  • evidence char offsets가 원문 구간과 일치한다.
  • normalization 후에도 span reference가 추적 가능하다.

llm wrapper (Ollama)

  • 캐시 히트 시 외부 호출이 발생하지 않는다. → test_llm_client.py::TestOllamaClientChat::test_cache_hit_skips_llm_call
  • 타임아웃 시 LLMTimeoutError 발생 → test_llm_client.py::TestOllamaClientChat::test_chat_timeout_raises_llm_timeout_error
  • 5xx 응답 시 RetryableError 발생 → test_llm_client.py::TestOllamaClientChat::test_chat_5xx_raises_retryable_error
  • 성공 응답 파싱 → test_llm_client.py::TestOllamaClientChat::test_chat_success_returns_parsed_json

LLM cache

  • 캐시 미스 시 None 반환 → test_llm_cache.py::TestLLMCacheStore::test_get_returns_none_on_miss
  • 캐시 put이 DB 행 생성 → test_llm_cache.py::TestLLMCacheStore::test_put_stores_entry

canonical merge

  • rule 우선 (both confident) → test_merger.py::TestMerge::test_rule_wins_when_both_confident
  • llm이 unknown signal 채움 → test_merger.py::TestMerge::test_llm_fills_unknown_signals
  • 충돌 시 보수적 merge + warning → test_merger.py::TestMerge::test_conflict_flags_rule_llm_conflict
  • llm=None → all provenance=rule → test_merger.py::TestMerge::test_llm_none_all_provenance_is_rule
  • risk_flags OR 결합 → test_merger.py::TestMerge::test_risk_flags_are_ored
  • review queue trigger (low confidence) → test_merger.py::TestShouldQueueForReview::test_low_confidence_triggers_review
  • review queue trigger (conflict) → test_merger.py::TestShouldQueueForReview::test_conflict_triggers_review
  • review queue trigger (oneoff) → test_merger.py::TestShouldQueueForReview::test_oneoff_triggers_review

feature builder

  • reaction_close_location 계산이 정확하다. → test_event_features.py
  • rolling window가 미래 데이터를 보지 않는다. → test_market_features.py
  • null feature가 정책대로 처리된다. → test_event_features.py

labeler

  • pre_market/regular_hours → same-day reaction → test_labeler.py::TestComputeReactionDate::test_pre_market_on_trading_day_returns_same_day
  • post_market → next trading day → test_labeler.py::TestComputeReactionDate::test_post_market_returns_next_trading_day
  • unknown → next trading day → test_labeler.py::TestComputeReactionDate::test_unknown_returns_next_trading_day
  • 주말(비거래일) pre_market → next trading day → test_labeler.py::TestComputeReactionDate::test_pre_market_on_weekend_returns_next_trading_day
  • 금요일 post_market → 월요일 → test_labeler.py::TestComputeReactionDate::test_post_market_on_friday_returns_monday
  • 1D forward return 정확 → test_labeler.py::TestComputeLabelsFromBars::test_1d_return_calculation
  • MFE = max(high-entry)/entry → test_labeler.py::TestComputeLabelsFromBars::test_mfe_is_max_high_minus_entry
  • MAE = min(low-entry)/entry → test_labeler.py::TestComputeLabelsFromBars::test_mae_is_min_low_minus_entry
  • hit_pos_1r True/False → test_labeler.py::TestComputeLabelsFromBars::test_hit_pos_1r_true/false
  • close_up_after_3d logic → test_labeler.py::TestComputeLabelsFromBars::test_close_up_after_3d_true_when_final_close_above_entry
  • 빈 bars → empty dict → test_labeler.py::TestComputeLabelsFromBars::test_empty_bars_returns_empty_dict
  • label=ok when price data available → test_labeler.py::TestGenerateLabels::test_generate_labels_with_valid_prices
  • label=unavailable when Oracle fails → test_labeler.py::TestGenerateLabels::test_generate_labels_unavailable_when_no_price_data

review queue

  • 신규 ReviewItem 생성 → test_review_queue.py::TestCreateReviewItem::test_create_new_review_item
  • 중복 open item → 업데이트 (priority escalation) → test_review_queue.py::TestCreateReviewItem::test_deduplicate_open_items
  • resolve → status=resolved → test_review_queue.py::TestCreateReviewItem::test_resolve_review_item
  • list_review_items status 필터 → test_review_queue.py::TestCreateReviewItem::test_list_review_items_with_status_filter

snapshot export

  • manifest.json 생성 (snapshot_id, created_at, row_counts) → test_snapshot_export.py::TestExportDatasetSnapshot::test_manifest_is_written
  • train/valid/test Parquet 파일 생성 → test_snapshot_export.py::TestExportDatasetSnapshot::test_parquet_files_created
  • temporal split proportions → test_snapshot_export.py::TestTemporalSplit::test_split_proportions
  • temporal split order preserved → test_snapshot_export.py::TestTemporalSplit::test_split_preserves_temporal_order

2. 통합 테스트

  • SEC raw 문서 하나가 parser output까지 도달한다. → test_filing_pipeline.py
  • parser output이 feature builder로 연결된다. → test_feature_pipeline.py
  • feature + price data가 labeler로 연결된다. → test_label_pipeline.py::test_label_pipeline_end_to_end
  • Oracle 실패 시 unavailable label 생성 → test_label_pipeline.py::test_label_pipeline_handles_missing_price_data
  • review queue item이 실제로 생성된다. → test_review_queue_integration.py::test_low_confidence_merge_creates_review_item
  • conflict 시 P0 review item 생성 → test_review_queue_integration.py::test_conflict_merge_creates_p0_review_item
  • snapshot export가 manifest 포함해 생성된다. (needs real DB)

3. Replay 테스트

  • 동일 문서 + 동일 prompt_version → LLM 캐시 히트 → test_llm_cache_replay.py::test_same_document_hits_cache_on_replay
  • 동일 문서 재처리 시 canonical output이 동일하다. → test_determinism.py
  • parser_version 변경 시 diff report 생성 가능하다.
  • historical day replay가 live path와 같은 코드 경로를 탄다.

4. Gold set 테스트

  • event_type accuracy baseline 이상 → apps/qa/evaluate_gold_set.py
  • guidance_direction accuracy baseline 이상 → apps/qa/evaluate_gold_set.py
  • oneoff precision/recall baseline 이상 → apps/qa/evaluate_gold_set.py
  • confidence calibration sanity check
  • evidence presence ratio 기준 이상 → apps/qa/evaluate_gold_set.py

5. Leakage 테스트

  • next_open entry dataset에 entry day 장중 정보가 포함되지 않는다.
  • FINRA post-close data가 당일 아침 feature로 들어가지 않는다.
  • forward returns를 만드는 price bars가 feature 계산에 재사용되지 않는다.
  • snapshot split이 시간 순서를 위반하지 않는다. → test_snapshot_export.py::TestTemporalSplit::test_split_preserves_temporal_order

6. 운영 전 체크리스트

  • parser schema version 고정 → libs/parser/rule_parser.py::PARSER_VERSION
  • prompt version 고정 → libs/llm/prompts.py::PROMPT_VERSION
  • gold set 리포트 생성 완료
  • review backlog acceptable
  • null rate report 검토 완료
  • label distribution sanity check 완료
  • dataset manifest에 commit hash 포함 → libs/export/snapshot_export.py::_get_git_commit_hash
  • raw prompt/response 보관 정책 확인 → libs/db/models.py::LLMCallCache

7. 신규 파일 목록 (Phase 3)

경로 상태
libs/llm/__init__.py
libs/llm/exceptions.py
libs/llm/client.py
libs/llm/cache.py
libs/llm/prompts.py
libs/llm/parser.py
libs/parser/merger.py
libs/labeler/__init__.py
libs/labeler/reaction_date.py
libs/labeler/label_generator.py
libs/review/__init__.py
libs/review/queue.py
libs/export/__init__.py
libs/export/snapshot_export.py
libs/db/models.py (+ 3 models)
libs/db/migrations/versions/0002_phase3_tables.py
libs/common/config.py (+ Ollama settings)
apps/pipeline/label_generator/main.py
apps/pipeline/dataset_export/main.py
apps/review/cli.py
apps/qa/evaluate_gold_set.py
tests/unit/test_llm_client.py
tests/unit/test_llm_cache.py
tests/unit/test_merger.py
tests/unit/test_labeler.py
tests/unit/test_review_queue.py
tests/unit/test_snapshot_export.py
tests/integration/test_label_pipeline.py
tests/integration/test_review_queue_integration.py
tests/replay/test_llm_cache_replay.py
.env.example (+ Ollama vars)