BAT-035 (dcy-025): trex.snapshot.req → trex.slots.req 즉시 교체
- topology: SNAPSHOT_REQ_QUEUE 제거, SLOTS_REQ_QUEUE = "trex.slots.req" 추가
- portfolio.py: View/build_snapshot_envelope/SnapshotEnvelope/_asset_to_dict 제거;
slot_to_dict 시그니처 확장(snapshot_store/watchdog_store/pause_store/watchdog_timeout_sec)
— asset_quantity(hub)/cash_balance/cash_estimated/warned/watchdog{}/paused 병합 (REQ-074)
- messaging_handlers.py: make_snapshot_rpc_handler 제거, make_slots_rpc_handler 추가
— filter(all/inactive/pending/holding/error) + spy(bool) 처리; strategy 필드 제외 (REQ-073/074)
- daemon.py: _snapshot_rpc_loop → _slots_rpc_loop, make_slots_rpc_handler 연결
- cli.py: universe/slots → slots_queue + spy=True + server-side filter; buyable→inactive 매핑 (REQ-063)
- rabbitmq.py: snapshot_queue → slots_queue
- docs: interface-contract.md + runtime-flows.md slots.req 계약으로 업데이트 (REQ-075)
- REQ-028: Implemented → Deprecated (코드 삭제 완료)
- 테스트: test_snapshot_handler/selection/rpc_watchdog/messaging_snapshot_consumer 삭제;
test_slots_handler.py(신규, 13 cases), test_killswitch_masking_resume 재작성,
test_ledger_option_d._apply_cash_estimate → slots handler 경유, test_topology/cli_operator 갱신
BAT-036 (dcy-024): per-instance safety_sell_enabled 플래그
- config.py: DaemonInstanceConfig + DaemonConfig 에 safety_sell_enabled: bool = True 추가;
from_toml 파싱, from_config 전파
- daemon.py: start() workers 조건부 — safety_sell_enabled=false 시 trex-safety-sell 미기동 + WARNING
- tests: test_instance_config.py 에 safety_sell_enabled 파싱 3개 케이스 추가
REQ: 073/074/075/021/034/063/048/005 Approved → Implemented
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 KiB
24 KiB
Software Requirement Specification Index
목적
- 이 문서는 프로젝트의 SRS 운영 기준과 requirement 목록을 관리하는 entry point이다.
- 개별 requirement의 상세 내용은 타입별 폴더 하위
req-XXX_*.md파일에서 관리한다.
사용 방법
- 새로운 requirement가 필요하면
Next Requirement ID를 확인하고docs/srs/req-template.md를 복사해docs/srs/<Type>/req-XXX_<slug>.md파일을 생성한다. - 초안 작성은
draft-req, 승인 전환은confirm-req, 변경 대응은change-req, 구현 완료 전환은confirm-req-implementedskill을 기준으로 수행한다. - 작성 또는 수정 후 누락과 모호성을 점검한다.
- requirement 추가 또는 변경 후
Next Requirement ID,Requirement Register,Recent Change Log Summary를 함께 갱신한다. Proposedrequirement를 승인하려면 승인 준비 상태와 blocker를 점검한다.Approvedrequirement는 구현 이슈나 작업 항목으로 연결한다.- 구현과 검증이 끝난 requirement는
confirm-req-implementedskill로 완료 전환 가능 여부를 점검한다. - requirement 변경 시
change-reqskill을 기준으로 해당 REQ 파일의Change Log를 먼저 갱신한 뒤 본문을 수정한다. - 구현 전에는 관련 REQ 파일과 최근
Change Log를 기준으로 변경 범위를 판단한다.
상태 정의
- Proposed: 초안 상태이며 구현 기준으로 확정되지 않음
- Approved: 구현 기준으로 승인됨
- Implemented: 구현과 검증이 완료됨
- Deprecated: 더 이상 유지하지 않음
Status Transition Evidence
Proposed -> Approved
Status,Type,Priority,Owner,Intent,Requirement,Acceptance Criteria,Impacted Area,Change Log가 모두 존재해야 한다.Type은 아래 분류 도표에서 정확하게 하나로 지정되어야 한다.Acceptance Criteria는 구현 판단에 사용할 수 있을 정도로 구체적이어야 한다.- 미해결 assumption 또는 open question이 있으면
Notes에 명시하고, 승인 blocker 여부를 판단해야 한다. - 승인 전환 시 해당 REQ 파일의
Change Log에 status 변경 사유를 기록해야 한다.
Approved -> Implemented
- 각
Acceptance Criteria에 대해 test, manual verification, 또는 구현 결과 중 최소 1개의 evidence가 있어야 한다. - evidence는 requirement 문서 자체 또는 연결된 구현/검증 결과에서 추적 가능해야 한다.
- 미충족
Acceptance Criteria가 있으면Implemented로 전환하지 않는다. - 구현 완료 전환 시 잔여 리스크와 미검증 영역이 있으면
Change Log에 기록해야 한다. - 상태 전환은
confirm-req-implementedskill을 기준으로 수행한다.
Requirement Change Handling
- 기존 REQ 본문(
Requirement,Acceptance Criteria,Impacted Area)을 수정하기 전에는 새Change Log항목을 만든다. Change Log에는 최소한Acceptance Criteria Delta,Impacted Area Delta,Delivery Trace Delta,Revalidation Impact,Validation Plan이 포함되어야 한다.- 변경이 기존 구현 또는 verification evidence를 무효화하면
Implementedrequirement는Approved로 되돌린다. - 변경이 승인 전제 자체를 다시 검토하게 만들면
Approved또는Implementedrequirement를Proposed로 되돌릴 수 있다. - 상태 되돌림이 발생하면
Requirement Register와Recent Change Log Summary도 함께 갱신한다.
Requirement 타입 분류 도표
| 타입 | 정의 | 예시 |
|---|---|---|
| Configuration | 설정 옵션, 커스터마이징 포인트 | 설정 파라미터, 환경 변수, 옵션 항목 |
| Data | 데이터 구조, 저장/로드, 파일 형식, 스키마 | 설정 파일 형식, DB 스키마, API 구조 |
| Deployment | 배포 방식, 운영 절차, 배포 환경 | 컨테이너 배포, 스택 관리, 운영 가이드 |
| Documentation | 문서 작성, 가이드, 매뉴얼, 안내서 | 사용자 가이드, API 문서, 튜토리얼 |
| Exception | 오류 처리, 예외 복구, 재시도 전략 | 오류 복구, 검증 실패 처리, 폴백 전략 |
| Installation | 시스템 설치, 환경 구성, 초기화 절차 | Docker 이미지 빌드, DB 마이그레이션, 사전 조건 설정 |
| Integration | 외부 시스템 연동, 플러그인, 확장 | 3rd party 연동, 플러그인 인터페이스 |
| Interface | 사용자 상호작용 방식 (UI, API, CLI, 제어방식) | CLI 명령어, API 엔드포인트, 웹 UI 기능 |
| Migration | 데이터 이전, 버전 업그레이드 | 데이터 마이그레이션, 버전 호환성 |
| Non-Functional | 성능, 보안, 확장성, 호환성, 신뢰성 | 성능 목표, 보안 정책, 확장성 |
| Testing | 테스트 전략, QA 요구사항, 검증 방식 | 테스트 커버리지, 회귀 테스트, 수락 기준 |
Requirement 작성 규칙
- 각 requirement는 고유 ID를 가진다. 예:
REQ-001 - 다음 신규 requirement 번호의 source of truth는 이 문서의
Next Requirement ID섹션이다. - 새 requirement를 추가하거나 ID 충돌이 발생할 수 있는 변경을 했으면
Next Requirement ID를 함께 갱신한다. - 각 requirement는
Type을 명시해야 한다. 위 분류 도표 중 정확하게 하나로 선택하며,docs/srs/<Type>/폴더명도 같은 문자열을 사용한다. - 각 requirement는
Intent,Requirement,Acceptance Criteria,Impacted Area를 반드시 포함한다. - 모호한 표현("개선한다", "적절히 처리한다") 대신 관찰 가능하고 test 가능한 문장을 사용한다.
- requirement 변경 사항은 해당 REQ 파일의
Change Log에 기록한다. - requirement 변경 시 영향 받는 batch/release와 재검증 필요 여부를
Change Log에 남긴다. Recent Change Log Summary는 최신 5건만 유지한다.- status 전환은
Status Transition Evidence기준을 따른다.
Next Requirement ID
- Current:
REQ-076 - Rule:
Requirement Register에 있는 가장 큰 REQ 번호보다 정확히 1 커야 한다.
Requirement Register
| ID | Title | Type | Status | Priority | Owner | Link |
|---|---|---|---|---|---|---|
| REQ-001 | trex-core Python 프로젝트 부트스트랩 | Installation | Implemented | High | project maintainers | req-001 |
| REQ-002 | slot 순수 도메인 이식 및 공개 API 확정 | Interface | Implemented | High | project maintainers | req-002 |
| REQ-003 | slot 도메인 단위테스트 이식 및 컬럼 계약 가드 | Testing | Implemented | High | project maintainers | req-003 |
| REQ-004 | baseline 문서 planned→실제 정합 | Documentation | Implemented | Medium | project maintainers | req-004 |
| REQ-005 | 슬롯 코어 데몬 런타임 부트스트랩 | Installation | Implemented | High | project maintainers | req-005 |
| REQ-006 | PostgreSQL SlotRepository 영속화 + 스키마 | Data | Implemented | High | project maintainers | req-006 |
| REQ-007 | intent 제출 HTTP API + 멱등 | Interface | Implemented | High | project maintainers | req-007 |
| REQ-008 | 슬롯 read-only 조회 HTTP API | Interface | Implemented | High | project maintainers | req-008 |
| REQ-009 | 데몬/API/영속화 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-009 |
| REQ-010 | 데몬 설정 .env 파일 로딩 | Configuration | Implemented | Medium | project maintainers | req-010 |
| REQ-011 | BrokerPort 추상화 + paper/stub async 더블 | Integration | Implemented | High | project maintainers | req-011 |
| REQ-012 | KIS Open API 브로커 어댑터 | Integration | Implemented | High | project maintainers | req-012 |
| REQ-013 | 주문 집행 루프 (claim·송신·체결·롤백) | Integration | Implemented | High | project maintainers | req-013 |
| REQ-014 | 주문 핸드오프 durability + reconciliation | Exception | Implemented | High | project maintainers | req-014 |
| REQ-015 | 브로커/집행 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-015 |
| REQ-016 | KIS 인증 토큰 Redis 캐시 | Integration | Implemented | Medium | project maintainers | req-016 |
| REQ-017 | LedgerPort 추상화 + portfolio-hub 어댑터 + stub | Integration | Implemented | High | project maintainers | req-017 |
| REQ-018 | 체결→원장 기록 (집행 루프 fill hook) | Integration | Implemented | High | project maintainers | req-018 |
| REQ-019 | ledger outbox durability + correlation_id 멱등 | Exception | Implemented | High | project maintainers | req-019 |
| REQ-020 | ledger 레이어 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-020 |
| REQ-021 | messaging 토폴로지 + 메시지 계약 매핑 | Integration | Implemented | High | project maintainers | req-021 |
| REQ-022 | messaging transport 포트 + RabbitMQ 어댑터 + stub + sync+thread daemon | Integration | Implemented | High | project maintainers | req-022 |
| REQ-023 | messaging delivery 신뢰성 (effectively-once + durable + DLQ + publisher confirms) | Exception | Implemented | High | project maintainers | req-023 |
| REQ-024 | RabbitMQ 가용성 degrade 정책 (버퍼링 금지 + 보수적 중단 + core 안전 매도 독립) | Non-Functional | Implemented | High | project maintainers | req-024 |
| REQ-025 | HTTP /v1 API 완전 제거 (healthz 포함, HTTP 표면 0) |
Interface | Implemented | High | project maintainers | req-025 |
| REQ-026 | messaging 레이어 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-026 |
| REQ-027 | portfolio-hub read 포트 + 어댑터 + stub | Integration | Implemented | High | project maintainers | req-027 |
| REQ-028 | 종목 스냅샷 read 메시지 계약 + envelope + degraded 신호 | Interface | Deprecated | High | project maintainers | req-028 |
| REQ-029 | 자산 선별(slot overlay) + view 모드 + strategy_key 필터 | Interface | Implemented | High | project maintainers | req-029 |
| REQ-030 | 일일 스냅샷 스케줄러 + 옵션 D 현금/포지션 갱신 | Integration | Implemented | High | project maintainers | req-030 |
| REQ-031 | 포지션 정합 검증 + warning 마스킹 | Exception | Implemented | High | project maintainers | req-031 |
| REQ-032 | 런타임 pause/resume 제어 (+운영자 CLI 표면) | Interface | Implemented | Medium | project maintainers | req-032 |
| REQ-033 | 스냅샷 read 레이어 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-033 |
| REQ-034 | per-slot 워치독 — snapshot RPC 기반 전략 모듈 활성 감지 | Interface | Implemented | High | project maintainers | req-034 |
| REQ-035 | 슬롯 가격 임계값 도메인 필드 + DB 마이그레이션 | Data | Implemented | High | project maintainers | req-035 |
| REQ-036 | 자동 매도 내부 경로 — SlotService.sell + idempotency | Interface | Implemented | High | project maintainers | req-036 |
| REQ-037 | forced_close_at 만기 자동 매도 루프 | Integration | Implemented | High | project maintainers | req-037 |
| REQ-038 | stop-loss·take-profit KIS 가격 polling + 트리거 | Integration | Implemented | High | project maintainers | req-038 |
| REQ-039 | 장 마감 강제 청산 (TREX_MARKET_CLOSE_LIQUIDATION_TIME) | Integration | Implemented | High | project maintainers | req-039 |
| REQ-040 | update_thresholds intent RPC 액션 | Interface | Implemented | High | project maintainers | req-040 |
| REQ-041 | safety-sell 환경 설정 — 5종 env var | Configuration | Implemented | High | project maintainers | req-041 |
| REQ-042 | safety-sell baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-042 |
| REQ-043 | trex.control.req 제어 채널 + action dispatch | Interface | Implemented | High | project maintainers | req-043 |
| REQ-044 | kill-switch day-scoped 제외 store + 마이그레이션 | Data | Implemented | High | project maintainers | req-044 |
| REQ-045 | kill-switch 실행 — 범위별 holding 즉시 청산 + 이력 | Interface | Implemented | High | project maintainers | req-045 |
| REQ-046 | kill-switch 당일 제외 masking + 자동해제 + resume | Interface | Implemented | High | project maintainers | req-046 |
| REQ-047 | kill-switch baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-047 |
| REQ-048 | per-instance TOML 설정 로더 + --config 필수 | Configuration | Implemented | High | project maintainers | req-048 |
| REQ-049 | instance_key 기반 동적 큐명 + default 하위호환 | Interface | Implemented | High | project maintainers | req-049 |
| REQ-050 | trex.direct(topic) + trex.broadcast(fanout) exchange + 바인딩 | Integration | Implemented | High | project maintainers | req-050 |
| REQ-051 | multi-instance topology baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-051 |
| REQ-052 | safety-sell per-slot 재시도 쿨다운 + 영속 거부 경고 | Integration | Implemented | High | project maintainers | req-052 |
| REQ-053 | safety-sell 재시도 쿨다운 env 설정 2종 | Configuration | Implemented | Medium | project maintainers | req-053 |
| REQ-054 | safety-sell 쿨다운 runtime-flows 정합 | Documentation | Implemented | Low | project maintainers | req-054 |
| REQ-055 | closed 슬롯 ↔ ledger_outbox 누락 운영 점검 쿼리 | Exception | Implemented | Medium | project maintainers | req-055 |
| REQ-056 | 자산 영구 슬롯 스키마 재설계 + 마이그레이션 | Data | Implemented | High | project maintainers | req-056 |
| REQ-057 | 자산 영구 슬롯 상태머신 재정의 + 인스턴스 스코프 advisory lock | Interface | Implemented | High | project maintainers | req-057 |
| REQ-058 | universe 기반 슬롯 lifecycle reconcile (생성/soft-retire/tombstone) | Integration | Implemented | High | project maintainers | req-058 |
| REQ-059 | 활성 capacity 제어 + 신호 기반 admission (FCFS·M캡·무치환·over-cap) | Interface | Implemented | High | project maintainers | req-059 |
| REQ-060 | 동시 활성 최대치(max_active_slots) per-instance TOML 설정 | Configuration | Implemented | High | project maintainers | req-060 |
| REQ-061 | intent 계약 자산(portfolio_id) 키 통일 + 중복/무효 규칙 | Interface | Implemented | High | project maintainers | req-061 |
| REQ-062 | 수량 hub 정본+로컬 미러 + holding↔broker/hub 불일치 해소 | Integration | Implemented | High | project maintainers | req-062 |
| REQ-063 | 운영자 표면 단일화 — slots = 자산 포지션 단일 뷰 | Interface | Implemented | Medium | project maintainers | req-063 |
| REQ-064 | 풀 모델 → 자산 중심 DB 재초기화 (구 cutover) | Migration | Implemented | High | project maintainers | req-064 |
| REQ-065 | 자산 중심 모델 baseline 문서 정합 + 풀 모델 폐기 명시 | Documentation | Implemented | Medium | project maintainers | req-065 |
| REQ-066 | 보유 자산 포지션 사이징 — 증액·부분 감액 (수량/avg_price 재계산) | Interface | Implemented | High | project maintainers | req-066 |
| REQ-067 | 포지션 사이징 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-067 |
| REQ-068 | intent 실행 정책 계약 — timeout_sec + slippage_pct | Interface | Implemented | High | project maintainers | req-068 |
| REQ-069 | 주문 timeout 집행 + 취소-체결 race 처리 | Integration | Implemented | High | project maintainers | req-069 |
| REQ-070 | slippage 보호 지정가 집행 | Integration | Implemented | High | project maintainers | req-070 |
| REQ-071 | 운영자 강제 취소 백스톱 (trex-core cancel) | Interface | Implemented | Medium | project maintainers | req-071 |
| REQ-072 | 실행 정책 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-072 |
| REQ-073 | 전략 read 표면 — trex.slots.req RPC 계약 (filter/spy, snapshot.req 즉시 교체) | Interface | Implemented | High | project maintainers | req-073 |
| REQ-074 | 슬롯 단일 행 스키마 — 자산·워치독·overlay 흡수 + 필드별 정본 라벨 | Data | Implemented | High | project maintainers | req-074 |
| REQ-075 | slots read 표면 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | req-075 |
Recent Change Log Summary
- 2026-06-11 :: BAT-035/036 완료 — REQ-073/074/075/021/034/063/048/005 Approved → Implemented, REQ-028 → Deprecated (trex.snapshot.req 코드 삭제·trex.slots.req 대체)
- 2026-06-11 :: REQ-028 Implemented → Deprecated (BAT-035, dcy-025):
trex.snapshot.reqenvelope (assets[]/View/build_snapshot_envelope) 코드 삭제 완료. 후속 표면은 REQ-073/074 (trex.slots.req) 로 대체. - 2026-06-11 :: REQ-073/074/075 신규 생성(Proposed) + REQ-021/034/063 change-req Implemented→Approved + REQ-028 폐기 예정 forward-link (draft-req, dcy-025 전략 read 표면 재설계):
trex.snapshot.req→trex.slots.req즉시 교체 RPC 계약(요청 {filter: status 단일, spy}, 응답 {slots[], degraded/reason/message}, strategy 제외)(REQ-073), 슬롯 단일 행 스키마(asset_quantity hub 정본+qty 미러+warned, cash_balance+cash_estimated, watchdog nested, paused — 필드별 정본 라벨)(REQ-074), baseline 정합(REQ-075). 토폴로지 큐 교체(REQ-021 CHG-01), 워치독 터치=slots.req 기본/spy 무터치·행 흡수(REQ-034 CHG-01), 운영자 CLI 새 표면+spy(REQ-063 CHG-01). REQ-028 은 keep-current + delivery 배치에서 Deprecated 전환(REQ-005 선례). 전략 모듈 lockstep cutover 필요. Next ID: REQ-076. - 2026-06-11 :: REQ-048/005 change-req (dcy-024 safety-sell 비활성화 모드/issue #15, CHG: 048-20260611-01·005-20260611-01): per-instance TOML
safety_sell_enabled: bool=True(env 제외, REQ-048 AC-10) +daemon.start()조건부 워커 게이팅(false 시trex-safety-sell미기동·물리 차단) + 기동 로그no autonomous liquidation경고 + runtime-flows(REQ-005 AC-5/6).ExecutionService·운영자 exit/cancel·kill-switch·전략 sell intent 불변. 모드는 기동 로그만 노출(스냅샷 응답 미포함, OQ-3). 신규 REQ 없음(change-req only, dcy-024 OQ-1). 둘 다 Implemented→Approved, 차기 batch 구현·검증 후 복귀. - 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), snapshotslots[]노출 제거(REQ-028), CLI--capitalargparse 제거 + slots detail 행 제거(REQ-032 AC-8). 외부 발신자(trex-orb-v1) 송신 잔존은 unknown key 무시로 무해(운영자 확인).