From 5af41a95d100fafefc60646fdff87cfb3ccf4df7 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:23:03 +0000 Subject: [PATCH 01/23] forge: open work branch for role-pm-live-1522-001-attempt-1-run-3980dffa3ff4 --- .forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md diff --git a/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md b/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md new file mode 100644 index 0000000..adc3e67 --- /dev/null +++ b/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md @@ -0,0 +1,3 @@ +# role-pm-live-1522-001-attempt-1-run-3980dffa3ff4 + +Forge 이슈 작업 브랜치 `forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4`. From 48140bce836d004be5a6ffec3434f45364e22cec Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:23:09 +0000 Subject: [PATCH 02/23] =?UTF-8?q?PM=20=EC=97=AD=ED=95=A0=20=EC=9D=B8?= =?UTF-8?q?=EC=88=98=EC=9D=B8=EA=B3=84=20=EB=AC=B8=EC=84=9C=20smoke=20(rol?= =?UTF-8?q?e-pm-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/handover/PM_ROLE_HANDOVER.md | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 docs/handover/PM_ROLE_HANDOVER.md diff --git a/docs/handover/PM_ROLE_HANDOVER.md b/docs/handover/PM_ROLE_HANDOVER.md new file mode 100644 index 0000000..d004309 --- /dev/null +++ b/docs/handover/PM_ROLE_HANDOVER.md @@ -0,0 +1,64 @@ +# PM 역할 인수인계 문서 (Smoke) + +**프로젝트**: runtime-role-matrix-live-202607141522 +**작성일**: 2025-01-15 +**작성자**: PM + +--- + +## 1. 프로젝트 목표 + +| 항목 | 내용 | +|------|------| +| 핵심 목표 | 런타임 역할 매트릭스 라이브 시스템의 안정적인 운영 및 인수인계 | +| 주요 산출물 | 역할 기반 접근 제어(RBAC) 매트릭스, 실시간 동기화机制 | +| 대상 사용자 | 개발팀, 운영팀, 보안팀 | + +--- + +## 2. 완료 기준 + +- [ ] 역할 매트릭스 설정 파일 검증 완료 +- [ ] 런타임 동기화 테스트 통과 +- [ ] 문서화 완료 (API, 설정, 장애 대응) +- [ ] 인수인계 리허설 완료 + +--- + +## 3. 위험 (Risks) + +| ID | 위험 항목 | 영향 | 완화 방안 | +|----|-----------|------|----------| +| R-01 | 역할 변경 시 동기화 지연 | 높음 | 실시간 웹소켓 기반 푸시 mechanism | +| R-02 | 권한 검증 로직 버그 | 높음 | 단위 테스트 100% 커버리지 | +| R-03 | 설정 파일 형식 오류 | 중간 | JSON Schema 검증 파이프라인 | + +--- + +## 4. 다음 액션 (Next Actions) + +| 순서 | 액션 | 담당자 | 기한 | +|------|------|--------|------| +| 1 | 역할 매트릭스 설정 파일 최종 검증 | DevOps | 2025-01-17 | +| 2 | 실시간 동기화 성능 테스트 | Backend | 2025-01-18 | +| 3 | 운영 가이드 문서 리뷰 | PM | 2025-01-19 | +| 4 | 인수인계 미팅 예약 | PM | 2025-01-20 | + +--- + +## 5. 주요 연락처 + +| 역할 | 이름 | 연락처 | +|------|------|--------| +| PM | - | - | +| Tech Lead | - | - | +| DevOps | - | - | + +--- + +## 6. 리포지토리 정보 + +- **Repo**: `runtime-role-matrix-live-202607141522` +- **Branch**: `main` +- **CI/CD**: GitHub Actions +- **Monitoring**: Prometheus + Grafana From de9ec530043a418645a42b98284b23e190183400 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:23:26 +0000 Subject: [PATCH 03/23] forge: open work branch for role-aa-live-1522-001-attempt-1-run-d418939310a8 --- .forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md diff --git a/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md b/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md new file mode 100644 index 0000000..70bf647 --- /dev/null +++ b/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md @@ -0,0 +1,3 @@ +# role-aa-live-1522-001-attempt-1-run-d418939310a8 + +Forge 이슈 작업 브랜치 `forge/role-aa-live-1522-001-attempt-1-run-d418939310a8`. From c0c201ed37c4cbf0242411f79993968d059f4dab Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:23:58 +0000 Subject: [PATCH 04/23] =?UTF-8?q?AA=20=EC=97=AD=ED=95=A0=20=EB=A0=88?= =?UTF-8?q?=EA=B1=B0=EC=8B=9C=20=EB=B6=84=EC=84=9D=20smoke=20(role-aa-live?= =?UTF-8?q?-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- audit/role-aa/legacy-analysis-smoke-report.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 audit/role-aa/legacy-analysis-smoke-report.md diff --git a/audit/role-aa/legacy-analysis-smoke-report.md b/audit/role-aa/legacy-analysis-smoke-report.md new file mode 100644 index 0000000..81b25ec --- /dev/null +++ b/audit/role-aa/legacy-analysis-smoke-report.md @@ -0,0 +1,146 @@ +# AA 역할 레거시 분석 감사 추적 문서 + +**문서 ID**: AUDIT-ROLE-AA-001 +**버전**: 1.0 +**작성일**: 2026-07-14 +**분석 대상**: role-aa +**문서 유형**: Smoke Analysis Report + +--- + +## 1. 개요 + +본 문서는 AA 역할(ROLE-AA)의 레거시 전환 분석을 위한 감사 추적 보고서이다. 입력 소스, 업무 규칙, 위험 영역, 증적 위치를 체계적으로 식별하고 문서화한다. + +--- + +## 2. 입력 소스 (Input Sources) + +| ID | 소스 유형 | 소스 명칭 | 위치 | 마지막 갱신 | 신뢰도 | +|----|----------|----------|------|------------|--------| +| IS-001 | 데이터베이스 | role_master_table | /db/role/role_master | 2026-06-30 | 높음 | +| IS-002 | 설정 파일 | aa_role_config.xml | /config/role/aa_role_config.xml | 2026-07-01 | 높음 | +| IS-003 | API 문서 | AA_Role_API_Spec | /docs/api/aa-role-api.yaml | 2026-06-15 | 중간 | +| IS-004 | 스키마 | role_permission_schema | /schema/role_permission.xsd | 2026-05-20 | 높음 | +| IS-005 | 로그 | aa_audit_log | /logs/audit/aa_*.log | 2026-07-14 | 높음 | + +--- + +## 3. 업무 규칙 (Business Rules) + +### 3.1 역할 생성 규칙 + +| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | +|---------|----------|------|------|----------| +| BR-001 | AA 역할 생성 시 최소 권한 부여 | role_type = 'AA' AND user_level >= 3 | 기본 권한 세트 자동 할당 | 높음 | +| BR-002 | 중복 역할 방지 | 동일한 user_id에 동일한 role_id 존재 시 | 오류 반환 (ERR_DUP_ROLE) | 높음 | +| BR-003 | 역할 만료 관리 | expiration_date < 현재일 | 역할 자동 비활성화 | 중간 | + +### 3.2 권한 검증 규칙 + +| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | +|---------|----------|------|------|----------| +| BR-004 | AA 역할 권한 범위 | permission_level <= 5 | 접근 허용 | 높음 | +| BR-005 | 감사 로그 필수 기록 | 모든 AA 역할 操作 | 로그 테이블 INSERT | 높음 | +| BR-006 | 역할 위임 제한 | delegator_role = 'AA' AND delegate_role = 'ADMIN' | 위임 거부 | 중간 | + +### 3.3 데이터 무결성 규칙 + +| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | +|---------|----------|------|------|----------| +| BR-007 | 참조 무결성 | role_id 삭제 시 | 관련 permission 레코드 CASCADE 삭제 | 높음 | +| BR-008 | 변경 이력 추적 | 모든 role 수정 | audit_history 테이블 기록 | 높음 | + +--- + +## 4. 위험 영역 (Risk Areas) + +### 4.1 높은 위험 (High Risk) + +| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | +|---------|----------|------|-------------|----------| +| RA-001 | 역할 권한 상승 공격 | 비인가 데이터 접근 | 중간 | 다단계 인증 구현 | +| RA-002 | 레거시 인증 우회 | 시스템 침입 | 낮음 | 레거시 API 폐기 계획 | +| RA-003 | 권한 불일치 상태 | 데이터 불일치 | 중간 | 주기적 정합성 검사 | + +### 4.2 중간 위험 (Medium Risk) + +| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | +|---------|----------|------|-------------|----------| +| RA-004 | 동시성 제어 부재 | 데이터 손상 | 낮음 | 낙관적 잠금 적용 | +| RA-005 | 감사 로그 누락 | 규정 위반 | 중간 | 로그 전송 확인机制 | +| RA-006 | 역할 만료 처리 지연 | 접근 제어 공백 | 중간 | 스케줄러 최적화 | + +### 4.3 낮은 위험 (Low Risk) + +| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | +|---------|----------|------|-------------|----------| +| RA-007 | 설정 파일 형식 오류 | 서비스 시작 실패 | 낮음 | 스키마 검증 | +| RA-008 | 문서 불일치 | 유지보수 어려움 | 중간 | 자동 문서 생성 | + +--- + +## 5. 증적 위치 (Evidence Locations) + +### 5.1 역할 정의 증적 + +| 위치 ID | 위치 경로 | 설명 | 접근 권한 | +|---------|----------|------|----------| +| EL-001 | /db/role/role_master | 역할 마스터 테이블 | DBA, Auditor | +| EL-002 | /db/role/role_permission | 권한 매핑 테이블 | DBA, Auditor | +| EL-003 | /config/role/aa_role_config.xml | 역할 설정 파일 | Admin, Auditor | + +### 5.2 감사 로그 증적 + +| 위치 ID | 위치 경로 | 설명 | 보존 기간 | +|---------|----------|------|----------| +| EL-004 | /logs/audit/aa_create.log | 역할 생성 로그 | 7년 | +| EL-005 | /logs/audit/aa_modify.log | 역할 수정 로그 | 7년 | +| EL-006 | /logs/audit/aa_delete.log | 역할 삭제 로그 | 7년 | +| EL-007 | /logs/audit/aa_access.log | 접근 시도 로그 | 3년 | + +### 5.3 변경 이력 증적 + +| 위치 ID | 위치 경로 | 설명 | 접근 권한 | +|---------|----------|------|----------| +| EL-008 | /db/audit/role_audit_history | 역할 변경 이력 테이블 | Auditor | +| EL-009 | /db/audit/permission_audit_history | 권한 변경 이력 테이블 | Auditor | +| EL-010 | /version/role-aa/changelog.md | 역할 변경 이력 문서 | All | + +### 5.4 테스트 증적 + +| 위치 ID | 위치 경로 | 설명 | 테스트 유형 | +|---------|----------|------|-------------| +| EL-011 | /test/role-aa/unit | 단위 테스트 | Unit | +| EL-012 | /test/role-aa/integration | 통합 테스트 | Integration | +| EL-013 | /test/role-aa/security | 보안 테스트 | Security | + +--- + +## 6. 의존성 매트릭스 + +| 역할 | 의존 역할 | 의존 유형 | 전환 영향도 | +|------|----------|----------|-------------| +| ROLE-AA | ROLE-BASE | 상속 | 높음 | +| ROLE-AA | ROLE-USER | 위임 | 중간 | +| ROLE-AA | ROLE-AUDITOR | 참조 | 낮음 | + +--- + +## 7. 전환 체크리스트 + +- [ ] 입력 소스 데이터 마이그레이션 계획 수립 +- [ ] 업무 규칙 호환성 검증 완료 +- [ ] 위험 영역 보안 감사 완료 +- [ ] 증적 위치 접근 권한 검증 완료 +- [ ] 롤백 계획 수립 및 테스트 완료 + +--- + +## 8. 결론 + +본 감사 추적 문서는 AA 역할 레거시 전환 분석에 필요한 모든 요소를 식별하고 문서화하였다. 높은 위험 영역(RA-001 ~ RA-003)에 대한 완화 조치를 우선적으로 적용하고, 모든 증적 위치를 안전하게 보관하여 규정 준수 및 감사 준비를 완료해야 한다. + +--- + +**문서 종료** From bef51f011fec0bd24cef7cafe6a2bb9022118b98 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:23:59 +0000 Subject: [PATCH 05/23] =?UTF-8?q?AA=20=EC=97=AD=ED=95=A0=20=EB=A0=88?= =?UTF-8?q?=EA=B1=B0=EC=8B=9C=20=EB=B6=84=EC=84=9D=20smoke=20(role-aa-live?= =?UTF-8?q?-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- audit/role-aa/evidence-inventory.json | 315 ++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 audit/role-aa/evidence-inventory.json diff --git a/audit/role-aa/evidence-inventory.json b/audit/role-aa/evidence-inventory.json new file mode 100644 index 0000000..81485b0 --- /dev/null +++ b/audit/role-aa/evidence-inventory.json @@ -0,0 +1,315 @@ +{ + "documentId": "EVID-INV-ROLE-AA-001", + "version": "1.0", + "generatedDate": "2026-07-14", + "scope": "role-aa", + "evidenceInventory": { + "inputSources": [ + { + "id": "IS-001", + "type": "database", + "name": "role_master_table", + "path": "/db/role/role_master", + "lastUpdated": "2026-06-30", + "reliability": "high", + "schema": "role_id VARCHAR(36) PK, role_name VARCHAR(100), role_type VARCHAR(20), created_at TIMESTAMP, updated_at TIMESTAMP" + }, + { + "id": "IS-002", + "type": "configuration", + "name": "aa_role_config.xml", + "path": "/config/role/aa_role_config.xml", + "lastUpdated": "2026-07-01", + "reliability": "high", + "format": "XML" + }, + { + "id": "IS-003", + "type": "api_specification", + "name": "AA_Role_API_Spec", + "path": "/docs/api/aa-role-api.yaml", + "lastUpdated": "2026-06-15", + "reliability": "medium", + "format": "OpenAPI 3.0" + }, + { + "id": "IS-004", + "type": "schema", + "name": "role_permission_schema", + "path": "/schema/role_permission.xsd", + "lastUpdated": "2026-05-20", + "reliability": "high", + "format": "XSD" + }, + { + "id": "IS-005", + "type": "log", + "name": "aa_audit_log", + "path": "/logs/audit/aa_*.log", + "lastUpdated": "2026-07-14", + "reliability": "high", + "retentionDays": 2555 + } + ], + "businessRules": [ + { + "id": "BR-001", + "name": "AA 역할 생성 시 최소 권한 부여", + "category": "role_creation", + "priority": "high", + "condition": "role_type = 'AA' AND user_level >= 3", + "action": "기본 권한 세트 자동 할당", + "errorCode": null + }, + { + "id": "BR-002", + "name": "중복 역할 방지", + "category": "role_creation", + "priority": "high", + "condition": "동일한 user_id에 동일한 role_id 존재", + "action": "오류 반환", + "errorCode": "ERR_DUP_ROLE" + }, + { + "id": "BR-003", + "name": "역할 만료 관리", + "category": "role_lifecycle", + "priority": "medium", + "condition": "expiration_date < 현재일", + "action": "역할 자동 비활성화", + "errorCode": null + }, + { + "id": "BR-004", + "name": "AA 역할 권한 범위", + "category": "permission_validation", + "priority": "high", + "condition": "permission_level <= 5", + "action": "접근 허용", + "errorCode": null + }, + { + "id": "BR-005", + "name": "감사 로그 필수 기록", + "category": "audit", + "priority": "high", + "condition": "모든 AA 역할 操作", + "action": "로그 테이블 INSERT", + "errorCode": null + }, + { + "id": "BR-006", + "name": "역할 위임 제한", + "category": "delegation", + "priority": "medium", + "condition": "delegator_role = 'AA' AND delegate_role = 'ADMIN'", + "action": "위임 거부", + "errorCode": "ERR_DELEGATION_DENIED" + }, + { + "id": "BR-007", + "name": "참조 무결성", + "category": "data_integrity", + "priority": "high", + "condition": "role_id 삭제", + "action": "관련 permission 레코드 CASCADE 삭제", + "errorCode": null + }, + { + "id": "BR-008", + "name": "변경 이력 추적", + "category": "audit", + "priority": "high", + "condition": "모든 role 수정", + "action": "audit_history 테이블 기록", + "errorCode": null + } + ], + "riskAreas": [ + { + "id": "RA-001", + "name": "역할 권한 상승 공격", + "severity": "high", + "impact": "비인가 데이터 접근", + "likelihood": "medium", + "mitigation": "다단계 인증 구현" + }, + { + "id": "RA-002", + "name": "레거시 인증 우회", + "severity": "high", + "impact": "시스템 침입", + "likelihood": "low", + "mitigation": "레거시 API 폐기 계획" + }, + { + "id": "RA-003", + "name": "권한 불일치 상태", + "severity": "high", + "impact": "데이터 불일치", + "likelihood": "medium", + "mitigation": "주기적 정합성 검사" + }, + { + "id": "RA-004", + "name": "동시성 제어 부재", + "severity": "medium", + "impact": "데이터 손상", + "likelihood": "low", + "mitigation": "낙관적 잠금 적용" + }, + { + "id": "RA-005", + "name": "감사 로그 누락", + "severity": "medium", + "impact": "규정 위반", + "likelihood": "medium", + "mitigation": "로그 전송 확인机制" + }, + { + "id": "RA-006", + "name": "역할 만료 처리 지연", + "severity": "medium", + "impact": "접근 제어 공백", + "likelihood": "medium", + "mitigation": "스케줄러 최적화" + }, + { + "id": "RA-007", + "name": "설정 파일 형식 오류", + "severity": "low", + "impact": "서비스 시작 실패", + "likelihood": "low", + "mitigation": "스키마 검증" + }, + { + "id": "RA-008", + "name": "문서 불일치", + "severity": "low", + "impact": "유지보수 어려움", + "likelihood": "medium", + "mitigation": "자동 문서 생성" + } + ], + "evidenceLocations": [ + { + "id": "EL-001", + "category": "role_definition", + "path": "/db/role/role_master", + "description": "역할 마스터 테이블", + "accessLevel": ["DBA", "Auditor"] + }, + { + "id": "EL-002", + "category": "role_definition", + "path": "/db/role/role_permission", + "description": "권한 매핑 테이블", + "accessLevel": ["DBA", "Auditor"] + }, + { + "id": "EL-003", + "category": "role_definition", + "path": "/config/role/aa_role_config.xml", + "description": "역할 설정 파일", + "accessLevel": ["Admin", "Auditor"] + }, + { + "id": "EL-004", + "category": "audit_log", + "path": "/logs/audit/aa_create.log", + "description": "역할 생성 로그", + "retentionDays": 2555 + }, + { + "id": "EL-005", + "category": "audit_log", + "path": "/logs/audit/aa_modify.log", + "description": "역할 수정 로그", + "retentionDays": 2555 + }, + { + "id": "EL-006", + "category": "audit_log", + "path": "/logs/audit/aa_delete.log", + "description": "역할 삭제 로그", + "retentionDays": 2555 + }, + { + "id": "EL-007", + "category": "audit_log", + "path": "/logs/audit/aa_access.log", + "description": "접근 시도 로그", + "retentionDays": 1095 + }, + { + "id": "EL-008", + "category": "change_history", + "path": "/db/audit/role_audit_history", + "description": "역할 변경 이력 테이블", + "accessLevel": ["Auditor"] + }, + { + "id": "EL-009", + "category": "change_history", + "path": "/db/audit/permission_audit_history", + "description": "권한 변경 이력 테이블", + "accessLevel": ["Auditor"] + }, + { + "id": "EL-010", + "category": "change_history", + "path": "/version/role-aa/changelog.md", + "description": "역할 변경 이력 문서", + "accessLevel": ["All"] + }, + { + "id": "EL-011", + "category": "test_evidence", + "path": "/test/role-aa/unit", + "description": "단위 테스트", + "testType": "Unit" + }, + { + "id": "EL-012", + "category": "test_evidence", + "path": "/test/role-aa/integration", + "description": "통합 테스트", + "testType": "Integration" + }, + { + "id": "EL-013", + "category": "test_evidence", + "path": "/test/role-aa/security", + "description": "보안 테스트", + "testType": "Security" + } + ] + }, + "transitionChecklist": [ + { + "item": "입력 소스 데이터 마이그레이션 계획 수립", + "status": "pending", + "priority": "high" + }, + { + "item": "업무 규칙 호환성 검증 완료", + "status": "pending", + "priority": "high" + }, + { + "item": "위험 영역 보안 감사 완료", + "status": "pending", + "priority": "high" + }, + { + "item": "증적 위치 접근 권한 검증 완료", + "status": "pending", + "priority": "medium" + }, + { + "item": "롤백 계획 수립 및 테스트 완료", + "status": "pending", + "priority": "high" + } + ] +} From 28b59943548e636efc7991f7c5f4d04980f84495 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:24:09 +0000 Subject: [PATCH 06/23] forge: open work branch for role-ta-live-1522-001-attempt-1-run-6e84b72613b1 --- .forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1.md diff --git a/.forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1.md b/.forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1.md new file mode 100644 index 0000000..b201248 --- /dev/null +++ b/.forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1.md @@ -0,0 +1,3 @@ +# role-ta-live-1522-001-attempt-1-run-6e84b72613b1 + +Forge 이슈 작업 브랜치 `forge/role-ta-live-1522-001-attempt-1-run-6e84b72613b1`. From e414a834ad38cb50ac8b6f854fb16b046e02d8a9 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:25:58 +0000 Subject: [PATCH 07/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ADR-001-spring-architecture-boundaries.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 docs/adr/ADR-001-spring-architecture-boundaries.md diff --git a/docs/adr/ADR-001-spring-architecture-boundaries.md b/docs/adr/ADR-001-spring-architecture-boundaries.md new file mode 100644 index 0000000..031a181 --- /dev/null +++ b/docs/adr/ADR-001-spring-architecture-boundaries.md @@ -0,0 +1,84 @@ +# ADR-001: Spring MVC 아키텍처 경계 및 계약 정의 + +## Context + +runtime-role-matrix-live 프로젝트는 Spring Boot 기반 REST API 서버로 역할 기반 접근 제어(RBAC)를 구현한다. 레이어 간 책임 분담, 오류 처리 계약, 트랜잭션 범위가 명시적으로 정의되어 있지 않아 일관성 없는 구현이 발생할 위험이 있다. + +## Decision + +### 1. 레이어 경계 정의 + +| 레이어 | 책임 | +|-------|------| +| **Controller** | HTTP 요청/응답, 입력 검증, DTO 변환, HTTP 상태 코드 결정. 트랜잭션 경계 없음 | +| **Service** | 비즈니스 로직, 도메인 객체 조작, @Transactional 선언적 트랜잭션, BusinessException 발생 | +| **Repository** | 데이터 접근(JPA), 쿼리 실행, Entity 변환. 순수 데이터 조작만 수행 | + +### 2. 오류 계약 (RFC 7807 Problem Details) + +```json +{ + "type": "https://api.runtimematrix.com/errors/role-not-found", + "title": "역할을 찾을 수 없습니다", + "status": 404, + "detail": "ID가 'admin'인 역할이 존재하지 않습니다.", + "instance": "/api/v1/roles/admin", + "timestamp": "2026-07-14T15:22:00Z", + "traceId": "abc123def456" +} +``` + +**예외 계층**: `RuntimeException → BusinessException(추상) → RoleNotFoundException, RoleAlreadyExistsException` + +**HTTP 상태 매핑**: + +| 예외 | 상태 | +|-----|------| +| ValidationException | 400 | +| BusinessException | 400/409 | +| RoleNotFoundException | 404 | +| PermissionDeniedException | 403 | +| InternalServerException | 500 | + +### 3. 트랜잭션 경계 + +| 규칙 | 설명 | +|-----|------| +| 시작점 | Service Layer public 메서드 | +| 전파 | REQUIRED (기본값) | +| 읽기 전용 | SELECT-only 메서드에 `readOnly=true` | +| 격리 수준 | READ_COMMITTED | +| 롤백 | RuntimeException, BusinessException → Yes | + +### 4. 의존성 규칙 + +| From → To | 허용 | +|-----------|------| +| Controller → Service | ✅ | +| Controller → Repository | ❌ | +| Service → Repository | ✅ | +| Service → Domain | ✅ | +| Repository → Service | ❌ | + +### 5. 패키지 구조 + +``` +com.runtimematrix +├── controller/dto # Request/Response DTO +├── service/command # Command 객체 +├── repository # JPA Repository +├── domain/model # 도메인 객체 +├── domain/exception # 도메인 예외 +└── config # Spring Configuration +``` + +## Consequences + +**긍정**: 레이어별 책임 명확, 일관된 오류 응답, 데이터 일관성 보장, 테스트 용이성 향상 + +**부정**: 기존 코드 수정 필요, 추가 DTO/Command 클래스 필요 + +## References + +- [Spring Transaction Management](https://docs.spring.io/spring-framework/docs/current/reference/html/data-access.html#transaction) +- [RFC 7807 Problem Details](https://tools.ietf.org/html/rfc7807) From bab3f337c1908385766f7dce8d2193901fc6df62 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:25:58 +0000 Subject: [PATCH 08/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/exception/BusinessException.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/main/java/com/runtimematrix/domain/exception/BusinessException.java diff --git a/src/main/java/com/runtimematrix/domain/exception/BusinessException.java b/src/main/java/com/runtimematrix/domain/exception/BusinessException.java new file mode 100644 index 0000000..78fe91b --- /dev/null +++ b/src/main/java/com/runtimematrix/domain/exception/BusinessException.java @@ -0,0 +1,42 @@ +package com.runtimematrix.domain.exception; + +import java.text.MessageFormat; + +/** + * 비즈니스 로직 수행 중 발생하는 예외의 기본 클래스. + * 모든 도메인 예외는 이 클래스를 상속한다. + */ +public abstract class BusinessException extends RuntimeException { + + private final String errorCode; + private final String resourceId; + + protected BusinessException(String errorCode, String message, String resourceId) { + super(message); + this.errorCode = errorCode; + this.resourceId = resourceId; + } + + public String getErrorCode() { return errorCode; } + public String getResourceId() { return resourceId; } + public abstract int getHttpStatus(); + public String getType() { return "https://api.runtimematrix.com/errors/" + errorCode; } + + /** 역할 미존재 예외 */ + public static class RoleNotFoundException extends BusinessException { + private static final String CODE = "role-not-found"; + public RoleNotFoundException(String roleId) { + super(CODE, MessageFormat.format("ID가 ''{0}''인 역할을 찾을 수 없습니다.", roleId), roleId); + } + @Override public int getHttpStatus() { return 404; } + } + + /** 역할 중복 예외 */ + public static class RoleAlreadyExistsException extends BusinessException { + private static final String CODE = "role-already-exists"; + public RoleAlreadyExistsException(String roleName) { + super(CODE, MessageFormat.format("이름이 ''{0}''인 역할이 이미 존재합니다.", roleName), roleName); + } + @Override public int getHttpStatus() { return 409; } + } +} From db3560a8194f389c24b7ee8db1a72b8ff5b093e0 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:25:59 +0000 Subject: [PATCH 09/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GlobalExceptionHandler.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/main/java/com/runtimematrix/config/GlobalExceptionHandler.java diff --git a/src/main/java/com/runtimematrix/config/GlobalExceptionHandler.java b/src/main/java/com/runtimematrix/config/GlobalExceptionHandler.java new file mode 100644 index 0000000..d2a2a99 --- /dev/null +++ b/src/main/java/com/runtimematrix/config/GlobalExceptionHandler.java @@ -0,0 +1,65 @@ +package com.runtimematrix.config; + +import com.runtimematrix.controller.dto.ErrorResponse; +import com.runtimematrix.domain.exception.BusinessException; +import jakarta.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.time.Instant; +import java.util.UUID; +import java.util.stream.Collectors; + +/** 전역 예외 처리기 - RFC 7807 Problem Details 형식으로 변환 */ +@RestControllerAdvice +public class GlobalExceptionHandler { + + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + @ExceptionHandler(BusinessException.class) + public ResponseEntity handleBusinessException(BusinessException ex, HttpServletRequest request) { + String traceId = getOrGenerateTraceId(); + MDC.put("traceId", traceId); + log.warn("[{}] {} - {}", traceId, ex.getErrorCode(), ex.getMessage()); + + return ResponseEntity.status(ex.getHttpStatus()) + .body(ErrorResponse.of(ex.getType(), ex.getErrorCode(), ex.getMessage(), + ex.getHttpStatus(), request.getRequestURI(), traceId)); + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity handleValidationException(MethodArgumentNotValidException ex, HttpServletRequest request) { + String traceId = getOrGenerateTraceId(); + String detail = ex.getBindingResult().getFieldErrors().stream() + .map(FieldError::getDefaultMessage).collect(Collectors.joining("; ")); + log.warn("[{}] Validation failed: {}", traceId, detail); + + return ResponseEntity.badRequest() + .body(ErrorResponse.of("https://api.runtimematrix.com/errors/validation-failed", + "validation-failed", "입력 검증에 실패했습니다: " + detail, + HttpStatus.BAD_REQUEST.value(), request.getRequestURI(), traceId)); + } + + @ExceptionHandler(Exception.class) + public ResponseEntity handleGenericException(Exception ex, HttpServletRequest request) { + String traceId = getOrGenerateTraceId(); + log.error("[{}] Unexpected error", traceId, ex); + + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(ErrorResponse.of("https://api.runtimematrix.com/errors/internal-server-error", + "internal-server-error", "예상치 못한 오류가 발생했습니다.", + HttpStatus.INTERNAL_SERVER_ERROR.value(), request.getRequestURI(), traceId)); + } + + private String getOrGenerateTraceId() { + String existing = MDC.get("traceId"); + return existing != null ? existing : UUID.randomUUID().toString().substring(0, 12); + } +} From a596e750eb6afd571c754b874975c5c60de1e3c6 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:01 +0000 Subject: [PATCH 10/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dto/ErrorResponse.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/java/com/runtimematrix/controller/dto/ErrorResponse.java diff --git a/src/main/java/com/runtimematrix/controller/dto/ErrorResponse.java b/src/main/java/com/runtimematrix/controller/dto/ErrorResponse.java new file mode 100644 index 0000000..821129a --- /dev/null +++ b/src/main/java/com/runtimematrix/controller/dto/ErrorResponse.java @@ -0,0 +1,14 @@ +package com.runtimematrix.controller.dto; + +import java.time.Instant; + +/** RFC 7807 Problem Details 형식의 오류 응답 DTO */ +public record ErrorResponse( + String type, String title, int status, String detail, + String instance, String timestamp, String traceId +) { + public static ErrorResponse of(String type, String title, String detail, + int status, String instance, String traceId) { + return new ErrorResponse(type, title, status, detail, instance, Instant.now().toString(), traceId); + } +} From e110ee183680a2b89ce398c03ec0a51db2cc1163 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:02 +0000 Subject: [PATCH 11/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runtimematrix/service/RoleService.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/main/java/com/runtimematrix/service/RoleService.java diff --git a/src/main/java/com/runtimematrix/service/RoleService.java b/src/main/java/com/runtimematrix/service/RoleService.java new file mode 100644 index 0000000..28f61af --- /dev/null +++ b/src/main/java/com/runtimematrix/service/RoleService.java @@ -0,0 +1,85 @@ +package com.runtimematrix.service; + +import com.runtimematrix.domain.exception.BusinessException; +import com.runtimematrix.domain.model.Role; +import com.runtimematrix.repository.RoleRepository; +import com.runtimematrix.service.command.CreateRoleCommand; +import com.runtimematrix.service.command.UpdateRoleCommand; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 역할 관리 서비스. + * ADR-001 트랜잭션 경계: Service Layer public 메서드에서 시작 + */ +@Service +public class RoleService { + + private static final Logger log = LoggerFactory.getLogger(RoleService.class); + private final RoleRepository roleRepository; + + public RoleService(RoleRepository roleRepository) { + this.roleRepository = roleRepository; + } + + /** 쓰기 트랜잭션 */ + @Transactional + public Role createRole(CreateRoleCommand command) { + log.debug("Creating role: {}", command.name()); + if (roleRepository.existsByName(command.name())) { + throw new BusinessException.RoleAlreadyExistsException(command.name()); + } + Role role = Role.create(command.name(), command.description()); + log.info("Role created: id={}, name={}", role.getId(), role.getName()); + return roleRepository.save(role); + } + + /** 읽기 전용 트랜잭션 */ + @Transactional(readOnly = true) + public Role getRole(String roleId) { + log.debug("Fetching role: {}", roleId); + return roleRepository.findById(roleId) + .orElseThrow(() -> new BusinessException.RoleNotFoundException(roleId)); + } + + /** 읽기 전용 트랜잭션 */ + @Transactional(readOnly = true) + public List getAllRoles() { + return roleRepository.findAll(); + } + + /** 쓰기 트랜잭션 */ + @Transactional + public Role updateRole(String roleId, UpdateRoleCommand command) { + log.debug("Updating role: {}", roleId); + Role role = roleRepository.findById(roleId) + .orElseThrow(() -> new BusinessException.RoleNotFoundException(roleId)); + + if (command.name() != null && !command.name().equals(role.getName())) { + if (roleRepository.existsByName(command.name())) { + throw new BusinessException.RoleAlreadyExistsException(command.name()); + } + role.updateName(command.name()); + } + if (command.description() != null) { + role.updateDescription(command.description()); + } + log.info("Role updated: id={}", roleId); + return role; + } + + /** 쓰기 트랜잭션 */ + @Transactional + public void deleteRole(String roleId) { + log.debug("Deleting role: {}", roleId); + if (!roleRepository.existsById(roleId)) { + throw new BusinessException.RoleNotFoundException(roleId); + } + roleRepository.deleteById(roleId); + log.info("Role deleted: id={}", roleId); + } +} From ae4f99668d71239435a9027c923982da46e739c6 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:03 +0000 Subject: [PATCH 12/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/RoleController.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/java/com/runtimematrix/controller/RoleController.java diff --git a/src/main/java/com/runtimematrix/controller/RoleController.java b/src/main/java/com/runtimematrix/controller/RoleController.java new file mode 100644 index 0000000..ea78029 --- /dev/null +++ b/src/main/java/com/runtimematrix/controller/RoleController.java @@ -0,0 +1,61 @@ +package com.runtimematrix.controller; + +import com.runtimematrix.controller.dto.RoleResponse; +import com.runtimematrix.domain.model.Role; +import com.runtimematrix.service.RoleService; +import com.runtimematrix.service.command.CreateRoleCommand; +import com.runtimematrix.service.command.UpdateRoleCommand; +import jakarta.validation.Valid; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.net.URI; +import java.util.List; + +/** + * 역할 관리 REST 컨트롤러. + * ADR-001 Controller 경계: HTTP 처리, 검증, DTO 변환만 수행. 비즈니스 로직 없음. + */ +@RestController +@RequestMapping("/api/v1/roles") +public class RoleController { + + private final RoleService roleService; + + public RoleController(RoleService roleService) { + this.roleService = roleService; + } + + @PostMapping + public ResponseEntity createRole(@Valid @RequestBody CreateRoleRequest request) { + CreateRoleCommand command = new CreateRoleCommand(request.name(), request.description()); + Role created = roleService.createRole(command); + return ResponseEntity.created(URI.create("/api/v1/roles/" + created.getId())) + .body(RoleResponse.from(created)); + } + + @GetMapping("/{roleId}") + public ResponseEntity getRole(@PathVariable String roleId) { + return ResponseEntity.ok(RoleResponse.from(roleService.getRole(roleId))); + } + + @GetMapping + public ResponseEntity> getAllRoles() { + return ResponseEntity.ok(roleService.getAllRoles().stream() + .map(RoleResponse::from).toList()); + } + + @PutMapping("/{roleId}") + public ResponseEntity updateRole( + @PathVariable String roleId, + @Valid @RequestBody UpdateRoleRequest request) { + UpdateRoleCommand command = new UpdateRoleCommand(request.name(), request.description()); + return ResponseEntity.ok(RoleResponse.from(roleService.updateRole(roleId, command))); + } + + @DeleteMapping("/{roleId}") + public ResponseEntity deleteRole(@PathVariable String roleId) { + roleService.deleteRole(roleId); + return ResponseEntity.noContent().build(); + } +} From 19a4d610b5ffa2363e652acdbac1949e6c5d6bec Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:04 +0000 Subject: [PATCH 13/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../architecture/LayerBoundaryTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/java/com/runtimematrix/architecture/LayerBoundaryTest.java diff --git a/src/test/java/com/runtimematrix/architecture/LayerBoundaryTest.java b/src/test/java/com/runtimematrix/architecture/LayerBoundaryTest.java new file mode 100644 index 0000000..30e6a84 --- /dev/null +++ b/src/test/java/com/runtimematrix/architecture/LayerBoundaryTest.java @@ -0,0 +1,62 @@ +package com.runtimematrix.architecture; + +import com.tngtech.archunit.core.domain.JavaClasses; +import com.tngtech.archunit.core.importer.ClassFileImporter; +import com.tngtech.archunit.lang.ArchRule; +import com.tngtech.archunit.library.Architectures.layeredArchitecture; +import com.tngtech.archunit.library.dependencies.SlicesRuleDefinition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static com.tngtech.archunit.library.DependencyRules.NO_CLASSES_DEPEND_ON_UPPER_LAYERS; + +/** ADR-001 레이어 경계 Arquillian 테스트 */ +@DisplayName("아키텍처 경계 검증") +class LayerBoundaryTest { + + private JavaClasses classes; + + @BeforeEach + void setUp() { + classes = new ClassFileImporter().importPackages("com.runtimematrix"); + } + + @Test + @DisplayName("Controller는 Service에만 접근 가능") + void controller_should_only_access_service() { + ArchRule rule = layeredArchitecture() + .layer("Controller").definedBy("..controller..") + .layer("Service").definedBy("..service..") + .layer("Repository").definedBy("..repository..") + .layer("Domain").definedBy("..domain..") + .whereLayer("Controller").mayOnlyAccessLayers("Service", "Domain"); + rule.check(classes); + } + + @Test + @DisplayName("Service는 Repository와 Domain에만 접근 가능") + void service_should_only_access_repository_and_domain() { + ArchRule rule = layeredArchitecture() + .layer("Controller").definedBy("..controller..") + .layer("Service").definedBy("..service..") + .layer("Repository").definedBy("..repository..") + .layer("Domain").definedBy("..domain..") + .whereLayer("Service").mayOnlyAccessLayers("Repository", "Domain"); + rule.check(classes); + } + + @Test + @DisplayName("하위 레이어는 상위 레이어에 의존하지 않음") + void no_upward_dependencies() { + NO_CLASSES_DEPEND_ON_UPPER_LAYERS.check(classes); + } + + @Test + @DisplayName("패키지 간 순환 의존성 없음") + void no_cyclic_dependencies() { + ArchRule rule = SlicesRuleDefinition.slices() + .matching("com.runtimematrix.(*)..").should().beFreeOfCycles(); + rule.check(classes); + } +} From 5e9d29c81714d37864441ecd1c05d6a56a304500 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:05 +0000 Subject: [PATCH 14/23] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ErrorResponseContractTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/java/com/runtimematrix/controller/ErrorResponseContractTest.java diff --git a/src/test/java/com/runtimematrix/controller/ErrorResponseContractTest.java b/src/test/java/com/runtimematrix/controller/ErrorResponseContractTest.java new file mode 100644 index 0000000..bd7397f --- /dev/null +++ b/src/test/java/com/runtimematrix/controller/ErrorResponseContractTest.java @@ -0,0 +1,62 @@ +package com.runtimematrix.controller; + +import com.runtimematrix.config.GlobalExceptionHandler; +import com.runtimematrix.domain.exception.BusinessException; +import com.runtimematrix.service.RoleService; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; + +import static org.hamcrest.Matchers.*; +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** ADR-001 RFC 7807 오류 응답 계약 테스트 */ +@WebMvcTest(RoleController.class) +@Import(GlobalExceptionHandler.class) +@DisplayName("오류 응답 계약 테스트") +class ErrorResponseContractTest { + + @Autowired private MockMvc mockMvc; + @MockBean private RoleService roleService; + + @Test + @DisplayName("역할 미존재 시 404와 RFC 7807 형식 응답 반환") + void role_not_found_returns_404_with_problem_details() throws Exception { + String roleId = "non-existent"; + when(roleService.getRole(roleId)).thenThrow(new BusinessException.RoleNotFoundException(roleId)); + + mockMvc.perform(get("/api/v1/roles/{roleId}", roleId)) + .andExpect(status().isNotFound()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.type", startsWith("https://api.runtimematrix.com/errors/"))) + .andExpect(jsonPath("$.title", is("역할을 찾을 수 없습니다"))) + .andExpect(jsonPath("$.status", is(404))) + .andExpect(jsonPath("$.detail", containsString(roleId))) + .andExpect(jsonPath("$.instance", containsString("/api/v1/roles/"))) + .andExpect(jsonPath("$.timestamp", notNullValue())) + .andExpect(jsonPath("$.traceId", notNullValue())); + } + + @Test + @DisplayName("오류 응답에 모든 필수 필드 포함") + void error_response_contains_all_required_fields() throws Exception { + when(roleService.getRole("test")).thenThrow(new BusinessException.RoleNotFoundException("test")); + + mockMvc.perform(get("/api/v1/roles/{roleId}", "test")) + .andExpect(status().isNotFound()) + .andExpect(jsonPath("$", hasKey("type"))) + .andExpect(jsonPath("$", hasKey("title"))) + .andExpect(jsonPath("$", hasKey("status"))) + .andExpect(jsonPath("$", hasKey("detail"))) + .andExpect(jsonPath("$", hasKey("instance"))) + .andExpect(jsonPath("$", hasKey("timestamp"))) + .andExpect(jsonPath("$", hasKey("traceId"))); + } +} From 6dcbebe24d35fb3e0629231a049158df37a03926 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:16 +0000 Subject: [PATCH 15/23] forge: open work branch for role-developer-live-1522-001-attempt-1-run-6a48084c658b --- .../role-developer-live-1522-001-attempt-1-run-6a48084c658b.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md diff --git a/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md b/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md new file mode 100644 index 0000000..ae2040e --- /dev/null +++ b/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md @@ -0,0 +1,3 @@ +# role-developer-live-1522-001-attempt-1-run-6a48084c658b + +Forge 이슈 작업 브랜치 `forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b`. From 1aec3573e6e8639faf6b39e5f13664e0085da966 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:31 +0000 Subject: [PATCH 16/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pom.xml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a9c2722 --- /dev/null +++ b/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + com.example + demo + 0.0.1-SNAPSHOT + demo + Developer Role Spring Skeleton Application + + 17 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file From 7b68f7787f0050c780e6c2c83ff615f38956ce91 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:31 +0000 Subject: [PATCH 17/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/demo/DemoApplication.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/com/example/demo/DemoApplication.java diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java new file mode 100644 index 0000000..2a9bdbe --- /dev/null +++ b/src/main/java/com/example/demo/DemoApplication.java @@ -0,0 +1,12 @@ +package com.example.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } +} From 310e6d2433fe3d8f7cd1a9171dc2389e15f68abb Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:32 +0000 Subject: [PATCH 18/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/HelloController.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/com/example/demo/controller/HelloController.java diff --git a/src/main/java/com/example/demo/controller/HelloController.java b/src/main/java/com/example/demo/controller/HelloController.java new file mode 100644 index 0000000..54f430c --- /dev/null +++ b/src/main/java/com/example/demo/controller/HelloController.java @@ -0,0 +1,29 @@ +package com.example.demo.controller; + +import com.example.demo.service.HelloService; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/hello") +public class HelloController { + + private final HelloService helloService; + + public HelloController(HelloService helloService) { + this.helloService = helloService; + } + + @GetMapping + public ResponseEntity greet() { + return ResponseEntity.ok(helloService.getGreeting()); + } + + @GetMapping("/{name}") + public ResponseEntity greetWithName(@PathVariable String name) { + return ResponseEntity.ok(helloService.getGreetingFor(name)); + } +} From 6040d126ddccbc61d0dfc941ac803868df98765f Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:34 +0000 Subject: [PATCH 19/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/demo/service/HelloService.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/example/demo/service/HelloService.java diff --git a/src/main/java/com/example/demo/service/HelloService.java b/src/main/java/com/example/demo/service/HelloService.java new file mode 100644 index 0000000..f2dfb2d --- /dev/null +++ b/src/main/java/com/example/demo/service/HelloService.java @@ -0,0 +1,21 @@ +package com.example.demo.service; + +import org.springframework.stereotype.Service; + +@Service +public class HelloService { + + private static final String GREETING_TEMPLATE = "Hello, %s!"; + private static final String DEFAULT_GREETING = "Hello, World!"; + + public String getGreeting() { + return DEFAULT_GREETING; + } + + public String getGreetingFor(String name) { + if (name == null || name.isBlank()) { + return DEFAULT_GREETING; + } + return String.format(GREETING_TEMPLATE, name); + } +} From f4c99e67d715eded0f4d18e17e9a4e0456f55e5e Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:35 +0000 Subject: [PATCH 20/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/main/resources/application.properties diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..4e0b68a --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=demo +server.port=8080 From 2453d71f0fc0f61735320d2bbbf467e56d0c6812 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:36 +0000 Subject: [PATCH 21/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/demo/DemoApplicationTests.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/java/com/example/demo/DemoApplicationTests.java diff --git a/src/test/java/com/example/demo/DemoApplicationTests.java b/src/test/java/com/example/demo/DemoApplicationTests.java new file mode 100644 index 0000000..f37ed66 --- /dev/null +++ b/src/test/java/com/example/demo/DemoApplicationTests.java @@ -0,0 +1,15 @@ +package com.example.demo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@TestPropertySource(properties = {"spring.main.allow-bean-definition-overriding=true"}) +class DemoApplicationTests { + + @Test + void contextLoads() { + // Smoke test: verify Spring context loads successfully + } +} From 486a29a9c3c755703595f1aef18fb72de0075a8d Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:37 +0000 Subject: [PATCH 22/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/service/HelloServiceTest.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/test/java/com/example/demo/service/HelloServiceTest.java diff --git a/src/test/java/com/example/demo/service/HelloServiceTest.java b/src/test/java/com/example/demo/service/HelloServiceTest.java new file mode 100644 index 0000000..55d748d --- /dev/null +++ b/src/test/java/com/example/demo/service/HelloServiceTest.java @@ -0,0 +1,55 @@ +package com.example.demo.service; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@DisplayName("HelloService Unit Tests") +class HelloServiceTest { + + private HelloService helloService; + + @BeforeEach + void setUp() { + helloService = new HelloService(); + } + + @Test + @DisplayName("getGreeting returns default greeting") + void getGreeting_ReturnsDefaultGreeting() { + String result = helloService.getGreeting(); + + assertNotNull(result); + assertEquals("Hello, World!", result); + } + + @Test + @DisplayName("getGreetingFor returns personalized greeting") + void getGreetingFor_ReturnsPersonalizedGreeting() { + String result = helloService.getGreetingFor("Developer"); + + assertNotNull(result); + assertEquals("Hello, Developer!", result); + } + + @Test + @DisplayName("getGreetingFor with null returns default greeting") + void getGreetingFor_WithNull_ReturnsDefaultGreeting() { + String result = helloService.getGreetingFor(null); + + assertNotNull(result); + assertEquals("Hello, World!", result); + } + + @Test + @DisplayName("getGreetingFor with blank string returns default greeting") + void getGreetingFor_WithBlankString_ReturnsDefaultGreeting() { + String result = helloService.getGreetingFor(" "); + + assertNotNull(result); + assertEquals("Hello, World!", result); + } +} From f381707f1c0187ae4284dd337d36e0b1fc841aa8 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:26:38 +0000 Subject: [PATCH 23/23] =?UTF-8?q?Developer=20=EC=97=AD=ED=95=A0=20Spring?= =?UTF-8?q?=20=EA=B3=A8=EA=B2=A9=20smoke=20(role-developer-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/HelloControllerTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/test/java/com/example/demo/controller/HelloControllerTest.java diff --git a/src/test/java/com/example/demo/controller/HelloControllerTest.java b/src/test/java/com/example/demo/controller/HelloControllerTest.java new file mode 100644 index 0000000..85559c4 --- /dev/null +++ b/src/test/java/com/example/demo/controller/HelloControllerTest.java @@ -0,0 +1,48 @@ +package com.example.demo.controller; + +import com.example.demo.service.HelloService; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; + +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@WebMvcTest(HelloController.class) +@DisplayName("HelloController Unit Tests") +class HelloControllerTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private HelloService helloService; + + @Test + @DisplayName("GET /api/hello returns default greeting") + void greet_ReturnsDefaultGreeting() throws Exception { + when(helloService.getGreeting()).thenReturn("Hello, World!"); + + mockMvc.perform(get("/api/hello") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string("Hello, World!")); + } + + @Test + @DisplayName("GET /api/hello/{name} returns personalized greeting") + void greetWithName_ReturnsPersonalizedGreeting() throws Exception { + when(helloService.getGreetingFor("Developer")).thenReturn("Hello, Developer!"); + + mockMvc.perform(get("/api/hello/Developer") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string("Hello, Developer!")); + } +}