# BAT-036 Planning - Status: done - Batch: BAT-036 - Profile: standard ## Included REQ - REQ-048 CHG-20260611-01: DaemonInstanceConfig.safety_sell_enabled: bool=True, from_toml/from_config 파싱, DaemonConfig 전파 (AC-10) - REQ-005 CHG-20260611-01: daemon.start() 조건부 workers — safety_sell_enabled=False 시 trex-safety-sell 제외 + RUNNING 로그 + 경고 로그 (AC-5/6) ## Delivery Plan ### M1: config.py — DaemonInstanceConfig 필드 추가 - `trex_core/runtime/config.py:DaemonInstanceConfig` 에 `safety_sell_enabled: bool = True` dataclass 필드 추가 - `from_toml()`: `data.get("safety_sell_enabled", True)` 파싱 - `DaemonConfig.from_config()`: DaemonConfig 생성 시 inst.safety_sell_enabled 전파 ### M2: daemon.py — start() 조건부 workers - `trex_core/runtime/daemon.py:328~337` workers 리스트 구성 부분에서 조건 분기: ```python if self._config.safety_sell_enabled: workers.append(("trex-safety-sell", self._safety_sell_loop)) else: logger.warning("safety_sell disabled — trex-safety-sell worker not started") ``` - RUNNING 로그(기존 구조 안에서)로 비활성 상태 가시화 ### M3: 테스트 - config 파싱: TOML `safety_sell_enabled=false` → False; 키 부재 → True - daemon start: safety_sell_enabled=False → trex-safety-sell 스레드 미기동 단언 - AC-6: ExecutionService/exit/cancel/kill-switch 경로는 이번 M1~M2 변경으로 건드리지 않음(회귀 테스트로 확인) ## Dependencies - Internal: DaemonConfig 내 DaemonInstanceConfig 전파 경로(from_config → DaemonInstanceConfig.from_toml) - External: 없음 ## Design Gate - Design Required Before Implementation: **yes** - Reason: DaemonConfig ↔ DaemonInstanceConfig 전파 경로와 daemon.start() workers 리스트 수정 지점을 design.md 에 먼저 확정해 구현 오류를 방지. ## 위험 요소 - R-1 (absent=true 누락): from_toml 에서 get 기본값을 False 로 잘못 설정하면 기존 인스턴스 동작 파괴 → 단위 테스트로 absent→True 확인 - R-2 (DaemonConfig 전파): DaemonConfig 에 safety_sell_enabled 를 전달하지 않으면 daemon.start() 에서 참조 실패 → M1 에서 전파 경로를 먼저 확인 ## 검증 계획 (요약) - TOML 파싱: present=false→False, present=true→True, absent→True - daemon.start() workers: False → trex-safety-sell 제외, True → 포함 - 다른 워커(trex-execution 등) 영향 없음 - 전체 suite green