Files
trex-core/docs/batches/bat-058_20260716_cost-basis-safe-sync-seed/verification.md
T

7.1 KiB

BAT-058 Verification

  • Status: release-candidate (lead confirm-batch-verification, 2026-07-17)
  • Batch: BAT-058
  • Verified By: delivery-runner (implementation evidence) + independent dev-qc QC-7
  • Confirmed By: trex-dev-lead (QC-7 PASS-WITH-NOTES 수용; 사용자 지시: “QC-7 PASS-WITH-NOTES로 batch verification을 진행해”)

Verification 범위

  • Scope: REQ-123 및 dcy-038 기반 hotfix 범위
    • trex_core/adapters/portfolio/hub_read.py
    • trex_core/application/reconciliation.py
    • trex_core/runtime/cli.py
    • tests/adapters/portfolio/test_hub_read.py
    • tests/application/test_sync.py

AC 점검 결과

AC 내용 결과 근거
AC-1 canonical cost_basis_per_unit 우선 파싱 + 유효성 검증 ✅ PASS test_get_cost_basis_with_diagnostics_prefers_canonical_when_valid, test_get_cost_basis_with_diagnostics_canonical_null_blocks_legacy, test_get_cost_basis_with_diagnostics_canonical_non_numeric_blocks_legacy, test_get_cost_basis_with_diagnostics_canonical_negative_blocks_legacy
AC-2 canonical invalid 시 legacy masking 금지, canonical 부재 시 legacy fallback 순차 적용 ✅ PASS test_get_cost_basis_with_diagnostics_canonical_invalid_blocks_legacy, test_get_cost_basis_with_diagnostics_legacy_chain_fallback_order, test_get_cost_basis_with_diagnostics_legacy_skips_invalid_values
AC-3 성공/실패 이유 분류(reason) ✅ PASS test_get_cost_basis_with_diagnostics_canonical_null_blocks_legacy, test_get_cost_basis_with_diagnostics_canonical_non_numeric_blocks_legacy, test_get_cost_basis_with_diagnostics_canonical_negative_blocks_legacy, test_get_cost_basis_with_diagnostics_missing_field_returns_missing_reason, test_get_cost_basis_with_diagnostics_all_legacy_invalid_returns_last_reason
AC-4 non-2xx/transport 실패 사유 분류 ✅ PASS test_get_cost_basis_with_diagnostics_non_2xx_or_transport_keeps_diagnostic
AC-5 dry-run no-write preview (seeded=true/false 반영) ✅ PASS test_sync_dry_run_no_write, test_sync_dry_run_inactive_valid_canonical_seed_previews_without_writes
AC-6 dry-run inactive + broker_qty>0 + avg_price unavailable no-write preview ✅ PASS test_sync_dry_run_no_write
AC-7 live fail-closed (status/qty/avg_price 모두 미반영, non-zero 종료) ✅ PASS independent QC-7이 test_sync_fail_closed_skipped_error_exits_nonzero_without_writes 및 legacy-only 0.0/negative/NaN/+Inf no-write 회귀를 재실행·검토함; CLI rc=1, mutation SQL 0, warning clear 0 확인
AC-8 HOLDING 정상 동기화 회귀 및 seed 적용 유지 ✅ PASS test_sync_holding_qty_mismatch_updated, test_sync_seeds_avg_price_from_cost_basis_port, test_sync_seeds_avg_price_holding_with_cost_basis, test_sync_degrades_gracefully_cost_basis_returns_none
AC-9 response-contract + regression 테스트 전체 통과 ✅ PASS tests/runtime/test_cli_operator.py, tests/adapters/portfolio/test_hub_read.py, tests/application/test_sync.py (independent QC-7 affected suite: 113 passed; full suite: 833 passed, 47 skipped)
AC-10 public diagnostic source/reason contract normalization (raw field/detail non-leak) 및 release gate ✅ PASS (release 실행은 별도 gate) independent QC-7이 docs/interface-contract.md, docs/runtime-flows.md, docs/operations.md와 bounded diagnostic/no-leak 구현을 대조함. REQ가 요구하는 actual release artifact·approval·live evidence는 Release 단계에서만 생성/판정하며, 본 batch verification은 이를 승인하거나 대체하지 않음.

독립 QC-7 및 Lead confirm-batch-verification

  • QC-7 실행: 2026-07-17 00:30:22 UTC 시작, supervised child exit 0.
  • QC verdict: PASS-WITH-NOTES.
  • QC-7 독립 재실행: legacy-invalid focused 8 passed, 19 deselected; affected suite 113 passed; full suite 833 passed, 47 skipped; Ruff All checks passed; compileall exit 0; git diff --check exit 0.
  • Lead 판정: 사용자 지시에 따라 QC-7 PASS-WITH-NOTES를 수용하여 BAT-058의 confirm-batch-verification을 완료하고 release-candidate로 승격한다.
  • Note 해소: REQ-123 AC-10의 release artifact/explicit approval/dry-run evidence/live execution은 Release 단계의 별도 gate다. 이 batch confirmation은 release approval, sync --live, 배포, credential 접근을 승인하지 않는다.
  • Ledger note: 이전 QC 반복 횟수 표기는 과거 handoff 사이에 불일치가 있어 이 verification의 판정 근거로 사용하지 않는다. 이번 confirmation의 근거는 QC-7의 독립 verdict와 위 재실행 증적이다.

실행 커맨드 및 실제 재실행 결과

아래는 delivery worktree에서 실행한다. 공유 가상환경은 worktree의 상위 repository root에 있으므로 git rev-parse로 worktree root를 해석해 사용한다.

WORKTREE="$(git rev-parse --show-toplevel)"
PYTHON="${TREX_CORE_PYTHON:-$(cd "$WORKTREE/../.." && pwd)/.venv312/bin/python}"
cd "$WORKTREE"

"$PYTHON" -m pytest tests/runtime/test_cli_operator.py tests/adapters/portfolio/test_hub_read.py tests/application/test_sync.py -q
"$PYTHON" -m pytest -q
"$PYTHON" -m ruff check trex_core/runtime/cli.py trex_core/adapters/portfolio/hub_read.py trex_core/application/reconciliation.py tests/runtime/test_cli_operator.py tests/adapters/portfolio/test_hub_read.py tests/application/test_sync.py
"$PYTHON" -m compileall -q trex_core/runtime/cli.py trex_core/adapters/portfolio/hub_read.py trex_core/application/reconciliation.py tests/runtime/test_cli_operator.py tests/adapters/portfolio/test_hub_read.py tests/application/test_sync.py
  • focused pytest (2026-07-17, QC-5 재실행): 105 passed in 0.28s
  • full pytest (2026-07-17, QC-5 재실행): 825 passed, 47 skipped in 1.71s
  • ruff (2026-07-17, QC-5 재실행): All checks passed!
  • compileall (2026-07-17, QC-5 재실행): compileall: PASS (exit 0; quiet mode)
  • git diff --check (2026-07-17, QC-5 재실행): PASS (exit 0; no output)
  • QC-6 targeted pytest (2026-07-17): tests/application/test_sync.py -q -k legacy_only_invalid_wac → 8 passed, 19 deselected in 0.05s.
  • QC-6 focused pytest (2026-07-17): tests/runtime/test_cli_operator.py tests/adapters/portfolio/test_hub_read.py tests/application/test_sync.py -q → 113 passed in 0.29s.
  • QC-6 full pytest (2026-07-17): pytest -q → 833 passed, 47 skipped in 1.72s.
  • QC-6 ruff (2026-07-17): 대상 6개 source/test 파일 → All checks passed! (exit 0).
  • QC-6 compileall (2026-07-17): 대상 6개 source/test 파일 → exit 0 (quiet mode; no output).

미해결/미실행 항목

  • 실운영 배포, sync --live 실행, DB 직접 수정은 실행하지 않음.
  • 본 문서는 implementation self-approval가 아니다. 독립 QC-7 PASS-WITH-NOTES와 lead confirm-batch-verification까지 반영한 batch verification 기록이며, release approval은 포함하지 않는다.

위험/차단 요인

  • 없음. 단, Release 단계에서 REQ-123 AC-10의 explicit release approval, 단일 대상 live 실행 승인, rollback 기준, post-release monitoring plan을 별도 draft-release 산출물로 점검해야 한다.