diff --git a/.forge/runtime-role-matrix-live-20260714101723-v7-aa-001-attempt-2-run-b63a6a7e452e.md b/.forge/runtime-role-matrix-live-20260714101723-v7-aa-001-attempt-2-run-b63a6a7e452e.md new file mode 100644 index 0000000..2da0252 --- /dev/null +++ b/.forge/runtime-role-matrix-live-20260714101723-v7-aa-001-attempt-2-run-b63a6a7e452e.md @@ -0,0 +1,3 @@ +# runtime-role-matrix-live-20260714101723-v7-aa-001-attempt-2-run-b63a6a7e452e + +Forge 이슈 작업 브랜치 `forge/runtime-role-matrix-live-20260714101723-v7-aa-001-attempt-2-run-b63a6a7e452e`. diff --git a/.forge/runtime-role-matrix-live-20260714101723-v7-developer-001-attempt-1-run-e27e8d6f28aa.md b/.forge/runtime-role-matrix-live-20260714101723-v7-developer-001-attempt-1-run-e27e8d6f28aa.md new file mode 100644 index 0000000..595ee5a --- /dev/null +++ b/.forge/runtime-role-matrix-live-20260714101723-v7-developer-001-attempt-1-run-e27e8d6f28aa.md @@ -0,0 +1,3 @@ +# runtime-role-matrix-live-20260714101723-v7-developer-001-attempt-1-run-e27e8d6f28aa + +Forge 이슈 작업 브랜치 `forge/runtime-role-matrix-live-20260714101723-v7-developer-001-attempt-1-run-e27e8d6f28aa`. diff --git a/.forge/runtime-role-matrix-live-20260714101723-v7-ta-001-attempt-2-run-8f9fb566223b.md b/.forge/runtime-role-matrix-live-20260714101723-v7-ta-001-attempt-2-run-8f9fb566223b.md new file mode 100644 index 0000000..0097467 --- /dev/null +++ b/.forge/runtime-role-matrix-live-20260714101723-v7-ta-001-attempt-2-run-8f9fb566223b.md @@ -0,0 +1,3 @@ +# runtime-role-matrix-live-20260714101723-v7-ta-001-attempt-2-run-8f9fb566223b + +Forge 이슈 작업 브랜치 `forge/runtime-role-matrix-live-20260714101723-v7-ta-001-attempt-2-run-8f9fb566223b`. diff --git a/audit/AA_ROLE_EVIDENCE_INVENTORY.json b/audit/AA_ROLE_EVIDENCE_INVENTORY.json new file mode 100644 index 0000000..370db4a --- /dev/null +++ b/audit/AA_ROLE_EVIDENCE_INVENTORY.json @@ -0,0 +1,71 @@ +{ + "inventoryId": "AA_ROLE_EVIDENCE_INVENTORY", + "role": "AA", + "version": "v7", + "generatedDate": "2026-07-14", + "inputSources": [ + { + "sourceId": "IS-001", + "sourceName": "AA_ROLE_SPEC", + "description": "AA 역할 정의 명세서", + "location": "role-aa/specs/aa_role_spec.yaml", + "type": "SPECIFICATION", + "version": "1.0.0" + }, + { + "sourceId": "IS-002", + "sourceName": "PERMISSION_MATRIX", + "description": "권한 매트릭스 문서", + "location": "role-aa/specs/permission_matrix.json", + "type": "MATRIX", + "version": "1.0.0" + }, + { + "sourceId": "IS-003", + "sourceName": "WORKFLOW_DEF", + "description": "워크플로우 정의", + "location": "role-aa/workflows/aa_workflow.yaml", + "type": "WORKFLOW", + "version": "1.0.0" + }, + { + "sourceId": "IS-004", + "sourceName": "API_CONTRACT", + "description": "API 계약 정의", + "location": "role-aa/contracts/aa_api_contract.yaml", + "type": "CONTRACT", + "version": "1.0.0" + } + ], + "evidenceLocations": [ + { + "evidenceId": "EV-001", + "sourceId": "IS-001", + "type": "ROLE_DEFINITION", + "verificationMethod": "스키마 검증" + }, + { + "evidenceId": "EV-002", + "sourceId": "IS-002", + "type": "PERMISSION_MATRIX", + "verificationMethod": "매트릭스 교차 검증" + }, + { + "evidenceId": "EV-003", + "sourceId": "IS-003", + "type": "WORKFLOW_LOG", + "verificationMethod": "실행 추적 검증" + }, + { + "evidenceId": "EV-004", + "sourceId": "IS-004", + "type": "API_CALL_LOG", + "verificationMethod": "요청/응답 검증" + } + ], + "auditRequirements": { + "versionControl": true, + "changeTracking": true, + "retentionPeriod": "7years" + } +} diff --git a/audit/AA_ROLE_LEGACY_ANALYSIS.md b/audit/AA_ROLE_LEGACY_ANALYSIS.md new file mode 100644 index 0000000..1bf8714 --- /dev/null +++ b/audit/AA_ROLE_LEGACY_ANALYSIS.md @@ -0,0 +1,57 @@ +# AA 역할 레거시 분석 문서 + +## 개요 +- **역할**: AA +- **분석 일자**: 2026-07-14 +- **버전**: v7 +- **분석 목적**: 레거시 전환 분석을 위한 입력 소스, 업무 규칙, 위험 영역, 증적 위치 정리 + +--- + +## 1. 입력 소스 정의 + +| ID | 소스명 | 설명 | 위치 | +|-----|--------|------|------| +| IS-001 | AA_ROLE_SPEC | AA 역할 정의 명세서 | role-aa/specs/aa_role_spec.yaml | +| IS-002 | PERMISSION_MATRIX | 권한 매트릭스 문서 | role-aa/specs/permission_matrix.json | +| IS-003 | WORKFLOW_DEF | 워크플로우 정의 | role-aa/workflows/aa_workflow.yaml | +| IS-004 | API_CONTRACT | API 계약 정의 | role-aa/contracts/aa_api_contract.yaml | + +--- + +## 2. 업무 규칙 + +| 규칙 ID | 규칙 내용 | 입력 소스 | +|---------|----------|----------| +| BR-001 | AA 역할은 관리자 권한을 포함한다 | IS-001, IS-002 | +| BR-002 | AA 역할은 승인 워크플로우를 통과해야 한다 | IS-003 | +| BR-003 | AA 역할의 API 호출은 인증 토큰을 필요로 한다 | IS-004 | + +--- + +## 3. 위험 영역 + +| 위험 ID | 위험 설명 | 영향도 | 입력 소스 | +|---------|----------|--------|----------| +| RI-001 | 권한 상승 위험 | 높음 | IS-001, IS-002 | +| RI-002 | 워크플로우 우회 위험 | 중간 | IS-003 | +| RI-003 | API 인증 우회 위험 | 높음 | IS-004 | + +--- + +## 4. 증적 위치 + +| 증적 ID | 증적 유형 | 위치 | 검증 방법 | +|---------|----------|------|----------| +| EV-001 | 역할 정의 | IS-001 | 스키마 검증 | +| EV-002 | 권한 매트릭스 | IS-002 | 매트릭스 교차 검증 | +| EV-003 | 워크플로우 로그 | IS-003 | 실행 추적 검증 | +| EV-004 | API 호출 로그 | IS-004 | 요청/응답 검증 | + +--- + +## 5. 감사 추적 요구사항 + +- 모든 입력 소스는 버전 관리되어야 함 +- 변경 이력은 추적 가능해야 함 +- 증적은 보존 기간 동안 유지되어야 함 diff --git a/docs/adr/ADR-001-spring-boundary-architecture.md b/docs/adr/ADR-001-spring-boundary-architecture.md new file mode 100644 index 0000000..e2b2be5 --- /dev/null +++ b/docs/adr/ADR-001-spring-boundary-architecture.md @@ -0,0 +1,49 @@ +# ADR-001: Spring Layer Boundary Architecture + +## Context + +TA 역할의 Spring 기반 마이크로서비스는 역할 매트릭스 관리 기능을 제공한다. Controller-Service-Repository 패턴을 적용하되, 각 계층의 책임과 경계를 명확히 정의하여 응집도를 높이고 결합도를 낮추어야 한다. 또한 오류 처리와 트랜잭션 관리의 일관된 전략이 필요하다. + +## Decision + +### 1. Controller-Service-Repository 경계 + +| Layer | Responsibility | Forbidden Dependencies | +|-------|---------------|------------------------| +| Controller | HTTP 요청/응답 변환, 입력 검증, HTTP 상태 코드 관리 | 직접 Repository 접근 금지 | +| Service | 비즈니스 로직, 도메인 규칙, 트랜잭션 경계 | HTTP Servlet API 직접 사용 금지 | +| Repository | 데이터 접근, JPA 쿼리, 엔티티 매핑 | 비즈니스 로직 포함 금지 | + +### 2. 오류 계약 (Error Contract) + +| Scenario | HTTP Status | Response Body | +|----------|-------------|---------------| +| Validation Error | 400 | `{ "code": "VALIDATION_ERROR", "message": "...", "field": "..." }` | +| Resource Not Found | 404 | `{ "code": "NOT_FOUND", "message": "...", "resourceId": "..." }` | +| Business Rule Violation | 409 | `{ "code": "BUSINESS_ERROR", "message": "..." }` | +| Internal Error | 500 | `{ "code": "INTERNAL_ERROR", "message": "..." }` | + +### 3. 트랜잭션 경계 + +- **시작점**: Service Layer (public method 진입점) +- **종료점**: Service Layer (public method 종료점) +- **전파**: `@Transactional(propagation = REQUIRED)` 기본값 사용 +- **읽기 전용**: 조회 전용 Service Method에 `@Transactional(readOnly = true)` 적용 + +## Alternatives + +1. **TransactionTemplate 사용**: 프로그래밍 방식 트랜잭션 관리로 더 세밀한 제어 가능하나, 선언적 방식 대비 복잡성 증가 +2. **Controller에서 트랜잭션 관리**: 테스트 용이성 감소, 단일 책임 원칙 위반 +3. **Repository에서 비즈니스 로직 포함**: 데이터 접근 계층의 재사용성 저하 + +## Consequences + +### Positive +- 계층별 단일 책임 원칙 준수 +- 일관된 오류 처리로 API consumers 보호 +- 트랜잭션 경계 명확화로 데이터 무결성 보장 +- 테스트 용이성 향상 (Mock 주입 용이) + +### Negative +- 간단한 CRUD 연산에도 Service Layer 필요로 인한 코드 증가 +- 트랜잭션 경계 설정 오류 시 롤백 누락 위험 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8062b34 --- /dev/null +++ b/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + com.example + developer-role-smoke + 1.0.0 + Developer Role Smoke Test + Spring Boot smoke application for Developer role + + 17 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/src/main/java/com/example/developer/DeveloperApplication.java b/src/main/java/com/example/developer/DeveloperApplication.java new file mode 100644 index 0000000..668dc45 --- /dev/null +++ b/src/main/java/com/example/developer/DeveloperApplication.java @@ -0,0 +1,12 @@ +package com.example.developer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DeveloperApplication { + + public static void main(String[] args) { + SpringApplication.run(DeveloperApplication.class, args); + } +} diff --git a/src/main/java/com/example/developer/DeveloperService.java b/src/main/java/com/example/developer/DeveloperService.java new file mode 100644 index 0000000..c0cb8f3 --- /dev/null +++ b/src/main/java/com/example/developer/DeveloperService.java @@ -0,0 +1,15 @@ +package com.example.developer; + +import org.springframework.stereotype.Service; + +@Service +public class DeveloperService { + + public String getRole() { + return "Developer"; + } + + public boolean isValidRole(String role) { + return "Developer".equals(role); + } +} diff --git a/src/test/java/com/example/developer/DeveloperServiceTest.java b/src/test/java/com/example/developer/DeveloperServiceTest.java new file mode 100644 index 0000000..e920527 --- /dev/null +++ b/src/test/java/com/example/developer/DeveloperServiceTest.java @@ -0,0 +1,32 @@ +package com.example.developer; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +@SpringBootTest +class DeveloperServiceTest { + + @Autowired + private DeveloperService developerService; + + @Test + void getRole_returnsDeveloper() { + String role = developerService.getRole(); + assertTrue("Developer".equals(role), "Role should be Developer"); + } + + @Test + void isValidRole_withDeveloper_returnsTrue() { + boolean valid = developerService.isValidRole("Developer"); + assertTrue(valid, "Developer role should be valid"); + } + + @Test + void isValidRole_withOtherRole_returnsFalse() { + boolean valid = developerService.isValidRole("Admin"); + assertTrue(!valid, "Admin role should not be valid for DeveloperService"); + } +}