# REQ-119: fetched credential 공통 broker provider와 operator CLI truth 정합 - Status: Implemented - 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 회귀로 재검증한다. ### CHG-20260715-03 - Date: 2026-07-15 - Author: TREX lead #### Change Summary - Approved → Implemented (`confirm-req-implemented`). #### Delivery Trace - BAT-057 verification confirmed; PR #42 merged to `main` as `94e148940adb008db0bbd215052a1e984f7c566b`. - Independent QC: PASS-WITH-NOTES, acceptance blocker 0. Production live sync/deploy remains a separate release gate.