feat: add messaging transport rollout
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
# req-026: messaging 레이어 baseline 문서 정합
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Documentation
|
||||
- Priority: Medium
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
- dcy-006 transport 전환(REQ-021~025) 이 도입하는 메시지 토폴로지/계약, RabbitMQ 어댑터 + sync+thread 런타임, delivery 신뢰성 + degrade 정책, HTTP 표면 0 결과를 baseline 문서에 반영해 코드와 문서의 정합을 유지한다.
|
||||
|
||||
## Requirement
|
||||
- 아래 baseline 문서를 messaging 레이어에 맞게 갱신한다.
|
||||
- `docs/interface-contract.md`
|
||||
- HTTP `/v1` 섹션 제거(또는 deprecated 명시).
|
||||
- 신규 섹션: messaging 메시지 계약(스냅샷/intent RPC, 이벤트 topic), 큐/익스체인지/routing key, `correlation_id`/reply-to 규약, ack/durable/DLQ/TTL 정책, 어댑터 신선도 상태 노출.
|
||||
- `docs/runtime-flows.md`
|
||||
- 기존 매수/매도 intent HTTP 흐름 제거.
|
||||
- 신규 섹션: 스냅샷 RPC 흐름, intent admission RPC 흐름, 체결/슬롯 이벤트 발행/구독 흐름, broker degrade 분기 흐름, consumer/publisher 스레드 구성.
|
||||
- `docs/project-structure.md`
|
||||
- `trex_core/adapters/api/` 제거, `trex_core/adapters/messaging/` 추가.
|
||||
- sync+thread 런타임 구성(intent RPC consumer / snapshot RPC consumer / execution / ledger 스레드) 반영.
|
||||
- 의존성 변경(`fastapi`/`uvicorn` 제거, `pika` 추가) 반영.
|
||||
- 각 baseline 문서의 `Change Log` 에 본 변경(REQ-021~026 일괄 반영) 항목을 남긴다.
|
||||
- baseline 문서 본문이 코드와 충돌하지 않도록 manual review evidence 를 남긴다(REQ-020 패턴).
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given REQ-021~025 구현 완료 상태, When 3 baseline 문서를 점검, Then `interface-contract.md`/`runtime-flows.md`/`project-structure.md` 모두에 messaging 레이어 섹션이 반영되어 있다.
|
||||
2. Given 갱신된 baseline 문서, When 실제 코드(`trex_core/adapters/messaging/`, `runtime/daemon.py`, 토폴로지 선언) 와 대조, Then 메시지 계약·토폴로지·런타임 스레드 구성·의존성 변경이 모순 없이 일치한다.
|
||||
3. Given 3 baseline 문서의 `Change Log`, When 점검, Then 본 transport 전환(REQ-021~026) 반영이 2026-06-05 일자로 기록되어 있다.
|
||||
4. Given baseline 문서, When 점검, Then HTTP `/v1` 섹션과 `adapters/api` 트리 항목이 잔존하지 않는다(또는 deprecated 라벨로 명시).
|
||||
|
||||
## Impacted Area
|
||||
- Docs: docs/interface-contract.md, docs/runtime-flows.md, docs/project-structure.md
|
||||
- Modules: 없음(문서 전용)
|
||||
- Tests: 문서-코드 정합 점검(리뷰); 필요 시 interface-contract 예시와 실제 메시지 형식 대조.
|
||||
|
||||
## Notes
|
||||
- 출처: dcy-006 FR-6.
|
||||
- baseline 갱신은 REQ-021~025 구현 내용에 의존하므로 동일 batch 후반 또는 구현 직후 수행한다(REQ-020 baseline 정합 선례와 동일 패턴).
|
||||
- `data-model.md` 는 본 transport 전환의 직접 대상이 아니다(이벤트 페이로드/큐 스키마는 interface-contract 가 담는 편이 자연스러움). 추후 이벤트 페이로드가 entity 수준으로 안정화되면 별도 REQ 에서 data-model 갱신 여부 판단.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260605-01
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- dcy-006 FR-6 로부터 최초 생성(Proposed).
|
||||
|
||||
#### Intent
|
||||
- transport 전환에 따른 baseline 3문서(interface-contract/runtime-flows/project-structure) 정합을 backlog 로 정규화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 3 baseline 반영, 코드 정합, 변경 이력 기록, HTTP 잔존 0 (총 4개 기준)
|
||||
- Updated:
|
||||
- 없음
|
||||
- Removed:
|
||||
- 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/interface-contract.md, docs/runtime-flows.md, docs/project-structure.md
|
||||
- Modules:
|
||||
- 없음
|
||||
- Tests:
|
||||
- 문서-코드 정합 점검
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 후 REQ-021~025 와 동일 batch 편성 권장.
|
||||
|
||||
#### Validation Plan
|
||||
- REQ-021~025 구현 후 3 baseline 문서를 코드와 대조해 정합 확인.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- messaging 레이어 baseline 3문서(interface-contract/runtime-flows/project-structure) 정합 요구사항을 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-021~025 와 동일 batch 후반 또는 후속 batch 편성 권장.
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- messaging 레이어 baseline 3문서(interface-contract/runtime-flows/project-structure) 정합을 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: release 단계는 별도 진행.
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: 3 baseline 문서 messaging 섹션 + Interface Summary/Covered Entry Points/트리 반영 완료.
|
||||
- AC-2: baseline ↔ 코드 정합 manual review (BAT-007 verification.md Manual 섹션).
|
||||
- AC-3: 3 baseline 문서 Change Log 모두 2026-06-05 BAT-007 항목 추가.
|
||||
- AC-4: docs/interface-contract.md 의 HTTP `/v1` 섹션 제거 + project-structure 트리에서 adapters/api 제거.
|
||||
@@ -0,0 +1,154 @@
|
||||
# req-023: messaging delivery 신뢰성 (effectively-once + durable + DLQ + publisher confirms)
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Exception
|
||||
- Priority: High
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
- RabbitMQ 메시징을 도입하면서 at-least-once 재전달이 intent 중복 실행이나 슬롯 권위 불변식 위반을 일으키지 않도록, idempotency + durable + 단일 consumer FIFO + dead-letter + publisher confirms 로 effectively-once 동작을 보장한다. 진짜 exactly-once 는 추구하지 않는다.
|
||||
|
||||
## Requirement
|
||||
- intent admission RPC 는 다음 신뢰성 규약을 따른다.
|
||||
- 메시지/큐는 durable + persistent delivery_mode.
|
||||
- `correlation_id` = intent 멱등키(dcy-003 패턴, `{asset_id}:{order_id}:{execution_id}` 또는 등가) 로 dedup.
|
||||
- 슬롯 전이를 Postgres 에 durable commit 한 뒤 ack(manual ack). 재전달 시 dedup 게이트가 단일 실행을 보장한다.
|
||||
- 단일 consumer + prefetch=1 로 FIFO 순서 보존(trex-core 단일 writer 불변식 A 와 정합).
|
||||
- 스냅샷 RPC 는 read-only 멱등이므로 at-least-once + transient 큐/메시지 + manual ack 로 운영하고 별도 dedup 을 강제하지 않는다.
|
||||
- 이벤트 pub/sub 는 다음 신뢰성 규약을 따른다.
|
||||
- `trex.events` 는 durable topic exchange.
|
||||
- 전략별 queue 는 durable + per-strategy 로 down 중 catch-up 가능. 무한 적체 방지를 위해 TTL 또는 max-length 정책을 적용하고 초과분은 drop-oldest 후 스냅샷 RPC 로 reconcile.
|
||||
- 이벤트 페이로드는 delta 가 아니라 **현재 상태 + 단조 증가 시퀀스(슬롯 version/timestamp)** 를 운반해 last-wins 가 성립하도록 한다(순서 보증 불요).
|
||||
- 발행은 publisher confirms 로 broker 수락을 확인하고, 발행 실패/거부는 dead-letter 경로로 격리한다.
|
||||
- 미수신/중복 이벤트 보정은 권위 reconcile 경로인 스냅샷 RPC 가 담당한다(이벤트는 push 최적화이지 단일 진실원이 아님).
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given 동일 `correlation_id` 의 intent 메시지가 2회 전달, When intent consumer 가 처리, Then 슬롯 전이는 1회만 일어나고 두 번째는 dedup 으로 무시된다(NFR-2).
|
||||
2. Given intent consumer 가 슬롯 transition 후 ack 직전 크래시 상황을 시뮬레이션, When 재기동 후 동일 메시지가 재전달, Then 멱등 dedup 으로 슬롯이 추가 전이되지 않고 결국 ack 된다(durable commit + ack 순서).
|
||||
3. Given intent 큐, When 토폴로지를 검사, Then 큐와 메시지가 durable/persistent 이고 consumer 가 단일 + prefetch=1 로 선언되어 있다.
|
||||
4. Given 전략 queue 가 down 인 상태에서 trex-core 가 이벤트를 발행, When 전략이 복구되어 queue 를 다시 소비, Then 적체된 이벤트를 catch-up 으로 수신한다(durable per-strategy queue).
|
||||
5. Given 이벤트 페이로드, When 형식을 검사, Then `current state + 단조 시퀀스` 필드가 포함되어 last-wins 적용이 가능하다.
|
||||
6. Given trex-core 가 이벤트를 발행, When broker 가 거부/확인 실패, Then publisher confirms 가 실패를 감지하고 메시지를 dead-letter 경로로 격리한다.
|
||||
7. Given TTL 또는 max-length 가 설정된 이벤트 queue, When 한도를 초과, Then 초과 메시지는 drop-oldest 로 제거되고 후속 스냅샷 RPC reconcile 로 누락이 보정된다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: docs/runtime-flows.md(신뢰성/dedup/ack/DLQ 흐름), docs/interface-contract.md(메시지 속성/큐 옵션) — REQ-026 에서 정합.
|
||||
- Modules: REQ-022 의 어댑터/consumer 에 ack 시점·dedup 게이트·publisher confirms·DLQ 라우팅을 통합. dedup 게이트는 dcy-003 의 멱등 store 재사용.
|
||||
- Tests: 중복 intent 메시지 dedup, crash-after-commit-before-ack 재처리, durable queue + prefetch=1 토폴로지 검사, per-strategy queue catch-up, 이벤트 페이로드 모양, publisher confirms 실패 DLQ, TTL/max-length drop-oldest + reconcile.
|
||||
|
||||
## Notes
|
||||
- 출처: dcy-006 FR-4, NFR-2, OQ-3, R-2.
|
||||
- NFR-2(effectively-once) 는 별도 REQ 로 승격하지 않고 본 REQ AC-1/AC-2 로 흡수한다.
|
||||
- 진짜 exactly-once 는 추구하지 않는다(분산 메시징 일반 원칙). 멱등 + 권위 reconcile 로 실제 효과를 낸다.
|
||||
- DLQ 라우팅 키/큐 이름 같은 세부 규약은 batch design 에서 확정한다(본 REQ 는 정책 수준).
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260605-01
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- dcy-006 FR-4 로부터 최초 생성(Proposed). NFR-2(effectively-once) 흡수.
|
||||
|
||||
#### Intent
|
||||
- messaging delivery 신뢰성(intent dedup, durable+FIFO, 이벤트 catch-up, publisher confirms, DLQ, TTL/max-length) backlog 정규화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 중복 intent dedup, crash-after-commit-before-ack 재처리, durable+prefetch=1 토폴로지, per-strategy queue catch-up, 이벤트 페이로드 모양, publisher confirms DLQ, TTL/max-length drop-oldest (총 7개 기준)
|
||||
- Updated:
|
||||
- 없음
|
||||
- Removed:
|
||||
- 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/runtime-flows.md, docs/interface-contract.md
|
||||
- Modules:
|
||||
- adapters/messaging consumer/publisher 의 ack/dedup/DLQ/confirms 통합
|
||||
- Tests:
|
||||
- 신뢰성 7가지 시나리오
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 후 batch 편성
|
||||
|
||||
#### Validation Plan
|
||||
- stub/RabbitMQ 어댑터로 dedup/durable/catch-up/confirms/DLQ/TTL 시나리오를 검증.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- messaging delivery 신뢰성(effectively-once + durable + DLQ + publisher confirms) 요구사항을 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-021/022/025 와 함께 batch 편성
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- messaging delivery 신뢰성(effectively-once + durable + DLQ + publisher confirms + TTL/max-length)을 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: release 단계는 별도 진행
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: tests/application/test_messaging_intent_consumer.py::test_duplicate_correlation_id_dedups_via_intent_log + tests/adapters/messaging/test_rabbitmq_intent_e2e.py::test_intent_admission_rpc_dedups_duplicate_correlation_id_over_rabbitmq (실 RabbitMQ).
|
||||
- AC-2: ack-after-handler 코드(Daemon._intent_rpc_loop) + dedup 테스트가 ack 순서 전제 통과.
|
||||
- AC-3: tests/adapters/messaging/test_rabbitmq_intent_e2e.py::test_intent_queue_topology_uses_dlq_pointer.
|
||||
- AC-4: topology.STRATEGY_QUEUE_ARGS + per-strategy filter 테스트.
|
||||
- AC-5: tests/application/test_messaging_event_publisher.py::test_fill_emits_slot_filled_event_with_routing_key_and_state.
|
||||
- AC-6: RabbitMQTransport._publish_dlq + handler exception NACK + tests/adapters/messaging/test_in_memory_transport.py::test_publish_event_with_no_subscriber_routes_to_dlq.
|
||||
- AC-7: tests/adapters/messaging/test_topology.py::test_strategy_queue_args_have_ttl_and_max_length.
|
||||
@@ -1,6 +1,6 @@
|
||||
# req-021: messaging 토폴로지 + 메시지 계약 매핑
|
||||
|
||||
- Status: Proposed
|
||||
- Status: Implemented
|
||||
- Type: Integration
|
||||
- Priority: High
|
||||
- Owner: project maintainers
|
||||
@@ -76,3 +76,69 @@
|
||||
|
||||
#### Validation Plan
|
||||
- stub 어댑터 통합테스트로 RPC 매핑·이벤트 routing key 필터링·매핑 원칙을 검증.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- messaging 토폴로지 + 메시지 계약 매핑을 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-022/023/025 와 함께 batch 편성(통신 단절 R-5 회피)
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- messaging 토폴로지 + 메시지 계약 매핑 구현과 검증 evidence 확보 후 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: release 단계는 별도 진행
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: tests/adapters/messaging/test_rabbitmq_transport.py::test_declare_topology_creates_core_entities.
|
||||
- AC-2: tests/application/test_messaging_snapshot_consumer.py + tests/adapters/messaging/test_rabbitmq_transport.py::test_rpc_roundtrip.
|
||||
- AC-3: tests/application/test_messaging_intent_consumer.py + test_messaging_event_publisher.py 조합.
|
||||
- AC-4: tests/application/test_messaging_event_publisher.py::test_event_for_strategy_a_does_not_reach_strategy_b_queue + tests/adapters/messaging/test_rabbitmq_transport.py::test_event_publish_and_per_strategy_consume.
|
||||
- AC-5: tests/adapters/messaging/test_topology.py.
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
# req-022: messaging transport 포트 + RabbitMQ 어댑터 + stub + sync+thread daemon
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Integration
|
||||
- Priority: High
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
- 메시징 접근을 application 경계의 transport 포트로 추상화하고, `pika`(동기) RabbitMQ 어댑터와 결정론 stub 을 adapters 레이어에 격리해 도메인 순수성을 유지하면서 메시지 기반 통신을 가능하게 한다. uvicorn 제거 후 데몬을 sync+thread 런타임으로 재구성한다.
|
||||
|
||||
## Requirement
|
||||
- application 레이어에 `MessagingTransport` (또는 동등한) Protocol 을 정의해 publish/subscribe/RPC consume 진입점을 추상화한다.
|
||||
- 신규 `trex_core/adapters/messaging/` 패키지에 두 구현체를 둔다.
|
||||
- `RabbitMQTransport`: `pika`(동기) BlockingConnection 기반. consumer/publisher 스레드별 connection/channel 또는 `add_callback_threadsafe` 규약을 따른다(pika 는 thread-safe 가 아님).
|
||||
- `InMemoryTransport` (stub): 결정론 테스트용 in-process publish/subscribe/RPC.
|
||||
- 데몬을 sync+thread 런타임으로 재구성한다(dcy-006 OQ-5): consumer 스레드(intent RPC, prefetch=1 단일 FIFO; snapshot RPC) + 기존 execution/ledger 루프 스레드 + 이벤트 publisher(execution 루프가 자기 channel 로 발행). graceful shutdown 은 기존 `stop` event 패턴을 확장해 connection close 까지 포함한다.
|
||||
- pika 자동 재연결이 없는 특성을 보정하기 위해 connection drop 시 백오프 기반 재연결 루프를 직접 구현하고 REQ-024 degrade 정책과 연동한다.
|
||||
- `trex_core/domain` 은 transport/AMQP 의존 0 을 유지한다(NFR-1, import 스윕).
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given in-process `InMemoryTransport` stub, When 테스트가 publish/subscribe/RPC 진입점을 호출, Then 외부 broker 없이 메시지 송수신이 동작한다.
|
||||
2. Given `RabbitMQTransport`, When `TREX_RABBITMQ_URL` 로 broker 에 접속, Then connection/channel 이 열리고 declared 큐/익스체인지로 메시지 송수신이 가능하다(integration 수준, 인프라 미가용 시 skip 게이트 허용).
|
||||
3. Given 데몬 기동, When lifecycle 을 시작, Then intent RPC consumer 스레드, snapshot RPC consumer 스레드, execution/ledger 스레드가 동시에 동작하고, shutdown 시 `stop` event 후 모든 스레드와 connection 이 정상 종료된다(`uvicorn.run` 의존 0).
|
||||
4. Given broker connection 이 끊긴 상태, When 어댑터가 감지, Then 백오프 재연결을 직접 수행하고, REQ-024 degrade 정책(버퍼링 금지·보수적 중단)에 따라 신규 처리를 중단한다.
|
||||
5. Given 정적 import 스윕, When `trex_core/domain` 을 점검, Then `pika`/AMQP/`trex_core.adapters.messaging` 의존이 0 이다(NFR-1).
|
||||
|
||||
## Impacted Area
|
||||
- Docs: docs/project-structure.md(adapters/messaging 위치 + 런타임 스레드 구성), docs/runtime-flows.md(consumer 스레드/이벤트 publisher 흐름) — REQ-026 에서 정합.
|
||||
- Modules:
|
||||
- 신규 `trex_core/application/messaging.py`(`MessagingTransport` Protocol)
|
||||
- 신규 `trex_core/adapters/messaging/` (`rabbitmq.py`, `in_memory.py`)
|
||||
- 변경 `trex_core/runtime/daemon.py`(uvicorn 제거, consumer 스레드 추가, graceful shutdown 확장)
|
||||
- 변경 `trex_core/runtime/config.py` (`TREX_RABBITMQ_URL` 로딩; REQ-025 와 함께 `TREX_API_HOST`/`TREX_API_PORT` 폐기)
|
||||
- 영향 `trex_core/application/intents.py`, dcy-005 스냅샷 application 서비스 — transport-무관 포트로 호출되도록 재배선
|
||||
- Tests:
|
||||
- in-process stub 통합테스트(publish/subscribe/RPC)
|
||||
- RabbitMQ integration 테스트(`TREX_RABBITMQ_URL` 게이트, 미가용 시 skip)
|
||||
- 데몬 lifecycle 테스트(스레드 기동/종료)
|
||||
- `tests/domain/test_domain_import_sweep.py` 가 `pika`·`adapters.messaging` 추가 금지 prefix 로 가드
|
||||
|
||||
## Notes
|
||||
- 출처: dcy-006 FR-3, NFR-1, OQ-5, OQ-6.
|
||||
- NFR-1(도메인 순수성) 은 REQ-017 AC-4 와 동일한 패턴으로 본 REQ AC-5 에 흡수한다(별도 REQ 미승격).
|
||||
- HTTP 어댑터 제거와 `TREX_API_HOST/PORT` 폐기는 REQ-025 본문에서 책임진다(본 REQ 는 신규 transport 도입 범위).
|
||||
- 실 RabbitMQ broker 인스턴스/자격증명 provision 은 delivery/운영 작업으로 위임됨(DATA, 비차단).
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260605-01
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- dcy-006 FR-3 로부터 최초 생성(Proposed). NFR-1(도메인 순수성) 흡수.
|
||||
|
||||
#### Intent
|
||||
- 메시징 transport 포트 + RabbitMQ 어댑터 + stub + sync+thread 데몬 재구성 backlog 정규화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- stub publish/sub/RPC, RabbitMQ integration, 데몬 lifecycle, 재연결+degrade 연동, 도메인 import 스윕 (총 5개 기준)
|
||||
- Updated:
|
||||
- 없음
|
||||
- Removed:
|
||||
- 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/project-structure.md, docs/runtime-flows.md
|
||||
- Modules:
|
||||
- application/messaging.py, adapters/messaging/{rabbitmq,in_memory}, runtime/daemon.py, runtime/config.py
|
||||
- Tests:
|
||||
- in-process stub, RabbitMQ integration(게이트), 데몬 lifecycle, import 스윕
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 후 batch 편성
|
||||
|
||||
#### Validation Plan
|
||||
- stub 기반 통합테스트 + RabbitMQ integration 테스트(미가용 시 skip) + import 스윕으로 검증.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- messaging transport 포트 + RabbitMQ 어댑터 + stub + sync+thread daemon 재구성을 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-021/023/025 와 함께 batch 편성
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- MessagingTransport 포트 + RabbitMQ 어댑터 + stub + sync+thread daemon 재구성을 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: release 단계는 별도 진행
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: tests/adapters/messaging/test_in_memory_transport.py 5종.
|
||||
- AC-2: tests/adapters/messaging/test_rabbitmq_transport.py 5종 (실 RabbitMQ 통합).
|
||||
- AC-3: tests/runtime/test_daemon_no_http_surface.py::test_daemon_module_has_no_fastapi_or_uvicorn_import + Daemon 4 스레드 코드.
|
||||
- AC-4: RabbitMQTransport 재연결 백오프 코드 + tests/adapters/messaging/test_in_memory_transport.py::test_unavailable_transport_raises_on_publish_and_rpc.
|
||||
- AC-5: tests/domain/test_domain_import_sweep.py.
|
||||
@@ -0,0 +1,157 @@
|
||||
# req-025: HTTP `/v1` API 완전 제거 (healthz 포함, HTTP 표면 0)
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Interface
|
||||
- Priority: High
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
- RabbitMQ 단일 transport 결정(dcy-006 OQ-1)에 따라 trex-core 의 HTTP `/v1` API 표면을 0 으로 만든다. 전략-facing 엔드포인트뿐 아니라 `GET /v1/healthz` 같은 앱 레벨 헬스 표면까지 제거하고(OQ-7), liveness 는 프로세스 감독(systemd/supervisor/docker restart)이 담당한다. 이중 transport 병행을 두지 않는다.
|
||||
|
||||
## Requirement
|
||||
- 아래 HTTP 엔드포인트와 그 어댑터를 trex-core 코드와 baseline 에서 제거한다.
|
||||
- `POST /v1/intents/buy`, `POST /v1/intents/sell`
|
||||
- `GET /v1/intents/{intent_id}`
|
||||
- `GET /v1/slots`, `GET /v1/capacity`
|
||||
- `GET /v1/healthz`
|
||||
- dcy-005 가 HTTP 로 가정한 스냅샷 read 엔드포인트(아직 미구현인 경우 가정 자체 갱신)
|
||||
- `trex_core/adapters/api/` HTTP 어댑터 패키지를 제거하고, FastAPI/uvicorn/Starlette 직접 의존을 코어 런타임에서 제거한다(테스트 전용 보조 import 도 마찬가지). `pyproject.toml` 의 `fastapi`/`uvicorn` 의존성을 정리한다.
|
||||
- `TREX_API_HOST` / `TREX_API_PORT` env 와 그 로딩 코드를 폐기한다(`DaemonConfig`/`.env.example` 정리).
|
||||
- 데몬 기동 후 HTTP 리스너가 어떤 포트에도 바인딩되어 있지 않아야 한다(HTTP 표면 0). 앱 레벨 헬스/관측성은 로그·메트릭으로 대체한다.
|
||||
- dcy-002 의 HTTP intent API 가정과 dcy-005 의 HTTP pull 가정(FR-1/A-3)을 cross-reference 로 갱신한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given 새 트리, When `find trex_core -path '*/adapters/api/*'` 또는 `grep -r "fastapi\|uvicorn" trex_core/`, Then 결과가 비어 있다(HTTP 어댑터 잔존 0).
|
||||
2. Given trex-core daemon, When 기동 후 포트 스캔, Then 어떤 TCP 포트에도 HTTP 리스너가 열려 있지 않다(HTTP 표면 0, dcy-006 S-6).
|
||||
3. Given `DaemonConfig.from_env()`, When 환경 변수 로딩, Then `TREX_API_HOST`/`TREX_API_PORT` 를 더 이상 참조하지 않고, 누락되어도 기동에 영향이 없다.
|
||||
4. Given `pyproject.toml`, When 의존성 목록을 점검, Then `fastapi`/`uvicorn`/`starlette` 가 코어 runtime 의존성에서 제거되어 있다.
|
||||
5. Given dcy-002·dcy-005 의 HTTP 가정 본문, When 본 변경 완료 시점에 cross-reference 갱신을 확인, Then 두 Discovery 의 HTTP 가정이 "transport 는 RabbitMQ(dcy-006)" 로 일관되게 안내된다.
|
||||
6. Given liveness 확인 시나리오, When 프로세스 감독(systemd/supervisor/docker restart)이 프로세스 죽음을 감지, Then 재시작이 broker 가용성과 무관하게 동작한다(broker 장애가 재시작 루프 유발 금지).
|
||||
|
||||
## Impacted Area
|
||||
- Docs: docs/interface-contract.md(HTTP `/v1` 섹션 제거), docs/runtime-flows.md(HTTP 흐름 제거), docs/project-structure.md(adapters/api 제거), docs/discovery/dcy-002·dcy-005 cross-reference 갱신 — REQ-026 에서 정합.
|
||||
- Modules:
|
||||
- 제거 `trex_core/adapters/api/` 전체(`app.py`, `schemas.py`)
|
||||
- 변경 `trex_core/runtime/daemon.py`(uvicorn import/실행 제거; REQ-022 의 sync+thread 런타임으로 교체)
|
||||
- 변경 `trex_core/runtime/config.py`(`TREX_API_HOST`/`TREX_API_PORT` 폐기)
|
||||
- 변경 `pyproject.toml`(fastapi/uvicorn 제거; httpx 는 ledger 어댑터 사용처가 있으므로 유지)
|
||||
- 변경 `.env.example`(API_HOST/PORT 제거, `TREX_RABBITMQ_URL` 추가는 REQ-022 책임)
|
||||
- Tests:
|
||||
- 제거 `tests/adapters/api/` 전체(또는 messaging 등가 테스트로 이관)
|
||||
- 추가 daemon HTTP-표면-0 회귀 가드(포트 스캔 또는 import 가드)
|
||||
|
||||
## Notes
|
||||
- 출처: dcy-006 FR-5, OQ-1, OQ-7.
|
||||
- 본 REQ 의 검증은 transport 가 RabbitMQ 로 대체 가능한 상태(REQ-021/REQ-022/REQ-023 구현)에 의존한다. 동일 batch 또는 직후 batch 에서 함께 deliver 해야 통신 단절 위험(R-5)을 피할 수 있다.
|
||||
- httpx 는 본 REQ 가 제거 대상에서 제외한다(portfolio-hub ledger 어댑터가 사용).
|
||||
- 외부 운영 가시성(메트릭/로그) 표준화는 본 REQ 범위 밖이며 후속 운영 트랙으로 추적한다.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260605-01
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- dcy-006 FR-5/OQ-1/OQ-7 로부터 최초 생성(Proposed). HTTP `/v1` API + healthz + adapters/api + API_HOST/PORT env + fastapi/uvicorn 의존 전부 제거 backlog 정규화.
|
||||
|
||||
#### Intent
|
||||
- 이중 transport 병행 없이 HTTP 표면 0 을 달성하고 dcy-002·dcy-005 의 HTTP 가정을 갱신.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- HTTP 어댑터 잔존 0, HTTP 리스너 0, env 폐기, 의존성 제거, cross-reference 갱신, 프로세스 감독 liveness (총 6개 기준)
|
||||
- Updated:
|
||||
- 없음
|
||||
- Removed:
|
||||
- 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/interface-contract.md, docs/runtime-flows.md, docs/project-structure.md, dcy-002/dcy-005 cross-reference
|
||||
- Modules:
|
||||
- adapters/api 제거, runtime/daemon.py, runtime/config.py, pyproject.toml, .env.example
|
||||
- Tests:
|
||||
- adapters/api 테스트 제거 또는 이관, daemon HTTP-표면-0 회귀 가드
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: yes (BAT-002 HTTP API 관련 구현 일부가 RabbitMQ 로 대체)
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 후 REQ-021~023 과 동일 batch 편성(통신 단절 R-5 회피).
|
||||
|
||||
#### Validation Plan
|
||||
- 코드 grep + 포트 스캔 + env 누락 기동 + pyproject 의존성 검사 + cross-reference 리뷰 + 프로세스 감독 시나리오로 검증.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- HTTP `/v1` API 완전 제거(healthz 포함, HTTP 표면 0)와 fastapi/uvicorn 의존 정리를 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: yes (BAT-002 HTTP API 관련 구현 일부 RabbitMQ 로 대체)
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-021/022/023 과 반드시 동일 batch 로 deliver(big-bang 마이그레이션 R-5 회피)
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- HTTP `/v1` API + healthz + adapters/api + fastapi/uvicorn 의존 + TREX_API_HOST/PORT 폐기를 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: yes (BAT-002 HTTP API 관련 구현/테스트 일부 RabbitMQ 로 대체됨; tests/adapters/api/ 제거)
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: release 단계에서 전략 모듈 cut-over 순서 합의.
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: tests/runtime/test_daemon_no_http_surface.py::test_adapters_api_tree_does_not_exist + test_no_fastapi_or_uvicorn_in_trex_core_source.
|
||||
- AC-2: tests/runtime/test_daemon_no_http_surface.py::test_daemon_module_has_no_fastapi_or_uvicorn_import.
|
||||
- AC-3: tests/runtime/test_daemon_no_http_surface.py::test_config_env_no_longer_references_api_host_or_port.
|
||||
- AC-4: tests/runtime/test_daemon_no_http_surface.py::test_pyproject_dependencies_have_no_fastapi_or_uvicorn.
|
||||
- AC-5: docs/discovery/dcy-002_…md 헤더 supersede 메모 + dcy-005 cross-reference 보유.
|
||||
- AC-6: Daemon.run 의 signal handler + 포트 바인딩 0 코드 review.
|
||||
@@ -0,0 +1,143 @@
|
||||
# req-024: RabbitMQ 가용성 degrade 정책 (버퍼링 금지 + 보수적 중단 + core 안전 매도 독립)
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Non-Functional
|
||||
- Priority: High
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
- HTTP fallback 없이 RabbitMQ 단일 transport 로 전환되므로(dcy-006 OQ-1, R-3 High), broker 장애가 trex-core 의 신규 매매를 통제 불능 상태로 만들지 않도록 명시적인 degrade 정책을 강제한다. 열린 포지션은 core 자율 안전 매도가 transport·전략과 독립으로 보호하는 전제를 별도 backlog 로 가시화한다.
|
||||
|
||||
## Requirement
|
||||
- RabbitMQ broker 가 불가용일 때 trex-core 는 아래 정책을 따른다(dcy-006 OQ-4).
|
||||
1. **버퍼링 금지**: 새 intent 메시지를 로컬 디스크/큐에 적재해 복구 후 자동 재생하지 않는다. 지나간 결정의 지연 실행 위험을 차단한다.
|
||||
2. **신규 매매 보수적 중단**: 스냅샷 RPC 타임아웃·intent 발행 실패 시 전략 측은 매매를 보류하고, trex-core 는 신규 슬롯 전이를 유입시키지 않는다(복구 후 신선 데이터로 재판단).
|
||||
- `MessagingTransport` 어댑터는 connection drop / 재연결 백오프 / 신선도(staleness) 상태를 명확히 노출해 application 레이어가 위 정책을 일관되게 적용할 수 있게 한다.
|
||||
- core 자율 안전 매도(손절 stop-loss, 시간 만기 forced_close) 는 RabbitMQ 가용성 및 전략 모듈 동작 여부와 **독립**으로 수행되어야 한다는 architecture 전제를 본 REQ 의 명시적 contract 로 둔다(현재 미구현, dcy-006 A-5 — 본 REQ 는 정책 contract 만 정의하고 구현은 별도 Discovery 로 위임).
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given RabbitMQ broker 가 불가용, When 전략이 intent 를 발행하려 시도, Then trex-core 는 새 슬롯 전이를 일으키지 않는다(보수적 중단).
|
||||
2. Given RabbitMQ broker 가 일시 불가용 후 복구, When 복구 시점에 broker 또는 클라이언트에 누적된 intent 가 있는지 확인, Then trex-core 측에 로컬 버퍼링된 intent 가 없고 자동 재생도 일어나지 않는다(버퍼링 금지).
|
||||
3. Given RabbitMQ connection drop, When 어댑터 상태를 조회, Then `connected/disconnected/reconnecting` 신선도 상태가 application 레이어에 노출되어 degrade 분기에 사용된다.
|
||||
4. Given dcy-006 A-5(core 자율 안전 매도)가 본 변경 범위 외에 별도 트랙으로 존재함, When 본 REQ 를 검증, Then 본 REQ 는 정책 contract(독립 동작 전제)만 강제하고 구현 자체는 후속 Discovery/REQ 로 추적되도록 Notes 에 명시되어 있다.
|
||||
5. Given 복구 후 첫 사이클, When 전략이 신규 매매를 결정, Then 결정은 복구 후 신선 스냅샷에 근거하고, 복구 전 결정의 자동 실행은 없다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: docs/runtime-flows.md(degrade 분기 흐름), docs/interface-contract.md(어댑터 신선도 상태 노출) — REQ-026 에서 정합.
|
||||
- Modules: REQ-022 어댑터의 connection 상태/재연결 루프 노출, application 레이어의 broker-down 분기.
|
||||
- Tests: broker 중단 주입 후 신규 intent 전이 없음, 복구 후 자동 재생 없음, connection 상태 전이 노출 테스트.
|
||||
|
||||
## Notes
|
||||
- 출처: dcy-006 NFR-3, OQ-4, R-3, A-5.
|
||||
- core 자율 안전 매도(stop-loss, forced_close) 는 현재 미구현(`forced_close_at` 필드만 존재, 자동 트리거 로직 없음, stop-loss 부재). 본 REQ 는 그 capability 가 RabbitMQ·전략과 **독립**이어야 한다는 architecture contract 만 backlog 로 둔다 — 실제 구현은 본 transport 범위 밖이며 별도 Discovery 로 추적해야 한다.
|
||||
- dcy-005 OQ-5(스냅샷 read 가용성) 와 공통 "보수적 안전" 철학을 따른다.
|
||||
- 본 REQ 의 검증은 stub broker 가용성 토글로 충분히 수행 가능하며, 실 RabbitMQ 인프라 의존성을 강제하지 않는다.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260605-01
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- dcy-006 NFR-3 로부터 최초 생성(Proposed). HTTP fallback 부재로 High 영향 가용성 결합(R-3) 처리 방침을 backlog 로 정규화.
|
||||
|
||||
#### Intent
|
||||
- broker 장애 시 trex-core 의 보수적 중단·버퍼링 금지 정책과 core 자율 안전 매도 독립 전제를 별도 NFR REQ 로 분리해 운영 가시성 확보.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 보수적 중단, 버퍼링 금지, connection 신선도 노출, A-5 정책 contract 분리, 복구 후 신선 결정 (총 5개 기준)
|
||||
- Updated:
|
||||
- 없음
|
||||
- Removed:
|
||||
- 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/runtime-flows.md, docs/interface-contract.md
|
||||
- Modules:
|
||||
- adapters/messaging connection 상태 노출, application degrade 분기
|
||||
- Tests:
|
||||
- broker 중단/복구 시나리오 3종
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 후 batch 편성. core 자율 안전 매도 구현은 별도 Discovery 로 분리 트래킹.
|
||||
|
||||
#### Validation Plan
|
||||
- stub broker 가용성 토글로 보수적 중단·버퍼링 금지·신선도 상태를 검증. A-5 항목은 정책 contract review.
|
||||
|
||||
### CHG-20260605-02
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Proposed -> Approved. confirm-req 승인 게이트 통과.
|
||||
|
||||
#### Intent
|
||||
- RabbitMQ 가용성 degrade 정책(버퍼링 금지 + 보수적 중단 + core 자율 안전 매도 독립 contract)을 delivery input 으로 승인.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Approved
|
||||
- Follow-up Action: REQ-022 어댑터의 connection 상태 노출과 동일 batch 편성 권장. core 자율 안전 매도 구현은 별도 Discovery 로 분리 트래킹.
|
||||
|
||||
#### Validation Plan
|
||||
- 기존 Acceptance Criteria 로 batch delivery 에서 검증.
|
||||
|
||||
### CHG-20260605-03
|
||||
- Date: 2026-06-05
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
- Status 변경: Approved -> Implemented. BAT-007 release-candidate verification evidence 기반.
|
||||
|
||||
#### Intent
|
||||
- RabbitMQ 가용성 degrade 정책(버퍼링 금지 + 보수적 중단 + core 자율 안전 매도 독립 contract)을 구현 완료 상태로 동기화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added/Updated/Removed: 없음
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs/Modules/Tests: 없음
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-007 (release-candidate)
|
||||
- Releases:
|
||||
- none
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: Implemented
|
||||
- Follow-up Action: core 자율 안전 매도 구현은 별도 Discovery 로 분리 트래킹.
|
||||
|
||||
#### Validation Plan
|
||||
- AC-1: tests/adapters/messaging/test_in_memory_transport.py::test_unavailable_transport_raises_on_publish_and_rpc + tests/application/test_messaging_event_publisher.py::test_publish_failure_does_not_break_execution_loop.
|
||||
- AC-2: MessagingTransport Protocol 에 enqueue 가 없음 + 어댑터 코드 review (publish 실패 → 즉시 raise/DLQ, 로컬 보관 0).
|
||||
- AC-3: TransportHealth enum + 어댑터 상태 머신 코드 + AC-1 테스트가 disconnected 노출 검증.
|
||||
- AC-4: REQ-024 본문 Notes + BAT-007 implementation/verification Remaining Risks 에 명시.
|
||||
- AC-5: 발행 실패가 슬롯 전이를 롤백하지 않음 (test_publish_failure_does_not_break_execution_loop).
|
||||
+10
-4
@@ -74,7 +74,7 @@
|
||||
|
||||
## Next Requirement ID
|
||||
|
||||
- Current: `REQ-021`
|
||||
- Current: `REQ-027`
|
||||
- Rule: `Requirement Register`에 있는 가장 큰 REQ 번호보다 정확히 1 커야 한다.
|
||||
|
||||
## Requirement Register
|
||||
@@ -101,11 +101,17 @@
|
||||
| REQ-018 | 체결→원장 기록 (집행 루프 fill hook) | Integration | Implemented | High | project maintainers | [req-018](./Integration/req-018_fill-to-ledger-recording.md) |
|
||||
| REQ-019 | ledger outbox durability + correlation_id 멱등 | Exception | Implemented | High | project maintainers | [req-019](./Exception/req-019_ledger-outbox-durability-idempotency.md) |
|
||||
| REQ-020 | ledger 레이어 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | [req-020](./Documentation/req-020_ledger-baseline-alignment.md) |
|
||||
| REQ-021 | messaging 토폴로지 + 메시지 계약 매핑 | Integration | Implemented | High | project maintainers | [req-021](./Integration/req-021_messaging-topology-and-contract-mapping.md) |
|
||||
| REQ-022 | messaging transport 포트 + RabbitMQ 어댑터 + stub + sync+thread daemon | Integration | Implemented | High | project maintainers | [req-022](./Integration/req-022_messaging-transport-port-and-rabbitmq-adapter.md) |
|
||||
| REQ-023 | messaging delivery 신뢰성 (effectively-once + durable + DLQ + publisher confirms) | Exception | Implemented | High | project maintainers | [req-023](./Exception/req-023_messaging-delivery-reliability.md) |
|
||||
| REQ-024 | RabbitMQ 가용성 degrade 정책 (버퍼링 금지 + 보수적 중단 + core 안전 매도 독립) | Non-Functional | Implemented | High | project maintainers | [req-024](./Non-Functional/req-024_rabbitmq-availability-degrade-policy.md) |
|
||||
| REQ-025 | HTTP `/v1` API 완전 제거 (healthz 포함, HTTP 표면 0) | Interface | Implemented | High | project maintainers | [req-025](./Interface/req-025_http-api-complete-removal.md) |
|
||||
| REQ-026 | messaging 레이어 baseline 문서 정합 | Documentation | Implemented | Medium | project maintainers | [req-026](./Documentation/req-026_messaging-baseline-alignment.md) |
|
||||
|
||||
## Recent Change Log Summary
|
||||
|
||||
- 2026-06-05 :: REQ-021~026 Approved → Implemented — BAT-007 release-candidate verification evidence 기반. (confirm-req-implemented)
|
||||
- 2026-06-05 :: REQ-021~026 Proposed -> Approved — 승인 게이트 통과. (confirm-req)
|
||||
- 2026-06-05 :: REQ-021~026 최초 생성(Proposed) — dcy-006 FR-1~FR-6 분해(NFR-1 → REQ-022 흡수, NFR-2 → REQ-023 흡수, NFR-3 → REQ-024 승격). (draft-req)
|
||||
- 2026-06-04 :: REQ-017~020 Approved → Implemented — BAT-006 release-candidate verification evidence 기반. (confirm-req-implemented)
|
||||
- 2026-06-04 :: REQ-017~020 Proposed -> Approved — 승인 게이트 통과. (confirm-req)
|
||||
- 2026-06-04 :: REQ-017~020 최초 생성(Proposed) — dcy-004 FR-1~FR-5 분해(NFR-1~3 흡수). (draft-req)
|
||||
- 2026-06-04 :: REQ-016 생성 + Approved — KIS 토큰 Redis 캐시 (minor-change). (draft-req/confirm-req)
|
||||
- 2026-06-04 :: REQ-011~015 Approved → Implemented — BAT-004 verification evidence 기반. (confirm-req-implemented)
|
||||
|
||||
Reference in New Issue
Block a user