chore(concurrency): 라이브러리를 Swift 6 language mode 에서 빌드되게 + CI 게이트#25
chore(concurrency): 라이브러리를 Swift 6 language mode 에서 빌드되게 + CI 게이트#25DevVenusK wants to merge 2 commits into
Conversation
- 불변·1회 설정 static 상태에 nonisolated(unsafe) 적용: static ISO8601DateFormatter, 매크로 타입 서술자(protocolType, macroType) - 불변 값/메타타입/에러 홀더에 @unchecked Sendable 적용: LosslessValueCodable, OptionalLosslessValueCodable(조건부), PolymorphicCodableError, ArrayDecodingError, DictionaryDecodingError, UnknownNovelValueError
swift build -Xswiftc -swift-version -Xswiftc 6 를 실행하는 CI 잡을 추가해 Swift 6 언어 모드 에러 발생 시 실패하도록 한다.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
배경
라이브러리가 Swift 6 language mode 에서 컴파일되지 않았습니다. 다음이 비-
Sendable공유/전역 상태에서 실패합니다.swift build -Xswiftc -swift-version -Xswiftc 6 # ← 에러로 실패왜 -strict-concurrency=complete 로는 부족한가
처음엔 Swift 5 모드의
-strict-concurrency=complete로 범위를 재려 했으나, 이는 근사치였습니다. 진짜 Swift 6 모드는 정적 전역(#MutableGlobalVariable)을 하드 에러로 처리하고 그 지점에서 빌드를 조기 중단해 하위 파일의 문제를 가립니다.그래서 정본 기준을
-swift-version 6빌드 성공(exit 0) 으로 잡고, 매크로 타깃 정적부터 고쳐 라이브러리 에러가 드러나게 한 뒤 전부 해소했습니다.변경사항
ISO8601DateFormatternonisolated(unsafe)protocolType/macroTypenonisolated(unsafe)LosslessValueCodable/OptionalLosslessValueCodable@unchecked Sendable(조건부)type은 불변 메타타입;where Strategy.Value: Sendable유지PolymorphicCodableError@unchecked SendableArrayDecodingError/DictionaryDecodingError@unchecked Sendable(DEBUG 전용)UnknownNovelValueError@unchecked SendablenovelValue는 1회 캡처 후 읽기 전용또 회귀 방지를 위해 CI 잡을 추가했습니다.
변경 파일
ISO8601WithFractionalSecondsStrategy.swift,LosslessValue.swift,OptionalLosslessValue.swift,PolymorphicCodableError.swift,ArrayDecodingError.swift,DictionaryDecodingError.swift,ErrorReporting.swiftUnnestedPolymorphicCodableMacro.swift,UnnestedPolymorphicDecodableMacro.swift.github/workflows/ci.yml10 files changed, +40 / −8
변경했을 때의 트레이드 오프
@unchecked Sendable/nonisolated(unsafe)는 컴파일러 검사 우회 + 개발자 보증입니다. 대상이 전부init후 불변이라 안전하지만, 향후 이 타입들에 가변 상태가 추가되면 보증이 깨질 수 있어 각 지점에 근거 주석을 남겼습니다.Package.swift에StrictConcurrency를 켜지 않았습니다. 켜면 "기타"의 양성 warning 1건이 모든 기여자의 일반 빌드에 상시 노출됩니다. 대신 일반 빌드는 깨끗하게 두고, 회귀는 CI 의-swift-version 6게이트로 잡습니다. (트레이드: 로컬에서 즉시 strict 피드백은 못 받음)테스트 방법
swift build -Xswiftc -swift-version -Xswiftc 6→ exit 0 (정본 준비도 게이트, CI 에서 강제).swift test -c debug/swift test -c release— 전부 통과(실패 0), 런타임 동작 변화 없음.기타
ResilientDecodingOutcome.recoveredFrom(any Error), 그리고RFC3339/RFC3339Nano의 staticDateFormatter. (SDK 가DateFormatter는 이미Sendable로 표기했고,ISO8601DateFormatter만 아직 아님.)-strict-concurrency=complete에서만 남는 양성 진단 1건:Resilient/ErrorReporting.swift:68— airbnb 유래 에러 리포터 왕복의Any. Swift 6 language mode 에서도 warning 이며 Swift 6 빌드를 막지 않습니다.MemberMacrodeprecated API 경고 ~78건,validateFallbackCaseNameunused-result 경고 몇 건.