feat(reset): cutover 도구 폐기 → trex-core-reset(DB 재초기화) 대체 (REQ-064 CHG-20260610-03)

실 DB 점검 중 마이그레이션 009 부분 유니크 인덱스가 legacy 풀 데이터(같은
자산이 closed+재진입 holding 으로 portfolio_id 중복)에 적용 불가 → cutover·
데몬 부팅 모두 차단되는 결함 확인. 데이터 보존 cutover 를 폐기하고 DB wipe +
자산 중심 재초기화로 전환(사용자 결정). 빈 테이블에는 009 인덱스가 정상
생성되고 자산 중심에서 (instance_key, portfolio_id)는 설계상 유일.

- trex_core/runtime/reset.py 신규(trex-core-reset): slot-core 7테이블 wipe +
  apply_migrations 재적용 → 자산 중심 스키마 착지 검증. dry-run 기본/--yes 적용,
  파괴적·DB 전역. 보유 carry-over 없음(재초기화 후 reconcile_core_holdings 재편입).
- runtime/cutover.py + trex-core-cutover console script + test_cutover_rehearsal.py 삭제.
- pyproject: trex-core-reset 등록.
- tests/runtime/test_reset.py 신규 5건(PG-gated): wipe+착지·dry-run 무변경·멱등·
  wipe 후 admission·테이블 커버리지.
- change-req REQ-064 CHG-20260610-03(cutover→재초기화 재정의) + srs index 갱신.
- baseline 4문서(data-model/runtime-flows/project-structure/interface-contract)
  + BAT-030 design/planning/index/implementation/verification 도구 서술 reset 으로 교체.

검증: ruff clean, 단위 367 passed, PG+RabbitMQ 통합 411 passed/1 skip(KIS sandbox).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 16:08:05 +09:00
co-authored by Claude Opus 4.8
parent 5330f32247
commit c04fd276b3
15 changed files with 335 additions and 405 deletions
@@ -5,6 +5,9 @@
> **체크포인트 결정(2026-06-10)**: D1=**전체 rebuild**(보유는 브로커 잔고 기준 carry-over) / D2=**전부 완성**(literal inactive + 별칭 제거 + entry_count·trading_date drop) / D3=**집행 매도 qty 브로커 정본**(미러 fallback 없음, 0이면 skip+divergence) / D4=**실 cutover 는 운영자(REL 단계, 리허설 후)**. 아래 §1 을 전체 rebuild 로 읽는다.
> **2026-06-10 갱신(CHG-20260610-03)**: D1(데이터 보존 cutover) 폐기 — 실 DB 점검에서 마이그레이션 009 부분 유니크 인덱스가 legacy 풀 중복 데이터에 적용 불가한 결함 확인. **DB wipe + 자산 중심 재초기화**(`trex-core-reset`)로 대체. §1 의 cutover(전체 rebuild·보유 carry-over·promote-unique)는 미적용; 보유는 재초기화 후 universe reconcile + reconcile_core_holdings(REQ-062)로 운영자 재편입. D2/D3 는 유효.
## 설계 목표
- 자산 중심 모델을 완성하고 라이브로 안전 전환. 보유 포지션 무손실·집행 정확·비가역 변경 통제.
@@ -6,12 +6,12 @@
## 구현 요약
design.md 확정 결정(D1=전체 rebuild / D2=전부 완성 / D3=매도 qty 브로커 정본 / D4=실 cutover 운영자) 전부 구현 완료. M1~M5 전 마일스톤 수행.
design.md 확정 결정(D2=전부 완성 / D3=매도 qty 브로커 정본) 구현 완료. M1~M5 수행. **단, D1(데이터 보존 cutover)은 폐기** — 실 DB 점검 중 마이그레이션 009 부분 유니크 인덱스가 legacy 풀 데이터(같은 자산이 closed+재진입 holding 으로 portfolio_id 중복)와 충돌해 cutover/데몬 부팅이 모두 막히는 결함 발견. 사용자 결정으로 데이터 보존 마이그레이션을 버리고 **DB wipe + 자산 중심 재초기화**(`trex-core-reset`)로 대체(REQ-064 CHG-20260610-03). 빈 테이블에는 009 인덱스가 정상 생성되고 자산 중심에서 (instance_key,portfolio_id)는 설계상 유일.
- **M1 — literal inactive 전면화 (REQ-057 잔여)**: `SlotState` 5-state(inactive/pending_buy/holding/pending_sell/error) — `IDLE`/`CLOSED` 별칭·`normalize_state` 완전 제거, 전이 12종(6 base + 4 to-error + 2 resolve). 마이그레이션 **010**: 기존 idle/closed 행 → inactive UPDATE + status CHECK 교체(drop-and-add 멱등). `execution.py` 매도 체결 `PENDING_SELL→INACTIVE`, 매수 롤백 `PENDING_BUY→INACTIVE`. `cli.py` buyable 필터 `inactive`+`universe_detached` 제외. `ops_checks.py` ledger-gap 검출을 `slot_transition_log`(reason=`sell_filled`/`sell_partial_cancel`) 기반으로 재작성(`closed` 상태 소멸 대응).
- **M2 — 집행 매도 수량 브로커 정본 (REQ-062 M2(b), D3)**: dispatch 매도 qty = `broker.get_balance()` 의 해당 symbol `hldg_qty`(tick 당 1회 lazy fetch). 미러 `slot.qty` fallback 없음. 브로커 0 → 주문 미제출 + WARN + `ExecutionResult.sell_skipped_no_balance` 카운터(divergence 는 reconcile/운영자 경로로 표면화). skip 매도가 큐 head 를 막지 않도록 단건 claim(`find_pending_for_dispatch`) → **리스트 기반**(`list_undispatched_pending(instance_key, limit)`) dispatch 로 전환.
- **M3 — 컬럼 drop + legacy pool 제거 (REQ-056 잔여)**: 마이그레이션 **011**: `daily_slot.entry_count`·`trading_date` DROP(IF EXISTS 멱등). 글롭 재적용 정합: 001 의 `(trading_date,status)` 인덱스 → `(status)` 교체, 008(entry_count ADD)은 no-op 화(매 boot 컬럼 부활 방지). `Slot` 모델/`EXPECTED_SLOT_FIELDS`/`_SLOT_COLUMNS`/`_row_to_slot` 정합(19 컬럼). repo 계약 개편: `pre_allocate_slots`/`find_idle_slot`/`find_allocatable_slot`/`increment_symbol_entry`/`get_symbol_entry_count` 제거, `list_slots(instance_key)`/`count_slots_by_status(instance_key)`/`reconcile_universe(instance_key, universe)` 로 전환, 집행 큐(`list_undispatched_pending`/`list_dispatched_pending`)도 **instance 스코프**(공유 DB 의 두 데몬이 서로의 주문을 집행하지 않음 — REQ-056). `preallocation_scheduler.py` 삭제 + 데몬 7 스레드. admission 은 자산 중심 단일 경로(slot_id 정본/portfolio_id dual-accept; `max_active_slots` 미설정 = 무캡 — design §5: 운영 TOML 로 M 부여). `BuyIntent.trading_date`·intent/이벤트/슬롯 뷰 payload 의 `trading_date` 키 제거. capacity 를 `SlotCapacity(inactive/holding/pending/active/available/total/scarcity)` 자산 중심 재정의(available = max(0, M−active)). `daily_symbol_entries` 코드 경로 제거(테이블 잔존, baseline 에 폐기 명시). config 에서 `total_slots`/`daily_preallocation_time` 제거. SnapshotScheduler reconcile 은 slot_repo 주입 시 항상 on.
- **M4 — cutover 도구 (REQ-064, D1·D4)**: `trex_core/runtime/cutover.py` + console script `trex-core-cutover`(기본 dry-run, `--yes` 적용). 절차: preflight(pending_* in-flight 0, 위반 시 CutoverAbort) → instance 행 전체 DELETE → universe 자산별 영구 슬롯(inactive) 생성 → 브로커 잔고 (symbol,qty) → universe 매핑 → holding 설정(qty=브로커 정본, avg_price=NULL+WARN — 잔고 API 에 평단 없음) → `slot_transition_log` 감사(`cutover_rebuild`) → 옵션 `--promote-unique`(portfolio_id NOT NULL; 공유 DB 전 인스턴스 cutover 후). 매핑 실패 기본 중단(`--allow-unmapped` 로 WARN+skip). 단일 트랜잭션(중단/실패 시 무변경, dry-run 은 rollback).
- **M4 — DB 재초기화 도구 (REQ-064, CHG-20260610-03)**: `trex_core/runtime/reset.py` + console script `trex-core-reset`(기본 dry-run, `--yes` 적용). 절차: 대상 DB 확인 → slot-core 7개 테이블 중 존재하는 것 행수 집계(dry-run 은 여기서 보고만) → `--yes` 면 `TRUNCATE ... RESTART IDENTITY CASCADE` → `apply_migrations`(빈 테이블이라 009 유니크 인덱스 정상 생성·010 inactive CHECK·011 컬럼 drop) → `daily_slot` 컬럼 == EXPECTED_SLOT_FIELDS 검증. 파괴적·**DB 전역**(모든 instance). 데이터 보존(보유 carry-over)은 하지 않음 — 재초기화 후 universe reconcile 이 자산 슬롯 생성, 보유는 `reconcile_core_holdings`(REQ-062)로 운영자 재편입. (구 `cutover.py`·`trex-core-cutover`·`test_cutover_rehearsal.py` 삭제.)
- **M5 — baseline 마감 (REQ-065)**: data-model/runtime-flows/project-structure/interface-contract 4문서 자산 중심 최종 갱신(daily_symbol_entries·dcy-014 preallocation·풀 admission 폐기 확정, slot_id 계약·5-state·M 캡·브로커 정본 반영). `config/instance.example.toml` 에 `max_active_slots` 안내. `.claude/skills/run-trex-core-daemon`(SKILL.md+smoke.py) 자산 중심으로 갱신.
## 변경 내역 (Changed Files)
@@ -19,18 +19,18 @@ design.md 확정 결정(D1=전체 rebuild / D2=전부 완성 / D3=매도 qty 브
- trex_core/domain/slot/: state.py(5-state) · models.py(컬럼 drop+SlotCapacity 재정의) · service.py(preallocate/카운터 제거, INACTIVE 리셋=점유 초기화+자산 정체성 보존, capacity 자산 중심) · repository.py · in_memory_repository.py(+add_slot 테스트 헬퍼) · __init__.py
- trex_core/adapters/persistence/: postgresql.py · ops_checks.py(재작성) · sql/001(인덱스 교체)·008(no-op 화)·**010_literal_inactive_status.sql**(신규)·**011_drop_pool_model_columns.sql**(신규)
- trex_core/application/: intents.py(단일 자산 중심 admission) · execution.py(M2+inactive 전이+instance 스코프) · messaging_handlers.py · portfolio.py · safety_sell.py · killswitch.py · snapshot_scheduler.py · **preallocation_scheduler.py 삭제**
- trex_core/runtime/: daemon.py(7 스레드) · config.py · cli.py · **cutover.py(신규)**
- pyproject.toml: `trex-core-cutover` console script
- trex_core/runtime/: daemon.py(7 스레드) · config.py · cli.py · **reset.py(신규)** · ~~cutover.py(삭제)~~
- pyproject.toml: `trex-core-reset` console script (구 `trex-core-cutover` 제거)
- docs: data-model.md · runtime-flows.md · project-structure.md · interface-contract.md (자산 중심 마감)
- config/instance.example.toml · .claude/skills/run-trex-core-daemon/{SKILL.md,smoke.py}
- tests: 도메인/애플리케이션/어댑터/런타임 전면 정합(test_state·test_service 재작성, test_slot_entry_count·test_buy_admission_reallocation·test_preallocation_scheduler 삭제, test_execution 에 M2 3건 신설, **tests/runtime/test_cutover_rehearsal.py 신규 8건(PG-gated)**, test_postgresql_repository 자산 중심 재작성+dispatch 인스턴스 격리, test_ops_checks 재작성)
- tests: 도메인/애플리케이션/어댑터/런타임 전면 정합(test_state·test_service 재작성, test_slot_entry_count·test_buy_admission_reallocation·test_preallocation_scheduler 삭제, test_execution 에 M2 3건 신설, **tests/runtime/test_reset.py 신규 5건(PG-gated)**, test_postgresql_repository 자산 중심 재작성+dispatch 인스턴스 격리, test_ops_checks 재작성)
## 테스트
- 단위 전체: **367 passed** (PG/RabbitMQ/KIS unset 시 40 skipped), ruff clean
- PG-gated(trex_core_test): **29 passed** — 마이그레이션 010/011 round-trip + 멱등 재적용, daily_slot 컬럼 == EXPECTED_SLOT_FIELDS 드리프트 가드(컬럼 drop 후 정합), reconcile ON CONFLICT, dispatch 인스턴스 격리, ops_checks 재작성, **cutover 리허설 8건**(전체 rebuild·브로커 carry-over(미러 7 vs 브로커 12 → 12)·in-flight 중단·unmapped 중단/allow-skip·dry-run rollback·인스턴스 격리·promote-unique·감사 로그)
- PG-gated(trex_core_test): **26 passed** — 마이그레이션 010/011 round-trip + 멱등 재적용, daily_slot 컬럼 == EXPECTED_SLOT_FIELDS 드리프트 가드(컬럼 drop 후 정합), reconcile ON CONFLICT, dispatch 인스턴스 격리, ops_checks 재작성, **reset 5건**(wipe+자산 중심 스키마 착지·dry-run 무변경·멱등·wipe 후 즉시 admission 가능·slot-core 테이블 커버리지)
- RabbitMQ-gated: 21 passed (실 브로커)
- 통합(전부 enabled): **405 passed, 10 skipped**(KIS sandbox — 기존 환경 이슈, 본 배치 무관)
- 통합(PG+RabbitMQ enabled): **411 passed, 1 skipped**(KIS sandbox — 기존 환경 이슈, 본 배치 무관)
## 검증 실행 (run-the-app, 자산 중심 e2e)
@@ -45,7 +45,8 @@ test DB(trex_core_test) + 실 RabbitMQ + paper broker + stub universe(2 자산)
## Remaining Risks / Blockers
- **실 cutover 미실행(의도)** — D4: 운영자가 REL 단계에서 리허설 후 `trex-core-cutover --config <instance> --yes` 실행. 사전 백업 + 거래 세션 외 + in-flight 0 필수. 롤백 = 백업 복원 + 직전 리비전.
- cutover carry-over 의 `avg_price=NULL` — 잔고 API 미제공. SL/TP 는 절대가 기준이라 안전 매도 무영향이나, 운영자/전략이 필요 시 후속 갱신.
- **실 DB 재초기화 미실행(의도)** — 운영자가 `trex-core-reset --config <instance> --yes` 실행(파괴적·DB 전역). 사전 백업 필수. 재초기화라 롤백 = 백업 복원.
- 데이터 보존 cutover 폐기로 **기존 보유 포지션은 재초기화 시 소실** — 재초기화 후 브로커 보유는 universe reconcile + `reconcile_core_holdings`(REQ-062)에서 unmanaged 로 표면화되어 운영자가 재편입. 실거래 보유가 있는 DB 라면 재편입 절차를 release 노트에 포함.
- 마이그레이션 009 부분 유니크 인덱스는 legacy 풀 중복 데이터에 적용 불가(이 결함이 cutover→reset 전환의 직접 원인). 자산 중심 DB(신규/재초기화 후)에서는 정상.
- 전략 모듈(trex-orb) 계약 전환: buy `slot_id` 정본(snapshot slots[] round-trip), `trading_date` 키 소멸, 이벤트 payload 변경 — portfolio_id dual-accept 로 무중단이나 전략 측 전환 권고(REL 노트 대상).
- `max_active_slots` 미설정 = 무캡 — 운영 TOML 에 반드시 설정(배포 체크리스트, design §5).
@@ -30,3 +30,4 @@
- Source discovery 단일(dcy-020). BAT-027/028/029 후속, dcy-020 최종.
- **최고 위험**: 라이브 데이터·집행 전환. **실 cutover 는 운영자 실행**(본 배치는 마이그레이션·코드·리허설 제공). design 체크포인트에서 cutover 절차·롤백·운영자 입회·전환 순서 확정 후 구현.
- 본 배치 완료 후 REQ-056~065 confirm-req-implemented → REL.
- 2026-06-10 (CHG-20260610-03): 데이터 보존 cutover → DB 재초기화(`trex-core-reset`)로 전환 (마이그레이션 009 legacy 충돌 결함). 폴더명의 'cutover' 는 역사적 표기로 유지.
@@ -42,3 +42,6 @@
## Notes
- 실 cutover 는 운영자 실행(본 배치는 마이그레이션·코드·리허설 제공). confirm-release 전 cutover 리허설 + run-the-app evidence 필수.
- green 기준: 단위 전체 회귀(literal inactive·drop 무파손) + cutover 리허설(보유 보존·롤백) + 자산 중심 e2e.
## 갱신 (2026-06-10, CHG-20260610-03)
- M4 의 데이터 보존 cutover 도구(`trex-core-cutover`)는 폐기되고 **DB 재초기화 도구**(`trex-core-reset`: slot-core wipe + 마이그레이션 재적용)로 대체. 마이그레이션 009 부분 유니크 인덱스가 legacy 풀 중복 데이터에 적용 불가한 결함이 직접 원인. 보유 carry-over 불요(재초기화 후 reconcile 재편입).
@@ -10,10 +10,10 @@
### REQ-056 (Data — 잔여: trading_date/entry_count drop, 스키마 마감)
| AC | 판정 | Evidence |
|---|---|---|
| AC-1 스키마: portfolio_id NOT NULL·instance_key·UNIQUE(instance_key,portfolio_id)·retired_at·trading_date/entry_count 부재 | **pass** (NOT NULL 은 promote 후) | 마이그레이션 009/010/011 + `test_promote_unique_sets_not_null`(cutover `--promote-unique` 로 NOT NULL 승격 — 공유 DB 전 인스턴스 cutover 후 적용하는 설계, BAT-027 결정); `test_daily_slot_columns_match_expected_contract`(drop 후 컬럼셋 일치) |
| AC-1 스키마: portfolio_id·instance_key·부분 UNIQUE(instance_key,portfolio_id)·retired_at·trading_date/entry_count 부재 | pass | 마이그레이션 009/010/011 + `test_daily_slot_columns_match_expected_contract`(drop 후 컬럼셋 == EXPECTED_SLOT_FIELDS) + `test_reset_wipes_and_lands_asset_centric`(유니크 인덱스·inactive CHECK 존재 확인). ※ portfolio_id NOT NULL 승격은 데이터 보존 cutover 와 함께 폐기 — 자산 중심에서 universe reconcile 이 항상 portfolio_id 를 채우므로 부분 유니크로 충분(CHG-20260610-03) |
| AC-2 EXPECTED_SLOT_FIELDS ↔ information_schema 일치 | pass | `tests/adapters/persistence/test_migration_and_drift.py` 3건 PG 통과 |
| AC-3 (instance_key, portfolio_id) 중복 거부 | pass | partial UNIQUE(009) + `test_universe_reconcile_pg`(ON CONFLICT 멱등, created=0) |
| AC-4 인스턴스 간 행 미혼합 | pass | `test_dispatch_queue_instance_scoped`(집행 큐 격리) + `test_instance_isolation`(reconcile) + cutover `test_instance_isolation_other_instance_untouched` |
| AC-4 인스턴스 간 행 미혼합 | pass | `test_dispatch_queue_instance_scoped`(집행 큐 격리) + `test_instance_isolation`(reconcile) |
### REQ-057 (Interface — 잔여: literal inactive + 별칭 제거)
| AC | 판정 | Evidence |
@@ -31,13 +31,15 @@
| AC-3 core flat/브로커 보유 → WARN·운영자 결정 | pass (BAT-029 기구현; 슬롯 부재로 '격리' 대신 unmanaged WARN — issue #15 무자동조치 결정) | `test_B_broker_holds_unmanaged_warns` |
| AC-4 수량 불일치 → 상태 전이 없음·warning 노출 | pass (BAT-029 기구현; 미러 자동 갱신 없이 WARN — 보수 구현) | `test_C_qty_mismatch_warns_no_state_change` |
### REQ-064 (Migration — cutover + 롤백)
| AC | 판정 | Evidence |
### REQ-064 (Migration → **DB 재초기화로 재정의**, CHG-20260610-03)
원 AC(데이터 보존 cutover)는 마이그레이션 009 부분 유니크 인덱스가 legacy 풀 중복 데이터에 적용 불가한 결함으로 폐기되고, **wipe + 자산 중심 재초기화**(`trex-core-reset`)로 재정의됨. 재정의된 AC 로 매핑:
| AC(재정의) | 판정 | Evidence |
|---|---|---|
| AC-1 보유 N개 → 영구 슬롯 holding 보존(수량 무유실) | **pass (리허설)** | `tests/runtime/test_cutover_rehearsal.py::test_full_rebuild_with_broker_carry_over` — 브로커 qty=12 정본 carry-over(미러 7 아님), 자산 바인딩 보존. ※ avg_price 는 잔고 API 미제공으로 NULL carry(+WARN) — implementation.md 잔여 리스크 |
| AC-2 cutover 후 데몬 회귀 없음(reconcile·admission·safety-sell) | pass | run-the-app e2e(아래) + 단위 367/PG 29 green |
| AC-3 실패 시 롤백 가능 | pass (계획+부분 검증) | 단일 트랜잭션(중단 시 무변경: `test_aborts_on_in_flight_pending`/`test_aborts_on_unmapped_broker_holding` DB 불변 단언) + `test_dry_run_rolls_back`; 전체 롤백 = 백업 복원 + 직전 리비전(design §롤백, 운영 절차) |
| AC-4 instance_key 태깅·스코프 쿼리 정확 | pass | cutover 가 instance_key 로 생성 + `test_instance_isolation_other_instance_untouched` |
| AC-1' 재초기화 시 slot-core 테이블 wipe + 자산 중심 스키마 착지 | pass | `test_reset_wipes_and_lands_asset_centric`(2행 → 0행, 컬럼==EXPECTED, 유니크 인덱스+inactive CHECK 존재) |
| AC-2' 재초기화 후 데몬 회귀 없음(reconcile·admission) | pass | `test_reset_usable_for_admission_after_wipe`(reset 후 reconcile+활성 동작) + run-the-app e2e(아래) |
| AC-3' 안전성: dry-run 무변경 + 멱등 | pass | `test_dry_run_reports_without_wiping`(행 보존) + `test_reset_is_idempotent`(2회차 0행·schema_ok) |
| AC-4' 데이터 보존(보유 carry-over) 폐기 — 보유는 reconcile 로 재편입 | pass(의도된 범위 축소) | CHG-20260610-03; 재초기화 후 브로커 보유는 `reconcile_core_holdings`(REQ-062) unmanaged 경로 |
| (참고) 백업/복원 | 운영 절차 | reset 은 재초기화라 롤백 = 백업 복원. 실행 전 백업 필수(release 게이트) |
### REQ-065 (Documentation — baseline 마감)
| AC | 판정 | Evidence |
@@ -49,16 +51,16 @@
## Evidence
1. **단위 회귀**: `pytest tests` → **367 passed**, ruff `All checks passed` (commit 7d72782 시점).
2. **PG-gated**(실 PostgreSQL `trex_core_test`): **29 passed** — 마이그레이션 001~011 전체 재적용 멱등(`test_apply_migrations_is_idempotent`; 010 CHECK drop-and-add·011 DROP IF EXISTS·008 no-op 가 매 boot 재실행에 안전함을 모든 PG 테스트의 pg_clean 반복 적용으로 입증), 컬럼 드리프트 가드, reconcile/admission/lifecycle, dispatch 인스턴스 격리, ops_checks(transition_log 기반) 3건, **cutover 리허설 8건**.
2. **PG-gated**(실 PostgreSQL `trex_core_test`): **26 passed** — 마이그레이션 001~011 전체 재적용 멱등(`test_apply_migrations_is_idempotent`; 010 CHECK drop-and-add·011 DROP IF EXISTS·008 no-op 가 매 boot 재실행에 안전함을 모든 PG 테스트의 pg_clean 반복 적용으로 입증), 컬럼 드리프트 가드, reconcile/admission/lifecycle, dispatch 인스턴스 격리, ops_checks(transition_log 기반) 3건, **reset 5건**(wipe+자산 중심 착지·dry-run 무변경·멱등·wipe 후 admission·테이블 커버리지).
3. **RabbitMQ-gated**(실 브로커): 21 passed — slot_id 계약 포함 intent RPC e2e dedup.
4. **run-the-app e2e**(test DB + 실 RabbitMQ + paper broker, instance=e2etest, M=1): boot reconcile created=2 → snapshot(slots=2 inactive, available=1) → buy by slot_id admitted → 중복 intent identical → 2번째 자산 capacity_full → fill→holding(available=0) → 동일 슬롯 already_active → sell→fill→**inactive**(qty=None·portfolio_id 보존·available=1) → 동일 영구 슬롯 재매수 admitted. DB 최종행·transition_log·ledger_outbox(completed×3) 일치, 데몬 로그 ERROR/Traceback 0, SIGTERM Normal shutdown. (전 과정 implementation.md 검증 실행 절 기록)
5. **baseline 동기화**(Architecture Impact 有): data-model/runtime-flows/project-structure/interface-contract 4문서 + run-trex-core-daemon 스킬 + instance.example.toml 갱신 — commit 7d72782 포함.
## Blocking Issues
- 없음 (코드/리허설 범위). 단, **실 운영 DB cutover 는 본 배치 산출물 범위 밖**(design D4) — release(REL) 단계에서 운영자가 백업→리허설→`trex-core-cutover --yes`→운영 TOML `max_active_slots` 설정 순으로 수행해야 하며, 그 운영 증거는 release 검증에 귀속된다.
- 없음 (코드/테스트 범위). 단, **실 운영 DB 재초기화는 본 배치 산출물 범위 밖** — release(REL) 단계에서 운영자가 백업→`trex-core-reset --config <instance> --yes`→운영 TOML `max_active_slots` 설정 순으로 수행하고, 그 운영 증거는 release 검증에 귀속된다. 데이터 보존 cutover 폐기로 기존 보유는 재초기화 후 운영자가 재편입한다(REQ-062 경로).
## Result
- 포함 REQ AC 전 항목 evidence 연결 완료(REQ-062 AC-3/4 는 issue #15 무자동조치 결정에 따른 보수 구현 — 의도된 편차로 기록).
- **Ready for Release: true** (배치 산출물 기준 — 코드·마이그레이션·cutover 도구·리허설·baseline. 실 cutover 실행은 REL 단계 운영자 작업으로 release 게이트에 위임)
- 포함 REQ AC 전 항목 evidence 연결 완료. REQ-064 는 데이터 보존 cutover → **DB 재초기화로 재정의**(CHG-20260610-03, 마이그레이션 009 결함 + dev/페이퍼 컨텍스트)되어 재정의 AC 로 검증. REQ-062 AC-3/4 는 issue #15 무자동조치 결정에 따른 보수 구현(의도된 편차).
- **Ready for Release: true** (배치 산출물 기준 — 코드·마이그레이션·reset 도구·테스트·baseline. 실 DB 재초기화 실행은 REL 단계 운영자 작업으로 release 게이트에 위임)