copilot-swe-agent[bot] and genichin
c73e382b70
Merge remote-tracking branch 'origin/main' into copilot/feat-reconcile-unmanaged-position-durable-lifecycl
...
# Conflicts:
# .proofline/criteria/ac-0029.md
# .proofline/identities.json
# tests/adapters/persistence/test_migration_and_drift.py
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-13 02:53:22 +00:00
copilot-swe-agent[bot] and genichin
591db7adb7
Fix unmanaged reconciliation review blockers
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-13 02:21:37 +00:00
genichin
3cb0fdc303
Merge pull request #90 from fourblocks2020/copilot/bug-ledger-shared-outbox-consumption
...
Isolate ledger outbox delivery by instance and add lease-based claims
2026-09-13 10:48:57 +09:00
copilot-swe-agent[bot] and genichin
be2e73a2d6
fix: harden unmanaged position lifecycle writes
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:31:32 +00:00
copilot-swe-agent[bot] and genichin
5a13c0494b
fix: guard unmanaged resolution on authoritative balances
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:29:45 +00:00
copilot-swe-agent[bot] and genichin
f2b825e720
test: cover unmanaged position lifecycle flow
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:27:12 +00:00
copilot-swe-agent[bot] and genichin
09b1b4f4c3
fix: isolate ledger outbox delivery by instance
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:24:58 +00:00
copilot-swe-agent[bot] and genichin
fe51d211d9
feat: persist unmanaged position lifecycle state
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:24:51 +00:00
copilot-swe-agent[bot] and genichin
45a5e4157d
fix: preserve multi-cause reconcile warnings and align slot blocking
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-12 13:22:40 +00:00
copilot-swe-agent[bot] and genichin
65df10542b
fix(execution): KIS child cancel identity binding, sanitized logging, PG cancel SQL tests
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 12:06:45 +00:00
copilot-swe-agent[bot] and genichin
f0ac909958
fix(execution): cancel SQL nullable type error, KIS child cancel detection, worker exception logging
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-09-01 03:33:38 +00:00
copilot-swe-agent[bot] and genichin
5dd3d57f86
test: harden reconcile warning alarm coverage and daemon wiring assertion
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-26 04:21:17 +00:00
copilot-swe-agent[bot] and genichin
a9e88f9770
feat(intents): emit warn alarm on first reconcile_warned rejection
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-26 04:19:14 +00:00
copilot-swe-agent[bot] and genichin
169f222042
fix: tighten ledger skip CLI auditing
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 13:42:47 +00:00
copilot-swe-agent[bot] and genichin
48dfc3e76f
fix: harden skipped ledger resolution paths
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 13:38:04 +00:00
copilot-swe-agent[bot] and genichin
76cde2edd0
feat: persist skipped ledger fills
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 13:23:06 +00:00
copilot-swe-agent[bot] and genichin
3e74d35299
test: validate ledger backfill flow
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 10:25:35 +00:00
copilot-swe-agent[bot] and genichin
e2c4bbba34
feat: add ledger backfill command
...
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com >
2026-08-24 10:24:05 +00:00
jordan
0266992238
feat: add bounded KIS account read recovery
2026-07-29 17:40:01 +09:00
Hermes Agent
81a853a314
feat(reconcile): safely seed canonical cost basis
2026-07-17 09:57:08 +09:00
Hermes Agent
216e462df4
fix(broker): enforce operator broker truth boundary
2026-07-15 08:07:21 +09:00
genichin and Claude Opus 4.8
51cc3ccb09
fix(cli): verify 명령 ImportError 핫픽스 — make_broker→_build_broker
...
운영 배포 스모크(REL-010 STEP2)서 trex-core verify가 ImportError(make_broker 부재)로 실패.
_cmd_verify가 존재하지 않는 trex_core.adapters.broker.make_broker를 import하던 것을
_cmd_sync와 동일한 trex_core.runtime.daemon._build_broker로 교체. 회귀 테스트 2개 추가.
747 passed/회귀 0. CLI 전용, trading/wire 무관.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-30 13:30:07 +09:00
genichin and Claude Sonnet 4.6
e4e5c70422
feat(bat-053): 그날-시작 KIS 인증정보 fetch + fail-safe 로드 (REQ-112~115)
...
REQ-112: BrokerCredentialPayload/TradingContext 데이터클래스 + PortfolioHubReadPort.fetch_broker_credential() 포트 메서드 + hub_read 어댑터(_fetch_user_info 헬퍼 추출) + stub_read 결정론 stub
REQ-113: DaemonInstanceConfig/DaemonConfig.credential_fetch_enabled opt-in(기본 False) + TOML 파싱 + break-glass(TREX_KIS_BROKER_BREAK_GLASS) 감지
REQ-114: SnapshotScheduler._maybe_fetch_credential() — fail-closed 3조건(unavailable/broker-null/trading_disabled) + CRITICAL 알람 DAY_START_LOAD_FAILED + IntentService entry_allowed_fn 게이트(BuyIntent 차단, SellIntent 통과)
REQ-115: 그날 고정 캐시(_cached_credential/_credential_date) — 동일 날짜 재fetch 방지 + app_secret 메모리 한정(Redis 미기록)
스텁 기반 구현: 실 portfolio-hub/네트워크 없이 AC 전부 단위 테스트.
회귀: credential_fetch_enabled=False(기본) 경로 byte-for-byte 보존.
745 passed, 47 skipped (0 failed).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-28 11:00:18 +09:00
genichin and Claude Sonnet 4.6
d3e4af59cf
fix(bat-052): CHG-20260626-02 보정 — buy_fee_only_assets 제거 + NFR-2 엄격화
...
portfolio-hub WAC가 매수 fee를 cost basis에 편입함에 따라(REQ-110 change-req)
이중계상을 방지하기 위해 buy_fee_only_assets 관련 로직을 전면 제거하고,
일중 닫힌 거래 AC-2 단언을 엄격 동치(realized_pnl_wac == realized_pnl)로 강화.
변경:
- OperatorReport.buy_fee_only_assets 필드 제거
- apply_wac_to_report buy_fee_only_assets 인자 제거
- buy_fee_by_asset 헬퍼 함수 제거
- render_text 매수전용 수수료 섹션 제거
- render_json buy_fee_only_assets 필드 제거 (WAC 필드 4개→3개)
- cli.py: buy_fee_by_asset import/사용 제거, 미사용 'from datetime import date, timedelta' 제거
- test_wac_equals_net_when_same_day_buy_sell: WAC 957.0, 엄격 동치 단언
- test_buy_only_assets_has_fee → test_buy_only_asset_no_fee_line (fee 라인 없음)
- test_render_json_has_all_four_wac_fields → test_render_json_has_three_wac_fields
- 동일 CLI 통합 테스트 보정
결과: 717 passed, 47 skipped
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-26 20:35:17 +09:00
genichin and Claude Sonnet 4.6
73d3b35ab2
feat(bat-052): WAC 실현손익 리포트 통합 (REQ-109/110/111, dcy-035)
...
- portfolio.py: RealizedPnlItem/RealizedPnlResult 데이터클래스 추가;
PortfolioHubReadPort에 get_realized_pnl 포트 메서드 추가
- hub_read.py: GET /v1/portfolios/{id}/pnl/realized 어댑터 구현
(from/to/symbol query, 비2xx/네트워크→PortfolioHubUnavailableError)
- stub_read.py: get_realized_pnl 고정 결과 stub 추가 (무네트워크)
- operator_report.py: OperatorReport에 WAC 4필드+degrade 2필드 추가;
apply_wac_to_report/buy_fee_by_asset 헬퍼; render_text/render_json WAC 섹션
- cli.py: _cmd_report에 WAC 경로(portfolio-hub 설정 시) + degrade 경로 통합
(REQ-111: base_url 미설정/Unavailable → 식별가능 에러, 폴백 없음)
- tests: 51개 신규 테스트 (domain sweep, hub_read, stub_read, operator_report,
cli_report_wac); 전체 717 passed, 47 skipped
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-26 20:35:17 +09:00
genichin and Claude Opus 4.8
07b393d27d
feat(core-B): 운영자 sync/verify CLI + cold-start onboarding (BAT-051, REQ-105/106, PR #32 )
...
dcy-034 마지막 조각. sync(슬롯 qty←브로커+warning해제+OQ-A 전이엣지+FR-7 평단seed)/verify(C 재대조·강제해제없음). core-A QC minor 2건 정리 동봉. QC(opus) PASS, 683 passed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-26 09:53:49 +09:00
genichin and Claude Opus 4.8
d8d9021260
feat(execution,obs): 호가단위 스냅(dcy-030/#28) + 운영 관측성(dcy-029/#29) + REL-007 환류
...
dcy-030 (issue #28 , P0 체결 복구):
- REQ-083 KRX 호가단위(tick) 순수 유틸 (domain/pricing.py)
- REQ-070 CHG: 슬리피지 실효가 호가단위 스냅 — 상한 준수(매수 floor/매도 ceil)
+ band<1tick 하한/상한 보장 + 부동소수 epsilon 가드. 147700→148400/54500→54700.
- BAT-044 release-candidate
dcy-029 (issue #29 , 운영 관측성):
- REQ-084 구조화 로깅 기반 (runtime/logging_setup.py): ISO8601 KST·레벨·Loki JSON
·correlation id(slot_id)
- REQ-085 주문 결과 로깅 (event=order_submit|fill|reject)
- REQ-087 거부 ERROR 가시성 (조용한 롤백 제거)
- REQ-086 청산 reason+actor 동반 노출 (안전망/전략 구분, 신규 필드 없음)
- REQ-088 운영 조회 CLI report (application/operator_report.py, 보유·오늘 체결
·실현 PnL net·대기, direct-DB)
- REQ-089 운영자 런북 docs/operations.md
- REQ-090 baseline 정합 (runtime-flows·project-structure·interface-contract)
- BAT-045(P0)·BAT-046(P1) release-candidate
REL-007: confirmed → feedback-captured (운영 인스턴스 라이브 검증 + #28/#29 환류
정규화). BAT-037~041 released.
검증: 537 passed, 47 skipped, 회귀 0, ruff clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 13:19:31 +09:00
genichin and Claude Sonnet 4.6
6786ffd05d
docs(discovery): dcy-027 모든 OQ Answered — 중장기 슬롯 운영 결정 완료
...
OQ-1: (a′) 기존 슬롯 도메인 유지 + 운영 프로파일/규칙 추가 (PositionBook 불필요)
OQ-2: safety_sell_enabled=false → 코어 손절매 루틴 없음, 전략 모듈 전적 책임
OQ-3: per-instance watchdog_timeout_sec 연장 (1800s 이상 권장), 알림은 후속 Discovery
OQ-4: 중장기 전략 폴링 주기 최소 1분·최대 10분
feat(bat-041): REQ-076/077/078 — watchdog timeout TOML + 중장기 운영 프로파일 + baseline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-12 22:19:33 +09:00
genichin and Claude Sonnet 4.6
24a6017457
fix(reconcile): symbol을 슬롯 생성 시 함께 저장 + NULL 슬롯 backfill
...
reconcile_universe 시그니처를 set[str] → dict[str, str] (portfolio_id→symbol)로 변경.
기존 symbol=NULL 슬롯은 다음 reconcile 실행 시 자동 backfill.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-11 21:08:46 +09:00
genichin and Claude Opus 4.8
f0ad37747b
feat(rel-007): dcy-025/024 + BAT-035/036 — slots.req 즉시 교체 + safety_sell_enabled
...
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 >
2026-06-11 14:45:45 +09:00
genichin and Claude Sonnet 4.6
fb05a73130
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 >
2026-06-11 07:42:03 +09:00
genichin and Claude Opus 4.8
d334f34215
feat(cli): trex-core slots 에 --symbol/--slot-id 필터 + 필터 시 상세 출력
...
운영자 CLI 의 slots 조회 편의: --symbol, --slot-id 클라이언트 측 필터(--status 와
조합 가능) 추가. 두 필터 중 하나라도 주면 한 줄 요약 대신 슬롯 상세 블록
(status/symbol/portfolio_id/qty/avg_price/limit/allocated_capital/strategy_id/
sell_strategy_id/forced_close_at/universe_detached, holding 이면 watchdog)으로 출력.
필터 없으면 기존 terse 테이블 유지(무회귀).
구조/계약/런타임 흐름 영향 없는 표시 기능. tests/runtime/test_cli_operator.py
필터 4건 추가(24 passed), ruff clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-10 16:55:24 +09:00
genichin and Claude Opus 4.8
c04fd276b3
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 >
2026-06-10 16:08:05 +09:00
genichin and Claude Opus 4.8
7d727824dc
feat(slot): BAT-030 — 자산 중심 cutover 완성 (dcy-020 BAT-δ, REQ-056·057·062·064·065)
...
M1 literal inactive 전면화: SlotState 5-state(idle/closed 별칭 제거),
마이그레이션 010(CHECK 교체+행 rewrite), ops_checks 를 transition_log 기반 재작성.
M2 집행 매도 수량 브로커 정본(D3): dispatch 매도 qty=broker hldg_qty,
미러 fallback 없음, 브로커 0 → skip+WARN, 리스트 기반 dispatch(head-block 방지).
M3 컬럼 drop + legacy pool 제거: 마이그레이션 011(trading_date·entry_count DROP),
repo 계약 instance 스코프 개편(집행 큐 포함), preallocation 폐기(데몬 7스레드),
admission 자산 중심 단일 경로(slot_id 정본), capacity 재정의(available=M−active),
daily_symbol_entries 코드 경로 제거.
M4 cutover 도구(D1·D4): trex-core-cutover(전체 rebuild, preflight/브로커 carry-over/
--allow-unmapped/--promote-unique/dry-run) + PG 리허설 테스트 8건.
M5 baseline 마감: data-model/runtime-flows/project-structure/interface-contract
자산 중심 최종 갱신 + run-trex-core-daemon 스킬 정합.
검증: 단위 367 passed + ruff clean; PG-gated 29 passed(010/011 round-trip·드리프트
가드·cutover 리허설); RabbitMQ 21 passed; run-the-app e2e(test DB+실 MQ, M=1):
reconcile 슬롯 생성→slot_id 매수→dedup→capacity_full→fill→already_active→
매도→inactive(자산 바인딩 보존)→영구 슬롯 재활성 전 구간 green.
실 cutover 는 운영자 실행(REL 단계, D4).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-10 15:16:15 +09:00
genichin and Claude Opus 4.8
8b2c26c04c
feat(config): config 디렉터리 기반 설정 관리 (--config-path/--env-file, trex-orb-v1 정합, BAT-026)
...
REQ-048/010 change-req. `--config` 를 이름으로 해석 + `--config-path <dir>`
(기본 ./config) + resolve_config_toml(슬래시 포함 값은 하위호환 명시 경로).
`.env` 를 config-dir 결정적 해석(--env-file 우선, 없으면 <config_dir>/.env,
CWD 무관) + config/.env.example + .gitignore config/* 허용목록. 운영자 CLI 도
--config-path/--env-file 동일 적용. from_env() legacy 루트 .env 폴백 유지로
완전 하위호환.
단위 23 + 전체 375 passed, ruff clean, 라이브 스모크(name·path 동일).
REQ-048/010 → Implemented.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-09 23:45:08 +09:00
genichin and Claude Opus 4.8
1cbbb89091
feat(cli): enter --forced-close-at 시간 기반 자동청산 옵션 (issue #17 , BAT-024)
...
trex-core enter 에 --forced-close-at <ISO8601>(절대시간) 옵션 추가.
지정 시 buy intent payload 의 기존 forced_close_at 에 매핑(계약·도메인·
forced-close 루프 REQ-037 불변, CLI 노출 갭만 보완). 잘못된 형식은 제출
전 거부, 미지정 시 미포함(하위호환). 상대시간 옵션은 미채택.
REQ-032 change-req(CHG-20260609-01/02) → BAT-024(batch-lite) →
Implemented. 단위 353 passed, ruff clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-09 13:10:21 +09:00
genichin and Claude Opus 4.8
63da87c9b3
fix(cli): BAT-022 slots 명령이 universe 대신 실제 슬롯 상태 표시 (dcy-016 후속)
...
`trex-core slots` 가 snapshot RPC 의 universe `assets`(portfolio)를 슬롯 상태로
오인 표시하던 갭 정정. snapshot envelope 이 슬롯 상태를 운반하지 않아 발생
(10개 슬롯인데 universe 1개·status 없음 — BAT-007 HTTP 슬롯 read 제거 후
슬롯 상태 read 표면 부재가 근인).
- REQ-028 (CHG-20260608-01): snapshot envelope 에 read-only per-slot `slots[]`
additive 추가(AC-4). strategy `assets[]`(universe, no-price) 불변.
- REQ-032 (CHG-20260608-03): `_cmd_slots` 가 envelope `slots[]`(실제 슬롯 상태)
표시 + `--status` 를 슬롯 status 기준 client-side 필터 + watchdog 결합.
`universe` 는 `assets[]` 유지. `universe --json` 도 universe 데이터로 scope.
- canonical `portfolio.slot_to_dict` 단일화 — BAT-007 stub / BAT-008 envelope
두 경로가 동일 슬롯 스키마(외부명 `entry_price` 유지, dcy-012 호환).
- interface-contract 에 `slots[]` 계약 + `assets[]` vs `slots[]` 구분 반영.
검증: 단위 338 passed + ruff clean + 신규 코드 데몬으로 실 PostgreSQL/RabbitMQ
운영 재현 PASS(slots=10·status·DB 일치·universe 분리·비침습). REQ-028/032
Implemented, BAT-022 release-candidate. pytest 인프라 게이트는 Human Approval
Memo 수용(운영 재현이 실 경로 커버).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 19:54:42 +09:00
genichin and Claude Opus 4.8
a570ac659e
fix(daemon): buy 심볼 resolver 결함 수정 + REL-004 draft (운영자 run 증거)
...
REL-004(미릴리즈 BAT-014~021 통합) draft-release 작성. confirm-release 전
운영자 프로그램 run-the-app 검증(실 데몬 + trex-core CLI e2e)을 수행했고,
369 passed 가 놓친 실 프로덕션 버그를 검출·수정했다.
- fix(REQ-007 CHG-20260608-03): Daemon._resolve_symbol 이 SnapshotAsset.symbol
(없는 속성)을 접근 → 데몬 buy admission 매 요청 AttributeError → intent RPC
타임아웃(실 데몬 매수 전면 불능). asset.item.symbol 로 수정. 단위 테스트가
stub resolver 를 주입해 실 배선을 한 번도 실행하지 않아 미검출이었음
- test: tests/runtime/test_daemon_resolve_symbol.py — 실 Daemon._resolve_symbol
× 실 SnapshotStore 회귀 가드(수정 전 실패하는 테스트)
- docs(release): rel-004 draft(app-service, BAT-014~021) + Pre-Release Run
Evidence(데몬 기동 + universe/slots/enter/exit e2e + ledger completed +
버그 검출·수정 + LIVE 미검증 한계) + releases/index REL-004 행
검증: 실 데몬 재기동 후 buy/sell e2e admitted→체결→closed + ledger completed,
단위 337 passed, ruff clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 17:38:34 +09:00
genichin and Claude Opus 4.8
6d7bca1460
feat(safety-sell): dcy-017 워치독 소유권 가시화 — snapshot 상태 + 발동 로깅 (BAT-021)
...
전략 이탈로 슬롯이 내부 청산 루틴(워치독) 소유로 넘어간 상태가 무성이라
운영자가 인지할 수 없던 문제(issue #12 )를 가시화한다.
거버넌스: 전부 change-req (신규 REQ 없음, dcy-017 OQ-3; Redis 미채택).
- REQ-034/021: WatchdogStore.last_seen + snapshot RPC 응답에 holding 슬롯
워치독 상태(expired/last_seen) read-only 동봉(best-effort)
- REQ-032: trex-core slots 가 expired 슬롯을 WATCHDOG-OWNED(전략 이탈) 표시
- REQ-037/038/039: safety-sell 워치독 소유 진입(WARN)/이탈(INFO) + 발동
(forced_close·stop_loss=WARN, take_profit·market_close=INFO) 로그 +
in-process 카운터(SafetySellService.counters), 구조화 필드(slot_id/
portfolio_id/reason/phase/instance_key). per-tick 스킵은 카운터만
- REQ-042: runtime-flows/interface-contract 정합
best-effort 격리(NFR-1): 모든 가시화는 예외 격리 — 워치독 판정·청산 불변.
dcy-016 억제 읽기로 관측이 워치독을 리셋하지 않음(비침습).
검증: 단위 335 passed/34 skipped, 인프라 게이트(PG+RabbitMQ) 369 passed, ruff clean.
신규 test_safety_sell_visibility(6) + snapshot watchdog(1) + CLI(1). BAT-021 rc.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 17:10:26 +09:00
genichin and Claude Opus 4.8
d09b93195f
feat(cli): dcy-016 운영자 CLI 확장 (universe/slots/enter/exit) + 워치독 억제 (BAT-020)
...
운영자가 조회·매수·매도를 CLI 로 수행하되 데몬 RabbitMQ RPC 로 통일해 단일
writer admission·불변식을 보존(DB 직접 쓰기 없음)하고, 운영자 조회가 전략
생존 신호로 오인되지 않게 워치독을 억제한다.
거버넌스: 전부 change-req (신규 REQ 없음, dcy-016 OQ-3).
- REQ-032: CLI universe/slots(snapshot RPC) + enter(buy)/exit(sell) intent RPC
+ 인스턴스 라우팅(--config/--instance/default) + enter/exit 안전장치
(확인 프롬프트 기본 ON / --yes(paper) / --yes --live(이중 ack) / --dry-run)
+ 전 명령 --json. pause/resume 는 direct-DB 유지
- REQ-022: CLI request-reply RPC 클라이언트(call_rpc) 재사용
- REQ-021/034: snapshot 요청 워치독 억제 플래그(touch_watchdog/actor=operator)
→ 핸들러가 last_seen_at 갱신 스킵. 기본값 현행 유지(하위호환). 운영자
조회가 죽은 전략의 safety-sell 을 무력화하던 결함(R-4) 제거
- REQ-026: interface-contract/runtime-flows 정합
CLI 는 rpc/confirm 주입 가능(테스트 broker/DB-free). snapshot envelope 은
asset-centric 이라 exit 은 운영자 제공 slot_id 사용(slot_id 노출은 본 주기 밖).
검증: 단위 327 passed/34 skipped, 인프라 게이트(PG+RabbitMQ) 361 passed, ruff clean.
신규 test_cli_operator(14) + snapshot 워치독 억제(2). BAT-020 release-candidate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 16:48:26 +09:00
genichin and Claude Opus 4.8
0b7db66463
feat(runtime): dcy-014 trading_date KST 타임존 분리 + 일일 슬롯 preallocation (BAT-018)
...
데몬이 시스템 UTC 날짜로 슬롯을 1회만 preallocate 해 trading_date 가 KST 캘린더와
어긋나고 재시작 없이는 다음날 슬롯이 안 생기던 문제(issue #14 ) 정정.
거버넌스: 전부 change-req (신규 REQ 없음, dcy-014 OQ-3; 스케줄러는 REQ-030 패턴 준용).
- REQ-005: trading_date 를 설정 타임존(기본 Asia/Seoul) 기준 계산(timestamp 는 UTC
유지). DailyPreallocationScheduler 신규 — TZ 일자당 1회 멱등 fire, 재시작 없이
다음날 슬롯 자동 생성. setup() 배선 + trex-preallocation 스레드
- REQ-048: TOML trading_timezone/daily_preallocation_time 키 + from_config 전파
- REQ-009: runtime-flows/data-model 정합 + instance.example.toml
OQ-1 기본 00:00(TZ 자정, TOML 설정 가능) / OQ-2 매 캘린더일 생성(거래일 캘린더 후속).
멱등 preallocate 로 중복 tick·다중 인스턴스 중복 생성 0.
검증: 단위 302 passed/32 skipped, 인프라 게이트(PG+RabbitMQ) 334 passed, ruff clean.
신규 test_preallocation_scheduler(고정 clock) + test_instance_config 확장.
BAT-018 release-candidate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 15:39:04 +09:00
genichin and Claude Opus 4.8
565af6792c
feat(safety-sell): dcy-010 BAT-014 — 영속 거부 재시도 쿨다운 (REQ-052~054)
...
dcy-010(safety-sell 영속 거부 재시도 백오프) 전체 SDLC: draft-req → confirm-req →
draft-batch(BAT-014 batch-lite) → run-batch-delivery → confirm-req-implemented.
2026-06-07 실 KIS LIVE SL/TP e2e에서 발견한 KIS 주문 spam 위험(영속 거부 시
매도 무한 재제출) 차단.
- REQ-052 (Integration): SafetySellService per-slot 인메모리 쿨다운
(_in_cooldown/_attempt_sell/_prune_cooldown) — forced_close·stop-loss·take-profit
트리거에 min_retry_interval_sec(600s) 이내 재시도 skip(가격 poll 포함) +
max_retry_warn_count(3) 도달 시 WARNING + holding 이탈 정리. market_close 제외.
- REQ-053 (Configuration): SafetySellConfig min_retry_interval_sec/max_retry_warn_count
+ TREX_SAFETY_SELL_MIN_RETRY_INTERVAL/MAX_RETRY_WARN_COUNT env (additive)
- REQ-054 (Documentation): runtime-flows 쿨다운 flow + 가격체크 tr_id(FHKST01010100) 정정
인메모리 only(DB/스레드/인터페이스 변경 없음), default 미설정 시 기존 동작 불변.
검증: 신규 8 단위(쿨다운 6 + config 2), 전체 278 passed, ruff clean.
REQ-052~054 Implemented, BAT-014 release-candidate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-08 00:35:11 +09:00
genichin and Claude Opus 4.8
9f83c64a40
feat(multi-instance): dcy-009 BAT-013 — RabbitMQ 다중 인스턴스 토폴로지 (REQ-048~051)
...
dcy-009(다중 인스턴스 RabbitMQ 토폴로지) 전체 SDLC: draft-req → confirm-req →
draft-batch(BAT-013) → run-batch-delivery → confirm-req-implemented.
- REQ-048 (Configuration): DaemonInstanceConfig.from_toml + DaemonConfig.from_config
(env 병합, portfolio_hub_token 주입) + 데몬 --config 필수 argparse + .gitignore 인스턴스
TOML + config/instance.example.toml
- REQ-049 (Interface): topology 동적 큐명 빌더 intent/snapshot/control_queue(instance_key)
— default=리터럴 큐명(하위호환), named=`{base}.{instance_key}` + daemon per-instance 구독
- REQ-050 (Integration): trex.direct(topic)/trex.broadcast(fanout) exchange +
declare_topology(instance_key) per-instance binding + control dual binding + direct_routing_key
- REQ-051 (Documentation): interface-contract/runtime-flows/project-structure 정합
하위호환: instance_key="default" → 기존 리터럴 큐명·RPC 경로 무회귀(FR-5).
split-brain 방지(NFR-3): 인스턴스 전용 큐. 민감값(NFR-4): TOML + gitignore.
검증: 신규 9 단위 + RabbitMQ 라우팅 2, 단위 271 passed,
인프라 게이트 301 passed(directed 격리 S-2 + broadcast dual S-3 + default 무회귀 S-4),
ruff clean. REQ-048~051 Implemented, BAT-013 release-candidate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-07 15:10:36 +09:00
genichin and Claude Opus 4.8
a30efa8f3b
feat(safety-sell): dcy-007 core 자율 안전 매도 — BAT-010 기반 + BAT-011 트리거
...
dcy-007(core 자율 안전 매도) 전체 delivery. BAT-010 기반 인프라가 미커밋
상태였고 BAT-011 트리거 레이어와 공유 파일에서 섞여 있어 한 커밋으로 묶음.
BAT-010 (REQ-034/035/036/041, release-candidate):
- WatchdogStore(application/watchdog.py) + snapshot RPC 워치독 갱신
- Slot stop_loss_price/take_profit_price 필드 + 004_add_price_thresholds.sql
- SlotService.sell() 자율 매도 내부 경로 + idempotency
- SafetySellConfig env 5종 파싱
BAT-011 (REQ-037/038/039/040/042, release-candidate):
- SafetySellService(application/safety_sell.py): forced_close 만기 / stop-loss·
take-profit KIS polling / 장 마감 강제 청산 + trex-safety-sell 7번째 스레드
- BrokerPort.get_current_price + KIS inquire-price(TTTC8397R/VTTC8397R, stck_prpr)
+ paper stub
- SlotService.update_thresholds() + intent RPC update_thresholds 액션
(부분 갱신/null 해제, 워치독 last_seen_at 리셋)
- baseline 3문서 정합(interface-contract/runtime-flows/project-structure)
거버넌스: REQ-034~042 Implemented 동기화, BAT-010/011 release-candidate,
dcy-007 discovery 포함.
검증: 신규 38 테스트 green, 단위 236 passed/23 skipped,
인프라 게이트(PG+RabbitMQ) 259 passed(마이그레이션 001~004 round-trip 포함),
ruff clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-07 08:32:30 +09:00
genichin and Claude Opus 4.8
2f57aad7b2
feat(config): expose paper broker tuning via env (REQ-010 AC-5, BAT-009)
...
Wire the existing PaperBroker scenario knobs (fill_after_polls /
qty_per_poll / reject_symbols) to daemon env so REQ-011 AC-2 e2e
scenarios (delayed / partial / reject) can be reproduced by a daemon
restart. Unset == prior PaperBroker() behaviour, byte-for-byte (no
regression).
- config.py: PaperBrokerConfig + from_env parsing (TREX_PAPER_*)
- daemon.py: _build_broker injects config.paper into PaperBroker
- .env.example: document the 3 paper tuning keys (paper-only, e2e)
- tests: paper broker defaults + env tuning parsing
SDLC: REQ-010 CHG-20260606-01 (AC-5 added) / -02 (Implemented);
BAT-009 batch-lite release-candidate; REL-001 feedback handoff records
pre-deployment e2e observations incl. event-publisher idle-drop and
paper correlation_id collision (GitHub #4 , #5 ).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-06 16:49:51 +09:00
genichin
6c7a1cf6f6
feat: add messaging transport rollout
2026-06-06 00:02:52 +09:00
genichin and Claude Opus 4.8
575ba9f513
Deliver BAT-003: daemon .env loading (REQ-010, minor-change)
...
DaemonConfig.from_env() now best-effort loads a .env file (find_dotenv
usecwd, load_dotenv override=False) so operators can manage daemon env
vars via .env, with real OS env taking precedence. Add python-dotenv
dependency, gitignore .env, ship .env.example, and add config tests
(load / OS-env precedence / absence regression / missing-DSN guard).
Verification: 78 passed, ruff clean, .env ignored + .env.example tracked,
and a .env-only DaemonConfig smoke. Processed via the minor-change fast
path: REQ-010 (Configuration) -> Implemented, BAT-003 (batch-lite,
no design) -> release-candidate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-04 14:56:42 +09:00