docs: approve dcy-037 emergency requirements
This commit is contained in:
+2
-2
@@ -4,10 +4,10 @@
|
||||
- 문서 ID: dcy-037_20260714_operator-broker-truth-and-managed-slot-divergence-hotfix
|
||||
- 이슈명: HOTFIX — fetched credential 운영자 broker truth 정합 및 managed non-holding divergence 분리 (#39, #40, #41)
|
||||
- 작성 시각(KST): 2026-07-14 21:52:01 KST
|
||||
- 마지막 갱신 시각(KST): 2026-07-14 21:59:00 KST (confirm-discovery)
|
||||
- 마지막 갱신 시각(KST): 2026-07-14 22:24:41 KST (draft-req)
|
||||
- 대체됨: 없음
|
||||
- 후속 Discovery 참조: 없음
|
||||
- 생성된 REQ 참조: 없음
|
||||
- 생성된 REQ 참조: REQ-119, REQ-120, REQ-121, REQ-122
|
||||
|
||||
# 1. 계획 상태 요약
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
# REQ-121: managed non-holding divergence 분류와 slot 존재 조회 계약
|
||||
|
||||
- Status: Approved
|
||||
- Type: Data
|
||||
- Priority: High
|
||||
- Owner: trex-core-dev
|
||||
|
||||
## Intent
|
||||
- broker-held symbol을 holding slot만으로 비교하면 동일 instance에 `inactive` 또는 `error` managed slot이 존재하는 경우도 true unmanaged position으로 잘못 분류된다.
|
||||
- holding 수량 대조의 기존 의미론을 보존하면서, unmatched broker holding의 managed slot 존재 여부를 repository parity로 확인해 안전한 triage classification을 제공한다.
|
||||
|
||||
## Requirement
|
||||
- 시스템은 `reconcile_core_holdings()`에서 broker-held symbol이 holding slot에 매칭되지 않을 때 동일 instance의 관리 slot 존재 여부를 조회해야 한다.
|
||||
- slot이 전혀 없으면 기존 `unmanaged_position` 분류를 유지하고, slot은 존재하지만 non-holding 상태이면 `managed_non_holding_divergence`로 별도 분류해야 한다.
|
||||
- 이 분류는 slot 상태 전이, warning 자동 해제, 자동 매매, 자동 청산 또는 unmanaged holding의 자동 slot 생성을 유발하지 않아야 하며, 상태 수렴은 기존 승인 gate의 검증된 `sync` 경로에만 맡겨야 한다.
|
||||
- SlotRepository Protocol과 PostgreSQL/InMemory 구현은 instance-scoped managed-slot existence query에 대해 동등한 결과를 제공해야 한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given broker-held symbol에 대해 대상 instance에 어떤 slot도 없음, When `reconcile_core_holdings()`를 실행하면, Then `unmanaged_position` decision code와 기존 safe warning semantics가 유지된다.
|
||||
2. Given broker-held symbol에 대해 같은 instance의 slot이 `inactive` 또는 `error`이고 holding slot은 없음, When `reconcile_core_holdings()`를 실행하면, Then `managed_non_holding_divergence` decision code와 `slot_id`, `portfolio_id`, `symbol`, `status`, `instance_key`의 구조화·비밀 없는 triage context가 남는다.
|
||||
3. Given matching holding slot 또는 holding qty mismatch, When `reconcile_core_holdings()`를 실행하면, Then 각각 기존 match 및 mismatch path가 유지되고 non-holding divergence로 재분류되지 않는다.
|
||||
4. Given AC-1~3 fixture, When reconciliation 후 slot 및 warning persistence를 검사하면, Then managed non-holding 분류만으로 slot state write, warning 자동 해제, 자동 매매, 자동 청산 또는 unmanaged slot 생성이 발생하지 않는다.
|
||||
5. Given PostgreSQL 및 InMemory SlotRepository, When 같은 instance/symbol/portfolio fixture로 managed-slot existence query를 실행하면, Then 두 구현이 같은 존재 여부와 instance isolation 결과를 반환한다.
|
||||
6. Given 다른 instance에만 같은 symbol 또는 portfolio_id slot이 존재함, When reconciliation을 실행하면, Then 그것은 대상 instance의 managed slot으로 취급되지 않는다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: `docs/runtime-flows.md`, `docs/interface-contract.md`, `docs/operations.md`, `docs/srs/Integration/req-103_blocking-reconcile-b-c-cases.md`, `docs/srs/Interface/req-105_sync-cli-command.md`
|
||||
- Modules: `trex_core/application/reconciliation.py`, `trex_core/domain/slot/repository.py`, `trex_core/adapters/persistence/postgresql.py`, `trex_core/domain/slot/in_memory_repository.py`
|
||||
- Tests: reconciliation 4-case regression matrix; PostgreSQL/InMemory repository parity; instance isolation; no-auto-write/no-auto-remediation assertions
|
||||
|
||||
## Notes
|
||||
- Source Discovery: `docs/discovery/dcy-037_20260714_operator-broker-truth-and-managed-slot-divergence-hotfix.md` (FR-4~5, NFR-2~4; GitHub #41).
|
||||
- Existing `list_holding_slots(instance_key)` is holding-only evidence; this REQ adds the separate managed-slot existence decision needed only after an unmatched broker holding.
|
||||
- This is additive classification. `sync --live` target selection and execution remain release-gated and out of scope.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260714-01
|
||||
- Date: 2026-07-14
|
||||
- Author: delivery-runner
|
||||
|
||||
#### Change Summary
|
||||
- dcy-037 #41의 managed non-holding divergence와 repository query parity를 Proposed REQ로 초안화했다.
|
||||
|
||||
#### Intent
|
||||
- 진짜 unmanaged broker holding과 이미 관리되는 non-holding slot divergence를 혼동하지 않도록 한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 4-case reconciliation matrix, repository parity/instance isolation, additive no-auto-remediation constraints.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- reconcile decision 및 operator triage baseline.
|
||||
- Modules:
|
||||
- reconciliation 및 slot repository protocol/implementations.
|
||||
- Tests:
|
||||
- application classification 및 DB/in-memory parity regression.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none (draft only; dcy-037 emergency scope의 향후 입력).
|
||||
- Releases:
|
||||
- none (production read/write 또는 live sync 실행 없음).
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 전 decision-code naming과 existing warning/alert inventory compatibility를 검토한다.
|
||||
|
||||
#### Validation Plan
|
||||
- isolated four-case fixture와 PostgreSQL/InMemory parity suite에서 classification, structured context, instance scope 및 no-write invariant를 검증한다.
|
||||
|
||||
### CHG-20260714-02
|
||||
- Date: 2026-07-14
|
||||
- Author: Justin (TREX lead)
|
||||
|
||||
#### Change Summary
|
||||
- Proposed에서 Approved로 승인했다.
|
||||
|
||||
#### Intent
|
||||
- dcy-037 #41의 additive classification을 기존 holding mismatch와 unmanaged semantics를 보존하는 delivery input으로 확정한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 없음.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- 없음.
|
||||
- Modules:
|
||||
- 없음.
|
||||
- Tests:
|
||||
- 없음.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- dcy-037의 #39/#40/#41 단일 emergency batch (아직 미생성).
|
||||
- Releases:
|
||||
- none; `sync --live`는 별도 release approval gate 유지.
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: suggest-batch-reqs에서 REQ-119/120과 함께 emergency batch로 편성한다.
|
||||
|
||||
#### Validation Plan
|
||||
- batch verification과 독립 QC에서 4-case matrix, repository parity, instance isolation 및 no-auto-remediation AC를 재검증한다.
|
||||
@@ -0,0 +1,116 @@
|
||||
# REQ-122: operator broker truth HOTFIX baseline 및 remediation 문서 정합
|
||||
|
||||
- Status: Approved
|
||||
- Type: Documentation
|
||||
- Priority: High
|
||||
- Owner: trex-core-dev
|
||||
|
||||
## Intent
|
||||
- fetched credential source, balance failure semantics 및 managed/non-managed divergence의 의미가 runtime, interface, operations baseline에 없으면 운영자가 dry-run 결과를 잘못 해석하거나 승인 없는 live sync를 실행할 수 있다.
|
||||
- 구현된 계약을 기준으로 operator triage와 release gate를 문서화하되, production live sync 실행 자체는 이 REQ에 포함하지 않는다.
|
||||
|
||||
## Requirement
|
||||
- 시스템 문서는 구현 완료 후 daemon/operator fetched credential source parity, sanitized broker-read failure semantics, token/broker lifecycle 운영 제약, reconciliation decision code 및 managed non-holding triage 절차를 실제 구현과 일치하게 기술해야 한다.
|
||||
- 운영 문서는 dry-run → broker/ledger/slot cross-check → 사장님 명시 approval → single-target `sync --live --yes` → re-reconcile 순서를 release gate로 명시하고, live sync 실행 명령이나 특정 production target을 승인·자동화하지 않아야 한다.
|
||||
- 문서의 예시, 로그 키 및 fixture 설명은 credential, token, app secret, raw account number 및 raw credential payload를 포함하지 않아야 한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given REQ-119~121 구현과 검증 evidence, When `docs/runtime-flows.md`를 갱신하면, Then daemon/operator broker-read 공통 provider, failure가 empty balance가 아님, reconciliation의 `unmanaged_position`/`managed_non_holding_divergence` 분기와 no-auto-remediation 경계가 구현과 일치한다.
|
||||
2. Given REQ-119~121 구현과 검증 evidence, When `docs/interface-contract.md`를 갱신하면, Then operator CLI의 broker-read failure exit semantics, safe observable fields 및 repository/reconciliation 계약 변화가 구현과 일치하고 외부 wire 계약의 변경 여부가 명시된다.
|
||||
3. Given 운영자 remediation 문서, When `docs/operations.md`를 갱신하면, Then dry-run evidence, source/account reference masking, failure hold, broker/ledger/slot cross-check 및 explicit release approval gate가 순서대로 제시되고 승인 없는 `sync --live` 실행을 지시하지 않는다.
|
||||
4. Given 문서 예시와 로그/JSON 샘플, When secret scan 또는 리뷰를 수행하면, Then token, authorization header, app key/app secret, raw credential payload 및 raw account number가 없다.
|
||||
5. Given 문서의 명령/decision code/reference, When implementation tests 및 CLI help와 대조하면, Then 존재하지 않는 명령·code·source mode를 사실처럼 기술하지 않고, unresolved lifecycle implementation choice는 검증된 정책으로 확정된 뒤에만 구체화한다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: `docs/runtime-flows.md`, `docs/interface-contract.md`, `docs/operations.md`, `docs/project-structure.md`, `docs/srs/index.md`, REQ-119~121
|
||||
- Modules: none (documentation-only requirement; implementation facts are supplied by REQ-119~121)
|
||||
- Tests: markdown link/reference check; documented CLI/help and decision-code review; secret scan; implementation-evidence cross-check
|
||||
|
||||
## Notes
|
||||
- Source Discovery: `docs/discovery/dcy-037_20260714_operator-broker-truth-and-managed-slot-divergence-hotfix.md` (FR-6, S-4; GitHub #39/#40/#41).
|
||||
- OQ-2 lifecycle mechanism is documented only after an evidence-backed implementation decision; this REQ does not mandate process-local reuse, shared cache, or another mechanism.
|
||||
- OQ-3 production live sync target is a release approval record, not a documentation authorization or execution task.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260714-01
|
||||
- Date: 2026-07-14
|
||||
- Author: delivery-runner
|
||||
|
||||
#### Change Summary
|
||||
- dcy-037 #39/#40/#41 HOTFIX의 baseline/운영 정합 문서를 독립 Proposed REQ로 초안화했다.
|
||||
|
||||
#### Intent
|
||||
- 안전한 broker truth triage를 구현 사실 및 release gate와 동기화한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- runtime/interface/operations alignment, approval-gated remediation, secret-safe examples 및 evidence-only lifecycle documentation.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- runtime, interface, operations, project structure 및 SRS traceability.
|
||||
- Modules:
|
||||
- none.
|
||||
- Tests:
|
||||
- markdown/reference, CLI/code evidence 및 secret scan review.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none (draft only; dcy-037 emergency scope의 향후 입력).
|
||||
- Releases:
|
||||
- none (release gate 문서화만 포함; production live sync 실행 없음).
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: REQ-119~121 구현 verification evidence가 준비된 뒤 baseline 문서를 갱신하고 cross-check한다.
|
||||
|
||||
#### Validation Plan
|
||||
- implemented CLI/help, structured decision codes, test evidence 및 markdown 링크를 대조하고 secret scan을 통과시킨다.
|
||||
|
||||
### CHG-20260714-02
|
||||
- Date: 2026-07-14
|
||||
- Author: Justin (TREX lead)
|
||||
|
||||
#### Change Summary
|
||||
- Proposed에서 Approved로 승인했다.
|
||||
|
||||
#### Intent
|
||||
- dcy-037의 runtime/interface/operations alignment와 release-gated remediation 경계를 implementation evidence 이후 갱신할 delivery input으로 확정한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 없음.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- 없음.
|
||||
- Modules:
|
||||
- 없음.
|
||||
- Tests:
|
||||
- 없음.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- dcy-037의 #39/#40/#41 단일 emergency batch (아직 미생성).
|
||||
- Releases:
|
||||
- none; documentation은 live sync 실행을 승인하지 않는다.
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: implementation/verification evidence가 준비된 뒤 baseline과 runbook을 갱신한다.
|
||||
|
||||
#### Validation Plan
|
||||
- batch verification과 독립 QC에서 actual CLI/help, decision code, tests, markdown links 및 secret scan으로 AC를 재검증한다.
|
||||
@@ -0,0 +1,117 @@
|
||||
# REQ-120: KIS balance 인증 실패 fail-loud 및 broker/token lifecycle 정책
|
||||
|
||||
- Status: Approved
|
||||
- Type: Exception
|
||||
- Priority: High
|
||||
- Owner: trex-core-dev
|
||||
|
||||
## Intent
|
||||
- 현재 KIS balance 조회의 token/auth/transport 실패가 빈 잔고와 같은 `[]`로 해석되면 `broker_qty_zero`, sync skip 또는 잘못된 reconcile 판단으로 이어질 수 있다.
|
||||
- 실제 empty holdings와 broker-read 실패를 명확히 분리하고, fetched credential operator 경로의 token/broker lifecycle을 throttle-safe·secret-safe 제약 아래 설계 가능하게 한다.
|
||||
|
||||
## Requirement
|
||||
- 시스템은 KIS token issuance, authentication/authorization, HTTP transport 및 malformed balance response 실패를 성공적인 empty balance와 구별되는 typed 또는 동등하게 식별 가능한 sanitized failure로 표면화해야 한다.
|
||||
- `sync`/`verify`를 포함한 operator broker-read 경로는 이러한 실패 시 비0 종료하고 `broker_qty_zero`, sync skip, verify success 또는 slot state write를 생성하지 않아야 한다.
|
||||
- fetched credential broker/token lifecycle의 구현 설계는 다음 제약을 충족해야 한다: ownership 경계와 재사용 범위가 명시될 것, 반복 read가 매번 fresh broker/token을 강제해 throttle을 유발하지 않을 것, retry 여부·횟수·backoff/즉시 실패 기준이 failure class별로 문서화될 것, token/credential은 로그·CLI JSON·fixture에 기록되지 않을 것.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given KIS token issuance, auth/authorization, transport 또는 malformed response failure fixture, When `get_balance()`와 `sync --dry-run` 또는 `verify`를 실행하면, Then 성공 empty balance와 구별되는 sanitized failure가 반환되고 CLI는 비0으로 종료한다.
|
||||
2. Given AC-1의 각 failure, When 결과와 persistence/log side effect를 검사하면, Then `broker_qty_zero`, sync skip, verify success, slot state write 또는 empty-holdings 판정이 생성되지 않는다.
|
||||
3. Given 정상적으로 성공한 KIS balance response가 실제로 holdings 없이 반환됨, When 동일 경로를 실행하면, Then success empty balance semantics는 auth/transport failure와 구별되어 기존 정상 판단이 유지된다.
|
||||
4. Given 반복 fetched-credential broker read와 token throttle 재현 fixture, When 구현된 lifecycle 정책을 적용해 읽기를 수행하면, Then fresh-object 생성이 반복되어 throttle을 유발하는 경로에 의존하지 않고, throttle이 발생해도 fail-loud semantics가 유지된다.
|
||||
5. Given lifecycle 설계 검토, When implementation-ready decision을 기록하면, Then ownership/reuse scope, cache 또는 reuse 무효화 조건, failure class별 retry/no-retry 정책 및 regression test seam이 명시되며 process-local reuse, shared cache 또는 다른 공통 provider 중 특정 방식을 사전 근거 없이 요구하지 않는다.
|
||||
6. Given 오류 출력, 구조화 로그 및 테스트 artifact, When auth/token failure를 검증하면, Then token, authorization header, app key/app secret, raw credential payload 및 raw account number가 노출되지 않는다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: `docs/runtime-flows.md`, `docs/interface-contract.md`, `docs/operations.md`, `docs/srs/Non-Functional/req-115_daystart-intraday-resilience-credential-cache.md`
|
||||
- Modules: `trex_core/adapters/broker/kis.py`, `trex_core/runtime/cli.py`, `trex_core/runtime/daemon.py`, 공통 broker provider/factory
|
||||
- Tests: KIS adapter unit tests; CLI failure/no-write tests; lifecycle/throttle regression fixture; sanitized logging/JSON assertions
|
||||
|
||||
## Notes
|
||||
- Source Discovery: `docs/discovery/dcy-037_20260714_operator-broker-truth-and-managed-slot-divergence-hotfix.md` (FR-2~3, OQ-2; GitHub #40).
|
||||
- REQ-115의 day-start/intraday cache 목표와 충돌하지 않아야 한다. 본 REQ는 OQ-2의 구현 방식을 확정하지 않고, 설계 선택의 안전 제약과 검증 가능한 결과를 고정한다.
|
||||
- Production live sync target 또는 실행은 OQ-3 release gate로서 범위 밖이다.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260714-01
|
||||
- Date: 2026-07-14
|
||||
- Author: delivery-runner
|
||||
|
||||
#### Change Summary
|
||||
- dcy-037 #40의 auth/token failure empty-balance masking과 OQ-2 lifecycle 제약을 Proposed REQ로 초안화했다.
|
||||
|
||||
#### Intent
|
||||
- false-zero 기반 상태 수렴을 막고 lifecycle 구현 선택을 근거 기반 설계 단계로 남긴다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- fail-loud/no-write, true-empty 분리, throttle 회귀, lifecycle decision constraints 및 secret-safe 증거.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- runtime/interface/operations 및 REQ-115 정합 대상.
|
||||
- Modules:
|
||||
- KIS adapter와 daemon/CLI broker-read 경계.
|
||||
- Tests:
|
||||
- failure injection, no-write, throttle 및 redaction regression.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none (draft only; dcy-037 emergency scope의 향후 입력).
|
||||
- Releases:
|
||||
- none (production 접근 또는 live sync 실행 없음).
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 전 현재 KIS token cache와 daemon/CLI lifetime evidence를 설계 결정에 연결한다.
|
||||
|
||||
#### Validation Plan
|
||||
- mocked KIS failure classes와 repeated-read throttle fixture에서 exit code, semantic result, no-write 및 artifact redaction을 확인한다.
|
||||
|
||||
### CHG-20260714-02
|
||||
- Date: 2026-07-14
|
||||
- Author: Justin (TREX lead)
|
||||
|
||||
#### Change Summary
|
||||
- Proposed에서 Approved로 승인했다.
|
||||
|
||||
#### Intent
|
||||
- dcy-037 #40의 false-zero 방지와 OQ-2 lifecycle 설계 제약을 구현 가능한 safety contract로 확정한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 없음.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- 없음.
|
||||
- Modules:
|
||||
- 없음.
|
||||
- Tests:
|
||||
- 없음.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- dcy-037의 #39/#40/#41 단일 emergency batch (아직 미생성).
|
||||
- Releases:
|
||||
- none; `sync --live`는 별도 release approval gate 유지.
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: batch design에서 lifecycle ownership/reuse와 failure-class별 retry 정책을 code evidence로 결정한다.
|
||||
|
||||
#### Validation Plan
|
||||
- batch verification과 독립 QC에서 failure/no-write·true-empty·throttle·redaction AC를 실제 fixture로 재검증한다.
|
||||
@@ -0,0 +1,116 @@
|
||||
# REQ-119: fetched credential 공통 broker provider와 operator CLI truth 정합
|
||||
|
||||
- Status: Approved
|
||||
- Type: Integration
|
||||
- Priority: High
|
||||
- Owner: trex-core-dev
|
||||
|
||||
## Intent
|
||||
- `credential_fetch_enabled=true` 인스턴스에서 daemon과 operator `sync`/`verify`가 서로 다른 credential source로 브로커를 생성하면, 같은 인스턴스의 broker truth를 신뢰할 수 없다.
|
||||
- daemon과 모든 operator broker-read 경로가 동일한 portfolio-hub fetched credential authority를 해석하도록 하되, 자격증명·계좌 식별 비밀은 노출하지 않는다.
|
||||
|
||||
## Requirement
|
||||
- 시스템은 fetched credential 모드에서 daemon, `sync`, `verify` 및 같은 broker-read provider를 사용하는 operator 경로가 공통 broker provider를 통해 동일한 portfolio-hub credential source를 해석하도록 해야 한다.
|
||||
- fetch 실패 시 명시적으로 활성화된 break-glass 정책이 없는 한 env/config credential로 조용히 fallback하지 않아야 하며, `credential_fetch_enabled=false` 인스턴스의 기존 env-only 동작은 유지해야 한다.
|
||||
- provider가 source/account identity 정합 증거를 노출해야 할 경우 비밀이 아닌 stable label 또는 마스킹된 fingerprint만 사용해야 한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given `credential_fetch_enabled=true`와 mocked portfolio-hub credential 응답, When daemon-equivalent broker 구성과 `sync --dry-run` 및 `verify`의 broker-read 구성을 실행하면, Then 모두 같은 fetched source identity(안전한 label/fingerprint)와 같은 broker holding set을 사용한다.
|
||||
2. Given fetched credential 모드에서 portfolio-hub fetch가 실패하고 break-glass가 비활성화됨, When operator broker-read 경로를 실행하면, Then env/config credential fallback이나 broker qty 기반 판단 없이 안전한 오류로 중단한다.
|
||||
3. Given fetched credential 모드에서 명시적인 break-glass 정책이 활성화됨, When fetch가 실패하면, Then fallback의 활성화 근거와 source mode는 비밀 없이 추적 가능하고, 명시적 정책이 없을 때와 구별된다.
|
||||
4. Given `credential_fetch_enabled=false` env-only instance, When daemon과 기존 operator broker-read 경로를 실행하면, Then fetched credential 요청 없이 기존 동작 및 CLI 호환성이 유지된다.
|
||||
5. Given CLI 출력·구조화 로그·테스트 fixture, When source 정합 검증을 수행하면, Then app key, app secret, access token, raw credential payload 및 raw account number가 포함되지 않는다.
|
||||
|
||||
## Impacted Area
|
||||
- Docs: `docs/runtime-flows.md`, `docs/interface-contract.md`, `docs/operations.md`, `docs/srs/Integration/req-112_portfolio-hub-broker-credential-read-adapter.md`, `docs/srs/Configuration/req-113_kisconfig-fetch-source-priority-and-break-glass.md`
|
||||
- Modules: `trex_core/runtime/daemon.py`, `trex_core/runtime/cli.py`, `trex_core/application/snapshot_scheduler.py` 또는 공통 broker provider/factory, portfolio-hub credential read adapter
|
||||
- Tests: daemon/provider/CLI integration regression; fetched source parity, fetch failure/no-silent-fallback, opt-in off env-only compatibility, secret-redaction assertions
|
||||
|
||||
## Notes
|
||||
- Source Discovery: `docs/discovery/dcy-037_20260714_operator-broker-truth-and-managed-slot-divergence-hotfix.md` (FR-1, NFR-1~4; GitHub #39).
|
||||
- Dependencies: REQ-112 implemented credential read port; REQ-113 approved source priority/break-glass policy; REQ-115 approved day-start credential resilience.
|
||||
- OQ-3의 production live sync target 선정·실행은 release gate이며 본 REQ 범위가 아니다.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260714-01
|
||||
- Date: 2026-07-14
|
||||
- Author: delivery-runner
|
||||
|
||||
#### Change Summary
|
||||
- dcy-037 #39의 fetched credential daemon/operator broker truth mismatch를 독립 Proposed REQ로 초안화했다.
|
||||
|
||||
#### Intent
|
||||
- fetched credential authority를 공통 provider 경계로 정렬하여 dry-run/verify 결과가 daemon broker truth와 동일한 source를 사용하게 한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- fetched provider source parity, no-silent-fallback, break-glass 구별, env-only 회귀 및 secret-safe 관찰성 기준.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- runtime/interface/operations baseline 및 REQ-112/113 참조 정합 대상.
|
||||
- Modules:
|
||||
- daemon/CLI 및 공통 broker 구성 경계.
|
||||
- Tests:
|
||||
- mocked fetched credential 기반 parity와 회귀 테스트.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- none (draft only; dcy-037 #39/#40/#41 단일 emergency batch의 향후 입력).
|
||||
- Releases:
|
||||
- none (production release/live sync 승인 대상 아님).
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 전 공통 provider 경계와 REQ-113/115 의존 관계를 검토한다.
|
||||
|
||||
#### Validation Plan
|
||||
- isolated fixture에서 daemon-equivalent, `sync --dry-run`, `verify`의 source identity와 holding set을 비교하고, fetch failure·break-glass·env-only 분기를 회귀 검증한다.
|
||||
|
||||
### CHG-20260714-02
|
||||
- Date: 2026-07-14
|
||||
- Author: Justin (TREX lead)
|
||||
|
||||
#### Change Summary
|
||||
- Proposed에서 Approved로 승인했다.
|
||||
|
||||
#### Intent
|
||||
- dcy-037에서 확정된 #39 broker truth 정합 범위를 독립 delivery input으로 전환한다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- 없음.
|
||||
- Updated:
|
||||
- 없음.
|
||||
- Removed:
|
||||
- 없음.
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- 없음.
|
||||
- Modules:
|
||||
- 없음.
|
||||
- Tests:
|
||||
- 없음.
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- dcy-037의 #39/#40/#41 단일 emergency batch (아직 미생성).
|
||||
- Releases:
|
||||
- none; `sync --live`는 별도 release approval gate 유지.
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: suggest-batch-reqs에서 REQ-119~122를 단일 emergency batch로 편성한다.
|
||||
|
||||
#### Validation Plan
|
||||
- batch verification과 독립 QC에서 parity·fallback·redaction AC를 실제 fixture와 CLI 회귀로 재검증한다.
|
||||
+7
-1
@@ -74,7 +74,7 @@
|
||||
|
||||
## Next Requirement ID
|
||||
|
||||
- Current: `REQ-119`
|
||||
- Current: `REQ-123`
|
||||
- Rule: `Requirement Register`에 있는 가장 큰 REQ 번호보다 정확히 1 커야 한다.
|
||||
|
||||
## Requirement Register
|
||||
@@ -199,9 +199,15 @@
|
||||
| REQ-116 | `trex.slots.req` 전략 필드 노출 + `strategy` 요청 필터 (additive) | Interface | Implemented | High | trex-core-dev | [req-116](./Interface/req-116_slots-req-strategy-field-and-filter.md) |
|
||||
| REQ-117 | OrderRequest venue additive 필드 (KRX/NXT 거래소구분 포트 DTO) | Integration | Implemented | High | trex-core-dev | [req-117](./Integration/req-117_order-request-venue-field.md) |
|
||||
| REQ-118 | KIS 브로커 어댑터 venue 파라미터화 — EXCG_ID_DVSN_CD 전송 + NXT 지원 | Integration | Implemented | High | trex-core-dev | [req-118](./Integration/req-118_kis-broker-venue-parameterization.md) |
|
||||
| REQ-119 | fetched credential 공통 broker provider와 operator CLI truth 정합 | Integration | Approved | High | trex-core-dev | [req-119](./Integration/req-119_fetched-credential-broker-provider-cli-parity.md) |
|
||||
| REQ-120 | KIS balance 인증 실패 fail-loud 및 broker/token lifecycle 정책 | Exception | Approved | High | trex-core-dev | [req-120](./Exception/req-120_kis-balance-auth-failure-fail-loud-lifecycle-policy.md) |
|
||||
| REQ-121 | managed non-holding divergence 분류와 slot 존재 조회 계약 | Data | Approved | High | trex-core-dev | [req-121](./Data/req-121_managed-non-holding-divergence-classification-query.md) |
|
||||
| REQ-122 | operator broker truth hotfix baseline 문서 정합 | Documentation | Approved | High | trex-core-dev | [req-122](./Documentation/req-122_operator-broker-truth-hotfix-baseline-alignment.md) |
|
||||
|
||||
## Recent Change Log Summary
|
||||
|
||||
- 2026-07-14 :: REQ-119~122 **승인(Approved, confirm-req, dcy-037)**: lead 검토로 각 REQ의 owner·priority·scope·검증 가능 AC와 Notes의 non-blocking 설계 제약을 확인했다. #39/#40/#41은 다음 `suggest-batch-reqs`에서 단일 emergency batch 후보이며, `sync --live`는 여전히 별도 release approval gate다.
|
||||
- 2026-07-14 :: REQ-119~122 **신규 생성(Proposed, draft-req, dcy-037)**: #39 fetched credential daemon/operator broker truth parity, #40 token/auth fail-loud empty-balance 분리, #41 managed non-holding divergence classification, runtime/interface/operations baseline 정합. #39/#40/#41 단일 emergency batch 및 `sync --live` 별도 release approval gate를 유지한다.
|
||||
- 2026-07-06 :: REQ-117/118 **신규 생성(Implemented, draft-req, trex-tvr-v1 dcy-002 FR-6)**: KIS 브로커 venue 파라미터화 — REQ-117 OrderRequest.venue additive 필드(기본 KRX, 포트 DTO 계층), REQ-118 KIS 어댑터 EXCG_ID_DVSN_CD 전송 + cancel venue 의미론 + poll_fill NXT 체결 보장 + get_current_price market 파라미터화. 실측 근거: 2026-07-06 실전 NXT 주문/취소 rt_cd=0. 고위험(라이브 주문 경로) — worktree+PR+QC(opus) 필수. confirm-req 대기.
|
||||
- 2026-07-04 :: REQ-116 **신규 생성(Implemented, draft-req, trex-tvr-v1 dcy-001/dcy-002 v3 FR-8)**: `trex.slots.req` additive 확장 — 행 `strategy_name`·`strategy_params`·`markets` 필드 노출(hub 정본, safe-default) + 요청 `strategy` 필터(exact-match, status 필터 AND 조합, available_slots 불변). REQ-074 AC-5 additive 재도입(dcy-025 OQ-4 후속). 라이브 wire 계약 고위험 — worktree+PR+QC 정식 플로, 배포 선행조건=portfolio-hub REQ① 먼저.
|
||||
- 2026-06-28 :: REQ-112/114 **`Approved` → `Implemented`**, REQ-113/115 **`Approved` 유지(confirm-req-implemented, dcy-036/BAT-053)**: BAT-053 PR #34 머지(01655ab). QC PASS-WITH-NOTES(opus, blocker 0). 745 passed/0 회귀. REQ-112(fetch 포트+어댑터+stub AC-1~8 완료), REQ-114(fail-closed 게이트 AC-1~9, BuyIntent 차단/SellIntent 통과 비대칭·CRITICAL 알람·opt-in off 비활성 완료). REQ-113/115 스캐폴드 완료 — KISBroker 런타임 재조립(REQ-113 AC-2, REQ-115 AC-1) M3 후속 batch 연기.
|
||||
|
||||
Reference in New Issue
Block a user