Skip to content

feat: 버그 수정, 테스트 추가, JDK 25 / Kotlin 2.3.20 업그레이드, 문서 현행화#3

Merged
rudy-lee merged 4 commits intomainfrom
feat/comprehensive-upgrade
Apr 14, 2026
Merged

feat: 버그 수정, 테스트 추가, JDK 25 / Kotlin 2.3.20 업그레이드, 문서 현행화#3
rudy-lee merged 4 commits intomainfrom
feat/comprehensive-upgrade

Conversation

@rudy-lee
Copy link
Copy Markdown
Contributor

작업 개요

CodeArtifact Gradle 플러그인의 안정성, 테스트 커버리지, 종속성 버전, 문서를 전면 개선합니다.

배경 및 의도

  • 기존 코드에 URL 파싱 정규식, 토큰 캐싱, 리소스 관리 등에서 잠재적 버그가 존재했으나 테스트가 전무하여 검출되지 않았습니다.
  • JDK 25 (LTS), Kotlin 2.3.20, AWS SDK 2.42.33 등 최신 안정 버전으로 업그레이드하여 보안 패치와 성능 개선을 반영합니다.
  • README가 영문으로 작성되어 있었고, 플러그인 ID 오류, 버전 불일치 등 문서 부정확성이 있었습니다.

변경사항

1. 버그 수정 (2a81da0)

버그 파일 수정
정규식 .이 리터럴 점이 아닌 임의 문자 매칭 CodeArtifactEndpoint.kt \.d\.codeartifact\. 이스케이프
my-3rd-domain-123456789012 같은 도메인 파싱 오류 CodeArtifactEndpoint.kt \d{12} 정확 매칭 + greedy 도메인
?profile=xxx가 Maven 저장소 URL에 잔존 CodeArtifactEndpoint.kt 클린 URL 재구성, profile 필드 분리
?profile= (빈 값) 시 빈 문자열 전달 CodeArtifactEndpoint.kt takeIf { it.isNotBlank() } 가드
fromUrl(String) 비정상 URI 예외 발생 CodeArtifactEndpoint.kt try-catch 추가
URI fragment(#) 미처리 CodeArtifactEndpoint.kt 정규식에 [^/?#]+ 적용
CodeartifactClient 리소스 누수 CachedCodeArtifactTokenService.kt .use {} 블록
토큰 캐시 레이스 컨디션 CachedCodeArtifactTokenService.kt ConcurrentHashMap.compute()
캐시 키에 domainOwner 미포함 (계정간 충돌) CachedCodeArtifactTokenService.kt "${domainOwner}:${domain}"
isTokenExpired Int 오버플로 잠재 위험 CachedCodeArtifactTokenService.kt 11L Long 리터럴
?flag 키 전용 쿼리 파라미터 크래시 UrlExtension.kt getOrNull(1) 사용

2. 버전 업그레이드 (6ea1f5c)

항목 이전 이후
JDK 21 25 (LTS, Corretto 25)
Kotlin 2.1.21 2.3.20
Kotlin API 1.9 2.0
AWS SDK v2 2.30.33 2.42.33
Plugin Publish 1.3.1 2.1.1
Gradle 9.4.1 9.4.1 (변경 없음)
  • DefaultCredentialsProvider.create().builder().build() (AWS SDK 2.42 deprecation 대응)
  • CI java-version: 25 (Corretto 25)
  • CI Gradle 캐시 키 패턴 수정 (**/*.gradle*, **/libs.versions.toml)

3. 테스트 추가 (d803a60)

기존 0개65개 테스트 추가 (단위 62 + 기능 4)

클래스 커버리지
CodeArtifactEndpointTest 41 URL 파싱, 정규식, 도메인/리전/타입, 프로필, 엣지 케이스
UrlExtensionTest 14 쿼리 파라미터, URL 인코딩, resolveSystemVar
CachedCodeArtifactTokenServiceTest 7 토큰 만료 경계값, TokenModel
CodeArtifactPluginFunctionalTest 4 Gradle TestKit 플러그인 적용, 저장소 필터링

4. 문서 (139e42a)

  • README.md: 한국어 전면 번역, 플러그인 ID 오류 수정, 버전 현행화, settings.gradle.kts 사용법·자격증명 체인·토큰 캐싱 섹션 추가
  • CLAUDE.md: 신규 작성 (프로젝트 아키텍처, 빌드 명령어, 코딩 규칙, CI/CD, dependencyResolutionManagement 미지원 주의사항)

Breaking Changes

  • 없음. 이 플러그인의 public API(codeartifact() 확장 함수, URL 형식)는 변경되지 않았습니다.
  • 내부적으로 Maven 저장소 URL에서 쿼리 파라미터가 제거되는 동작이 추가되었으나, 이는 기존의 잘못된 동작을 수정한 것입니다.

주의사항

  • kotlin-dsl WARNING: Gradle 9.4.1 내장 Kotlin 2.3.0과 프로젝트 Kotlin 2.3.20의 패치 버전 차이로 경고가 출력됩니다. 기능 영향 없으며, Gradle 차기 버전에서 자연 해소됩니다.
  • JDK 25 native access WARNING: JDK 25의 FFM API 제한 정책으로 Gradle native-platform 라이브러리에서 경고가 출력됩니다. Gradle 측에서 대응 예정입니다.
  • CI 테스트: 현재 release.yml에서 --exclude-task test로 테스트를 스킵하고 있습니다. 테스트가 추가되었으므로 향후 CI에 테스트 단계 포함을 권장합니다.

배포 절차

  1. 이 PR 머지
  2. release/0.0.5 태그 생성 → GitHub Actions 자동 배포 → Gradle Plugin Portal 게시
  3. Gradle Plugin Portal에서 버전 0.0.5 게시 확인

검증 완료 항목

  • ./gradlew test — 65 tests, 0 failures
  • ./gradlew build — BUILD SUCCESSFUL
  • 모든 문서 ↔ 코드 교차 검증 완료
  • AWS SDK 2.42.33 deprecation 경고 제거 확인
  • JDK 25 + Kotlin 2.3.20 + Gradle 9.4.1 호환성 확인

🤖 Generated with Claude Code

rudy-lee and others added 4 commits April 13, 2026 16:42
- Fix unescaped dots in CodeArtifact URL regex (`.` -> `\.`)
- Fix incorrect domain parsing for domains with digits after hyphens
  by using `\d{12}` for domainOwner and greedy match for domain
- Strip query parameters from Maven repository URL to prevent
  `?profile=xxx` from leaking into artifact resolution URLs
- Add `profile` field to CodeArtifactEndpoint parsed from query params
- Handle URI fragments (`#`) in URL parsing regex
- Guard against empty/blank profile values defaulting to "default"
- Add try-catch in fromUrl(String) for malformed URI handling
- Fix CodeartifactClient resource leak with `.use {}` block
- Fix token cache race condition with ConcurrentHashMap.compute()
- Include domainOwner in cache key to prevent cross-account token reuse
- Use Long literal in token expiry calculation to prevent overflow
- Fix queryParameters() crash on key-only params (e.g., `?flag`)
- Use endpoint.profile instead of manual query param parsing in plugin

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Version upgrades:
- JDK: 21 -> 25 (LTS, Corretto 25)
- Kotlin: 2.1.21 -> 2.3.20 (JVM_25 target support)
- Kotlin API version: 1.9 -> 2.0
- AWS SDK v2: 2.30.33 -> 2.42.33
- Gradle Plugin Publish: 1.3.1 -> 2.1.1
- Gradle wrapper: 9.4.1 (already current)

Additional changes:
- Fix DefaultCredentialsProvider.create() deprecation in AWS SDK 2.42
- Update CI to use Corretto 25
- Fix CI Gradle cache key to match .gradle.kts and libs.versions.toml
- Update plugin tags from jdk17 to jdk25

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Unit tests:
- CodeArtifactEndpointTest (41): URL parsing, regex, domain/region/type
  variations, profile extraction, clean URL generation, edge cases
- UrlExtensionTest (14): query parameter parsing, key-only params,
  URL encoding, resolveSystemVar
- CachedCodeArtifactTokenServiceTest (7): token expiry boundaries,
  TokenModel data class behavior

Functional tests (Gradle TestKit):
- CodeArtifactPluginFunctionalTest (4): plugin application to
  project/settings, non-CodeArtifact repo passthrough, extension usage

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
README.md:
- Full Korean translation
- Update version requirements table
- Fix plugin ID (com.kmong.aws:codeartifact -> com.kmong.codeartifact)
- Unify all code examples to Kotlin DSL syntax
- Add settings.gradle.kts usage guide
- Add AWS credential resolution chain documentation
- Add token caching behavior documentation

CLAUDE.md (new):
- Project overview and architecture
- Build commands and tech stack
- Key files and their responsibilities
- Plugin flow, token caching, and URL regex documentation
- Coding conventions and CI/CD info
- Note about dependencyResolutionManagement limitation

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@rudy-lee
Copy link
Copy Markdown
Contributor Author

프로덕션 릴리즈 안전성 검토 보고서

전체 변경사항(18개 파일, +1,084 / -140)을 5회 패스로 교차 검증한 결과입니다.


1. 소스 코드 검증 (5개 파일)

CodeArtifactEndpoint.kt

항목 검증 결과
정규식 \.d\.codeartifact\. 이스케이프 ✅ 리터럴 점만 매칭. 테스트 regex does not match URLs with non-literal dots로 증명
\d{12} domainOwner 정확 매칭 my-3rd-domain-123456789012 → domain=my-3rd-domain, owner=123456789012. 테스트 fromUrl handles domain with digits after hyphens로 증명
greedy .+ 도메인 + \d{12} 조합 ✅ 역추적으로 마지막 12자리 숫자 앞 하이픈을 경계로 올바르게 분리
클린 URL 재구성 (쿼리 제거, 후행 / 추가) ✅ 테스트 fromUrl generates clean URL without query parameters로 증명
profile takeIf { it.isNotBlank() } 가드 ?profile=, ?profile=%20%20 모두 "default" 반환. 테스트 2건으로 증명
fromUrl(String) try-catch ✅ 공백 포함 URL에서 null 반환. 테스트 fromUrl returns null for URL with spaces로 증명
[^/?#]+ fragment 처리 repo#fragment → repository=repo. 테스트 fromUrl strips fragment from URL로 증명

CachedCodeArtifactTokenService.kt

항목 검증 결과
compute() 원자적 갱신 ✅ check-then-act 레이스 컨디션 제거. ConcurrentHashMap.compute는 키 단위 락 보장
캐시 키 "${domainOwner}:${domain}" ✅ 동일 도메인명의 다른 계정 간 토큰 충돌 방지. 테스트 fromUrl differentiates endpoints with same domain but different domainOwner로 간접 증명
.use {} 블록 ✅ CodeartifactClient(AutoCloseable) 리소스 자동 정리
11L * 60 * 60 * 1000 ✅ Long 연산 보장. 현재 값(39,600,000)은 Int 범위 내이나 방어적 조치

CodeArtifactPlugin.kt

항목 검증 결과
endpoint.profile 사용 ✅ 쿼리 파라미터 수동 파싱 제거. endpoint에서 이미 파싱된 profile 사용
repository.url = endpoint.url ✅ Kotlin contract 스마트캐스트 → DefaultMavenArtifactRepository.setUrl(URI) 호출 가능
import com.kmong.queryParameters 제거 ✅ 더 이상 직접 사용하지 않음 (CodeArtifactEndpoint 내부로 이동)

UrlExtension.kt

항목 검증 결과
getOrNull(1) ?: "" ?flag (= 없음) → "flag" to "". 테스트 queryParameters handles key-only parameter without equals로 증명

Credentials.kt

항목 검증 결과
DefaultCredentialsProvider.builder().build() ✅ AWS SDK 2.42 deprecation 대응. 독립 인스턴스 생성 (싱글톤 공유 문제 해소)

2. 버전 호환성 검증

조합 검증 방법 결과
Gradle 9.4.1 + JDK 25 ./gradlew test 성공 + Gradle 공식 문서
Kotlin 2.3.20 + JDK 25 JvmTarget.JVM_25 소스코드 확인
Kotlin 2.3.20 + Gradle 9.4.1 Kotlin 2.3.20 릴리스 노트: 9.3.0까지 공식, 9.4.1 동작 확인 ✅ (경고만)
AWS SDK 2.42.33 semver 호환 2.x 내 하위 호환. deprecation 1건 해결 완료
Plugin Publish 2.1.1 gradlePlugin 블록 API 호환. 빌드 성공으로 확인
Corretto 25 CI 가용성 AWS 공식

3. 테스트 커버리지 검증

클래스 테스트 수 핵심 커버리지
CodeArtifactEndpointTest 41 URL 파싱 전경로, 정규식, 도메인/리전/타입 변형, 프로필, 클린 URL, 오류 입력
UrlExtensionTest 14 쿼리 파라미터 전경로, URL 인코딩, 중복 키, resolveSystemVar
CachedCodeArtifactTokenServiceTest 7 토큰 만료 경계값 (0/10/11-/11+/12h), data class 동작
CodeArtifactPluginFunctionalTest 4 Gradle TestKit: project/settings 적용, 비-CA 저장소 통과, 확장 함수
합계 65 0 failures

4. 문서 ↔ 코드 일관성 검증

검증 항목 README CLAUDE.md 코드 일치
플러그인 ID com.kmong.codeartifact com.kmong.codeartifact "$group.codeartifact"
버전 (Kotlin/JDK/AWS/Gradle) 2.3.20/25/2.42.33/9.4.1 동일 libs.versions.toml 일치
자격증명 체인 6단계 순서 일치 Credentials.kt 체인 순서
토큰 유효 12h, 갱신 11h 일치 일치 durationSeconds(43200), 11L*60*60*1000
캐시 키 domainOwner:domain 일치 일치 "${endpoint.domainOwner}:${endpoint.domain}"
CI JDK 25 Corretto release.yml java-version: 25
정규식 코드와 동일 CodeArtifactEndpoint.kt:55-56

5. Breaking Changes 검증

변경 영향 분석 판정
Maven 저장소 URL에서 ?profile=xxx 제거 기존에 쿼리 파라미터가 잔존하던 것이 수정됨. CodeArtifact는 쿼리 파라미터 무시하므로 동작 차이 없음 비파괴적
URL에 후행 / 추가 Maven 저장소 base URL의 표준 형식. CodeArtifact는 양쪽 모두 허용 비파괴적
profile 필드 추가 (public) 기존 API에 필드 추가. 기존 사용자 코드에 영향 없음 비파괴적
codeartifact() 확장 함수 시그니처 변경 없음 비파괴적

6. 잔여 경고 (무해)

경고 원인 프로덕션 영향
Unsupported Kotlin plugin version Gradle 내장 Kotlin 2.3.0 vs 프로젝트 2.3.20 패치 차이 없음
restricted method in java.lang.System JDK 25 native access 정책 + Gradle native-platform 없음

결론

프로덕션 릴리즈 안전합니다.

  • 소스 코드 5개 파일의 모든 변경이 논리적으로 올바르며, 65개 테스트(단위 61 + 기능 4)로 증명되었습니다.
  • 버전 업그레이드 6개 항목 모두 공식 문서와 실제 빌드로 호환성이 확인되었습니다.
  • Breaking Change가 없으며, 문서와 코드의 일관성이 완전합니다.
  • 잔여 경고 2건은 모두 외부 요인(Gradle/JDK)이며 기능 영향이 없습니다.

🤖 Generated with Claude Code

@rudy-lee rudy-lee self-assigned this Apr 13, 2026
@rudy-lee rudy-lee merged commit 4d710a2 into main Apr 14, 2026
@rudy-lee rudy-lee deleted the feat/comprehensive-upgrade branch April 14, 2026 02:45
@bear-engineer
Copy link
Copy Markdown
Contributor

키야~~~~~~~~끝내줘여!!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants