---
task_id: task-2359
type: plan
scope: task
created: 2026-05-02
updated: 2026-05-02
status: completed
---

# 계획서: task-2359

**task**: task-2359
**목표**: InsuRo 복합설계 Phase 3 — ohmymanager 캡처 history와 CRM customers 테이블 자동 매칭/등록
**승인**: 제이회장 2026-05-02 brainstorming + Phase 0 결정 6건 (시스템 3문서)
**근거**: `memory/plans/insuro-composite-design/` 시스템 3문서 + 메가 프로젝트 `customer-mgmt-integration/` Phase D

---

## 목표

캡처 시점에 (agent_id, customer_key_hash)로 customers를 조회하여:
1. 매칭 발견 → confirm 다이얼로그로 사용자 확인 후 매핑
2. 매칭 미발견 → 자동 신규 등록 (UPSERT 패턴)

CRM 페이지에 ohmymanager history 섹션 + 사후 수동 분리 UI 추가.

## 범위

### 포함
- 백엔드: POST /ohmy-capture 응답 확장 (match_candidate / auto_linked_customer)
- 신규 엔드포인트 4개: POST /link, POST /reassign, GET customers/{id}/ohmy-history, GET 응답 customer_id 노출
- helper: `upsert_customer_for_capture()` (idempotent, UNIQUE 23505 폴백)
- 프론트: CustomerMatchDialog, HistoryReassignDialog 컴포넌트
- CompositeDesign 자동 검출 통합 + CrmCustomers ohmy history Dialog 통합
- vitest 단위 테스트 (CustomerMatchDialog 5건 + HistoryReassignDialog 6건)

### 제외 (다음 페이즈 이후)
- DB 마이그레이션 신규 (Phase 0.5에서 모든 인프라 적용 완료)
- customers 평문 → 암호화 일괄 마이그레이션 (Phase B/메가 프로젝트)
- 모바일 대응, DOM 셀렉터 견고성 (Phase 4)

## 위임 계획

- 백엔드 (server/main.py, customer_match.py): **스바로그(dev6)** — 매칭 lookup + auto-link + 신규 엔드포인트 3개
- 프론트 (CustomerMatchDialog): **라다(dev6)** — 신규 컴포넌트 + CompositeDesign 통합
- 프론트 (HistoryReassignDialog + CrmCustomers): **이리스(dev6)** — 사후 수정 UI + CRM 페이지 통합
- 테스트: **벨레스(dev6)** — vitest 11건 신규
- 독립 검증: **마아트** — 차단 사항 점검

## 검증 기준

- [x] `python3 -m py_compile server/main.py server/customer_match.py` → exit 0
- [x] `npx tsc --noEmit` → 0 에러
- [x] `npm run build` → 빌드 성공
- [x] `npx vitest run src/components/composite/` → 16/16 PASS
- [x] Codex 사전 검증 → pass=true (low risk만, 차단 없음)
- [x] 마아트 독립 검증 → PASS(조건부) → 권고 1건 즉시 수정 → 차단 없음
- [ ] 회장 검증 (staging L1 4가지 시나리오) → 머지 후 진행
