Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
41 lines
2.8 KiB
Markdown
41 lines
2.8 KiB
Markdown
---
|
|
id: "req-0010"
|
|
status: approved
|
|
discovery: "dcy-0010"
|
|
criteria:
|
|
create:
|
|
- "ac-0029"
|
|
update: []
|
|
retire: []
|
|
satisfy: []
|
|
---
|
|
|
|
# Durable unmanaged-position lifecycle
|
|
|
|
## Objective
|
|
|
|
`trex-core`는 broker 계정에 존재하지만 대상 `instance_key`의 managed slot·ledger가 소유하지 않는 종목을 stateless warning이 아니라 durable unmanaged-position lifecycle로 추적해야 한다. Lifecycle은 authoritative broker balance를 근거로 `(instance_key, symbol)`별 최초 감지, 수량 변경, 마지막 관측, 해제, 운영자 disposition과 audit를 구분해야 하며, 반복 같은 수량 관측의 로그/알림 폭주를 억제해야 한다.
|
|
|
|
## Scope
|
|
|
|
- Unmanaged identity는 `(instance_key, symbol)`이며 다른 instance/account의 같은 symbol과 섞이지 않는다.
|
|
- Persistent state는 최소 `symbol`, `quantity`, `first_seen_at`, `last_seen_at`, `quantity_changed_at`, `resolved_at`, lifecycle state와 latest non-secret operator evidence/disposition을 제공한다.
|
|
- `reconcile_core_holdings()`는 authoritative broker snapshot에서 broker-only holding을 처음 보면 `detected`, 수량이 바뀌면 `quantity_changed`, 이전 active row가 authoritative snapshot에서 사라지면 `resolved`로 기록한다. 같은 수량 반복 관측은 state의 `last_seen_at`만 갱신한다.
|
|
- Broker 조회 실패, missing authoritative marker, projected ownership balance, filtered/partial reader 또는 self-report failure는 resolved authority가 아니다. 이런 입력 부재를 quantity 0이나 resolved로 해석하지 않는다.
|
|
- Runtime wiring은 주문/전략용 broker projection과 unmanaged reconciliation용 authoritative full-balance reader를 분리한다.
|
|
- 운영자 disposition은 explicit command와 `evidence_ref`를 요구하고 audit trail에 append한다. Caller-supplied arbitrary actor string은 현재 계약에 포함하지 않고 trusted local CLI identity만 기록한다.
|
|
- Resolved row가 다시 나타나면 `first_seen_at`은 유지하되 새 active lifecycle로 reopen한다. Audit history는 남기고 current operator disposition/evidence는 reset한다.
|
|
- Query surface는 current state list와 symbol별 audit trail을 모두 제공한다.
|
|
|
|
## Constraints
|
|
|
|
- 이 기능은 slot 생성, slot 상태 변경, warning 자동 삭제, synthetic BUY ledger, broker order submit/cancel 또는 manual holdings 원인 추정을 수행하지 않는다.
|
|
- `managed_non_holding_divergence`와 기존 reconcile warning lifecycle·clear authority는 유지한다.
|
|
- Normative Design Documents: 없음. 이 REQ와 AC-0029가 normative specification을 소유한다.
|
|
|
|
## Non-Goals
|
|
|
|
- Broker statement ingestion, manual holding 원인 판정, 자동 편입/자동 정정
|
|
- AMQP/portfolio-hub external wire 변경
|
|
- Ledger remediation, slot lifecycle 재설계, ownership model 변경
|