feat(rel-006): dcy-022/023 + BAT-032~034 — 실행 정책·qty 검증·allocated_capital 제거 통합

BAT-032 (dcy-022): timeout_sec/slippage_pct 실행 정책, 미체결 자동 취소,
보호 지정가, `trex-core cancel` 백스톱. 마이그레이션 012.
BAT-033: `trex-core enter --qty` 필수 검증 — 미지정 시 RPC 전 즉시 오류.
BAT-034 (dcy-023): allocated_capital 죽은 필드 전 경로 제거 (domain·intent·
persistence·snapshot·CLI). 마이그레이션 013(비가역 DROP). 외부 발신자
unknown key 무시 수신 의미론 적용.
REL-006 confirmed: BAT-026~034 통합 릴리즈, pre-release smoke 증거 포함.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 07:42:03 +09:00
co-authored by Claude Sonnet 4.6
parent 5ee5f7f4e2
commit fb05a73130
56 changed files with 3151 additions and 103 deletions
+11 -6
View File
@@ -74,7 +74,7 @@
## Next Requirement ID
- Current: `REQ-068`
- Current: `REQ-073`
- Rule: `Requirement Register`에 있는 가장 큰 REQ 번호보다 정확히 1 커야 한다.
## Requirement Register
@@ -148,11 +148,16 @@
| REQ-065 | 자산 중심 모델 baseline 문서 정합 + 풀 모델 폐기 명시 | Documentation | Implemented | Medium | project maintainers | [req-065](./Documentation/req-065_asset-centric-baseline-alignment.md) |
| REQ-066 | 보유 자산 포지션 사이징 — 증액·부분 감액 (수량/avg_price 재계산) | Interface | Implemented | High | project maintainers | [req-066](./Interface/req-066_position-sizing-resize.md) |
| REQ-067 | 포지션 사이징 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | [req-067](./Documentation/req-067_position-sizing-baseline-alignment.md) |
| REQ-068 | intent 실행 정책 계약 — timeout_sec + slippage_pct | Interface | Implemented | High | project maintainers | [req-068](./Interface/req-068_execution-policy-intent-contract.md) |
| REQ-069 | 주문 timeout 집행 + 취소-체결 race 처리 | Integration | Implemented | High | project maintainers | [req-069](./Integration/req-069_order-timeout-execution.md) |
| REQ-070 | slippage 보호 지정가 집행 | Integration | Implemented | High | project maintainers | [req-070](./Integration/req-070_slippage-limit-price-execution.md) |
| REQ-071 | 운영자 강제 취소 백스톱 (trex-core cancel) | Interface | Implemented | Medium | project maintainers | [req-071](./Interface/req-071_operator-cancel-pending-backstop.md) |
| REQ-072 | 실행 정책 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | [req-072](./Documentation/req-072_execution-policy-baseline-alignment.md) |
## Recent Change Log Summary
- 2026-06-10 :: REQ-057/061/062/066/067 → Implemented (confirm-req-implemented, BAT-031 dcy-021 포지션 사이징): 보유 슬롯 증액(holding→pending_buy, avg_price 가중평균)·부분 매도(min(주문,잔고), 잔량 holding/전량 inactive, cost basis)·부분 체결 실제만 반영. 수량 정본=브로커 잔고 재동기화. 단위 378/통합 422 passed + 사이징 e2e green. BAT-031 release-candidate.
- 2026-06-10 :: REQ-057/061/062 change-req (dcy-021 포지션 사이징, CHG: 057-03/061-04/062-03): Implemented→**Approved** 되돌림(신규 동작 미구현, dcy-021 배치에서 재구현·confirm-req-implemented 로 복귀). REQ-057 상태머신에 `holding→pending_buy`(증액) 전이 추가·부분 매도 잔량 pending_sell→holding 명시, REQ-061 사이징 intent(증액 매수/부분 매도, 명령형 qty+price·core 미저장) 추가, REQ-062 부분 매도 집행 수량=min(intent,브로커잔고)·부분 체결 실제만 ledger·미추적. REQ-066/067(신규)이 end-to-end·baseline 소유.
- 2026-06-10 :: REQ-066~067 신규 생성(Proposed) (draft-req, dcy-021 포지션 사이징/issue #1, dcy-020 OQ-4 후속): 보유 자산 슬롯의 holding 유지 수량 조정. REQ-066(Interface — 증액 HOLDING→PENDING_BUY→HOLDING qty 누적·avg_price 가중평균 / 부분 감액 잔량 holding·전량 inactive·cost basis 유지 / 부분 체결 실제만 반영·미추적), REQ-067(Documentation — baseline 4문서 정합). 명령형 계약(전략이 cash+quantity 로 qty+price 계산·전송, core 미저장)·정수 주식 수+가격(OQ-1/2), avg_price 가중평균·실현손익 hub(OQ-3), intent 당 1회(OQ-4). 기존 Implemented 계약 REQ-057(상태머신)·REQ-061(intent)·REQ-062(수량)은 change-req 로 확장 동반. 전부 **Proposed**(confirm-req 대기). (draft-req)
- 2026-06-10 :: REQ-056~065 신규 생성(Proposed) (draft-req, dcy-020 자산 중심 슬롯 모델 재설계): 익명 슬롯 풀 → portfolio-hub universe 자산과 1:1 **영구 슬롯** + 동시 활성(M) 제어로 substrate 전환. REQ-056(영구 슬롯 스키마·UNIQUE(instance_key,portfolio_id)·trading_date/entry_count 제거), REQ-057(상태머신 inactive↔pending_buy↔holding↔pending_sell·holding 로컬·인스턴스 스코프 lock), REQ-058(universe reconcile 생성/soft-retire/tombstone·degrade 보류·일일 preallocation 폐기), REQ-059(FCFS·M캡·무치환·over-cap), REQ-060(max_active_slots per-instance TOML), REQ-061(intent 자산 키 통일·sell-by-slot_id 폐기), REQ-062(수량 hub 정본+미러·청산 브로커·불일치 해소), REQ-063(slots 단일 뷰), REQ-064(풀→영구 cutover), REQ-065(baseline 정합·폐기 명시). 기존 REQ-002/003/005/006/007/048 등은 폐기/재정의 change-req 동반 예정. 단계적 배치(스키마·상태머신 → reconcile·admission → intent·수량·CLI → cutover) delivery. 전부 **Proposed**(confirm-req 대기). (draft-req)
- 2026-06-09 :: REQ-048/010 change-req→Implemented (CHG-20260609-01/02, trex-orb-v1 설정 관리 정합, BAT-026): config 디렉터리 기반 설정 관리 도입 — `--config` 를 이름으로 해석 + `--config-path <dir>`(기본 `./config`) + `resolve_config_toml`(슬래시 포함 값은 하위호환 명시 경로)(REQ-048), `.env` 를 config-dir 결정적 해석(`--env-file` 우선, 없으면 `<config_dir>/.env`, CWD 무관)으로 변경 + `config/.env.example` + `.gitignore` `config/*` 허용목록(REQ-010). 운영자 CLI 도 `--config-path`/`--env-file` 동일 적용. `from_env()` legacy 루트 `.env` 폴백 유지로 완전 하위호환(`.env` 이동은 운영 배포 시 무중단). batch-lite(BAT-026) 단위 23 + 전체 375 passed, ruff clean, 라이브 스모크(name·path 동일 결과) → 둘 다 **Implemented**. (change-req/confirm-req-implemented)
- 2026-06-11 :: REQ-068~072 + REQ-013/061(CHG) → Implemented (confirm-req-implemented, BAT-032 dcy-022 실행 정책): timeout_sec·slippage_pct intent 계약·슬롯 lifecycle(REQ-068), timeout 초과 자동 취소·cancel-fill race(REQ-069), slippage 보호 지정가 dispatch(REQ-070), 운영자 `trex-core cancel` 백스톱(REQ-071), baseline 정합(REQ-072), 집행 루프 확장(REQ-013 CHG-03)·intent 필드 추가(REQ-061 CHG-05). BAT-032 verification — 신규 71 tests, 425 passed 회귀 없음, Blocking Issues 없음.
- 2026-06-10 :: REQ-002/006/007/028/032 → Implemented (confirm-req-implemented, BAT-034 dcy-023 allocated_capital 제거): 도메인(Slot/EXPECTED_SLOT_FIELDS)·intent(BuyIntent·수신 무시)·영속(마이그레이션 013 drop + flat 매핑)·snapshot(slots[])·CLI(--capital argparse 거부) 전 경로 제거. 테스트 DSN 013 멱등 round-trip + 컬럼 부재, 428 passed + PG 21 passed + ruff clean, grep 전수 0건. BAT-034 release-candidate. release 시 사전 백업·롤백 절차 필수(비가역 drop).
- 2026-06-10 :: REQ-002/006/007/028/032 change-req (dcy-023 allocated_capital 죽은 필드 제거/issue #22, CHG: 002-02/006-02/007-02/028-01/032-07): 전부 Implemented→**Approved** 되돌림(dcy-023 batch 재구현 대기). Slot 모델·`EXPECTED_SLOT_FIELDS` 필드 제거(REQ-002), `daily_slot` 컬럼 drop 마이그레이션 013 + flat 매핑(REQ-006, 코드 배포와 동시 적용·사전 백업), buy intent payload 즉시 제거·수신 무시(REQ-007), snapshot `slots[]` 노출 제거(REQ-028), CLI `--capital` argparse 제거 + slots detail 행 제거(REQ-032 AC-8). 외부 발신자(trex-orb-v1) 송신 잔존은 unknown key 무시로 무해(운영자 확인).
- 2026-06-10 :: REQ-032 CHG-20260610-06 → Implemented (confirm-req-implemented, BAT-033 batch-lite): `trex-core enter` `--qty` 미지정 시 RPC 호출 전 즉시 rc=1 반환(AC-7). `_cmd_enter` 상단 qty guard 추가, 기존 enter 테스트 --qty 보완 + AC-7 신규 테스트. 426 passed, 0 failed.
- 2026-06-10 :: REQ-068~072 신규 생성(Approved) + REQ-013/061 change-req Implemented→Approved (draft-req + confirm-req, dcy-022 실행 정책/issue #21): intent 실행 정책(timeout_sec·slippage_pct) 계약(REQ-068), timeout 집행·race(REQ-069), slippage dispatch(REQ-070), 운영자 cancel 백스톱(REQ-071), baseline 정합(REQ-072). REQ-061 CHG-05(timeout_sec/slippage_pct 필드 추가), REQ-013 CHG-03(timeout 취소·slippage dispatch 집행 루프 확장) → 둘 다 Implemented→Approved(BAT-032 재구현 대기). Next ID: REQ-073.