fix(intents): isolate alarm context lookup and sanitize alarm failure logs
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
5dd3d57f86
commit
1ca9e60c98
@@ -0,0 +1,19 @@
|
||||
---
|
||||
id: "ac-0025"
|
||||
status: active
|
||||
---
|
||||
|
||||
# 최초 `reconcile_warned` strategy intent 거부 알림
|
||||
|
||||
## Criterion
|
||||
|
||||
재조정 경고가 설정된 slot에서 외부 전략 buy/sell intent가 `rejected/reconcile_warned`로 최종 확정되면, `IntentStore.finalize()` 이후에만 `trex.alerts`로 `strategy_intent_rejected`/`warn` 알림을 intent_id 기준 최초 1회 발행해야 한다. 같은 `intent_id` 재요청과 처리 중 중복(`duplicate_in_flight`)은 추가 알림을 만들지 않으며, 같은 slot의 서로 다른 `intent_id`는 각각 독립 발행한다. 알림 payload는 필수 allowlist fields를 항상 포함하고 optional fields는 신뢰 가능한 값이 있을 때만 포함해야 하며, 비허용 필드·민감정보·raw exception body를 alarm/log에 포함해서는 안 된다. emitter 부재/전송 실패/optional context 조회 실패는 저장된 거부 결과와 RPC 응답, broker·slot·warning·ledger·portfolio-hub 동작을 바꾸지 않는 best-effort 경계여야 한다. daemon은 기존 공용 `AlarmEmitter`를 `IntentService`에 주입하고, emitter 없이 `IntentService`를 생성하는 기존 경로는 계속 호환되어야 한다.
|
||||
|
||||
## Verification
|
||||
|
||||
- 성공 조건: warned slot의 새 buy/sell intent 각각에서 finalize 후 `strategy_intent_rejected`/`warn` 알림이 한 건 발행된다.
|
||||
- dedup 조건: 같은 `intent_id` 재시도(동일 process 및 durable-store 재구성 후)에서 추가 알림이 없고, 같은 slot의 다른 `intent_id`는 각각 한 건 발행한다.
|
||||
- 예외 경계: `duplicate_in_flight`, admitted, `reconcile_warning_unavailable`, `capacity_full`, validation rejection, 그 밖의 non-`reconcile_warned` rejection에서는 알림이 없어야 한다.
|
||||
- 순서/실패 조건: finalize 실패 시 알림이 없어야 하며 finalize 완료 전에 publish가 실행되면 FAIL이다. optional context 조회 실패·publisher false·publisher exception·emitter 부재에서도 RPC 응답은 `rejected/reconcile_warned`를 유지해야 한다.
|
||||
- payload/보안 조건: 필수 fields와 `broker_submitted=false`가 포함되고, optional fields는 확인 가능 시에만 포함된다. buy/sell strategy id는 공통 `strategy_id`로 정규화되며 비허용 필드와 민감정보·raw exception body가 alarm/log에 없어야 한다.
|
||||
- wiring/회귀 조건: daemon이 공용 `AlarmEmitter`를 `IntentService`에 전달하고, emitter 없는 직접 생성 경로 및 기존 intent dedup/alarm 관련 회귀가 유지되어야 한다.
|
||||
Reference in New Issue
Block a user