다운로드 로직을 리펙토링 합니다.#268
Conversation
- dismisss 아닌 녹음 화면 진입 시
- 존재하지 않는 파일을 찾고 있었기 때문에 source of Trueth 실패 - 추천 모델 까지만 확인하고 삭제도 동일
- 사용하지 않는 핑드 값을 제거합니다.
- 진행중인 다운로드는 UUID 를 통해 식별하여 cancel - 마지막으로 downloading상태면 return 적용
- 매크로 자동 코드가 SPM에서 tuist test에 계속 빌드 실패로 나와 내부 수동 코드를 직접 파일에 추가했습니다.
There was a problem hiding this comment.
Code Review
This pull request removes the runtime state from OnDeviceStatus to simplify model status tracking, replaces compile-time macros with manual implementations for MLXHubDownloader and MLXTokenizerLoader, and refactors download task management in OnDeviceStatusUseCase to better handle cancellations. Feedback on these changes highlights two key issues: first, simplifying the directory check in WhisperKitProvider by removing the vocab.json and config.json checks may cause crashes if a download is incomplete; second, using @MainActor in the progress handler of MLXHubDownloader could degrade UI performance due to excessive main-thread dispatches.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
🛠️ Tuist Run Report 🛠️Tests 🧪
Builds 🔨
|
✨ 작업 요약
📋 구체적인 내용
추가/변경된 동작:
tuist test및xcodebuild test중 컴파일러가 매크로 플러그인(MLXHuggingFaceMacros)을 로딩할 때 발생하는 아키텍처/플랫폼 미스매치 에러(produced malformed response)를 우회했습니다.MLXHubDownloader.swift와MLXTokenizerLoader.swift파일로 온전히 분리했습니다.MLXModelProvider에서 inline 매크로 사용 부분을 지우고 위 독립 파일 구조체들을 호출하도록 리팩토링하여 빌드 의존성 및 코드 가독성을 대폭 끌어올렸습니다.UUID로 식별하여 새로운 요청 시 기존 작업을 취소(cancel)하도록 개선했습니다.downloading상태인 경우 추가 작업 실행 없이 early return 처리하여 안정성을 확보했습니다.보정했습니다.
사용량을 개선했습니다.
tuist generate를 실행할 때마다 최상위 루트 디렉토리에 둔 앱 로고가 유실되던 문제를 막기 위해, 리소스를Resource내부 경로에 안전하게 안착시키고 Tuist 스킴설정을 수정했습니다.
OnDeviceStatus도메인 모델 내 불필요한runTime필드를 제거했습니다.swiftformat컨벤션을 통일했습니다.영향 받는 화면/모듈:
Data모듈 (Infrastructure/OnDevice/MLXSupport, Whisper)Domain모듈 (Entities, Usecases)App모듈 (녹음 진입 화면 및 Tuist 리소스/아이콘 설정)🔗 연관 이슈
🧩 설계·구현 노트
선택한 방식
MLXHuggingFace라이브러리의#hubDownloader(),#huggingFaceTokenizerLoader()매크로 플러그인은 Xcode/SPM/Tuist 아키텍처환경에 따라 빌드 불안정성이 매우 큽니다. 매크로의 동작 방식(HubBridge 및 TokenizerBridge 래핑)을 파악하여 독립적인
MLXHubDownloader,MLXTokenizerLoaderSwift구조체로 선언함으로써 매크로 컴파일 의존성을 100% 제거하고 빌드를 완벽히 안정화했습니다.
얼리 리턴하는 정석적인 동시성 제어 방식을 택했습니다.
고려했다가 제외한 방식
xcodebuild및 Tuist 캐시 전체 리셋/매크로 컴파일 검증 플래그 추가: 이는 개별 개발자 로컬 환경 및 CI 환경마다 빌드가 오락가락하는 근본적인 문제를 해결하지 못하며,협업 환경에서 매번 캐시 제거 작업을 유도해야 하므로 제외했습니다.
✅ 확인 사항
tuist generate및 프로젝트 정상 구성 확인)tuist test109개 테스트 통과 완료)👀 리뷰 포인트
특히 봐줬으면 하는 부분
MLXHubDownloader.swift와MLXTokenizerLoader.swift로 깔끔하게 모듈화되어 분리된 파일 배치 구조가 프로젝트 아키텍처 컨벤션과 매끄럽게 어우러지는지 중점적으로검토해 주시면 감사하겠습니다.
📚 참고