Repository navigation
[CI] iOS lane Xcode 빌드 캐시와 시뮬레이터 VM service 연결 멈춤 수정 - #493
Conversation
- iOS job: DerivedData와 SwiftPM SourcePackages를 Xcode·Flutter toolchain, pubspec.lock, ios 소스로 만든 키로 캐시한다. - Flutter 3.44.0 tool이 log stream 준비 전에 앱을 실행해 VM service 주소를 놓치는 경합(flutter/flutter#181771)을 상류 수정(flutter/flutter#193142)으로 막는다. 적용할 수 없거나 스냅샷에 반영되지 않으면 실패한다. Refs AquilaXk/easysubway#3036
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
테스트 첫 줄(NATIVE_SYSTEM_TEXT_SCALE=)이 새로 뜬 log stream 준비 전에 나가 사라지는 경합(CI 2회 font_scale_mismatch)을 막는다.
프로브 확인: v1 캐시에서 v2 소스를 증분 빌드하면 v1 문자열은 사라지고 v2만 남는다(네이티브 Runner.app, Dart 로그 모두).
AquilaXk
left a comment
There was a problem hiding this comment.
Actionable comments posted: 3
🎯 Linked issue & acceptance criteria audit
- Linked issue: #3036 [Test] Epic raising the test system to public routing-engine standards
- Goal summary: Cut iOS native job time with build caches and stop the VM service connect hang.
- Acceptance criteria verified: 2/2
| ID | Acceptance criterion | Status | Evidence |
|---|---|---|---|
| 4-30 | Introduce SwiftPM source package and DerivedData caches compared with external cases | PASS | .github/workflows/mobile-native-integration.yml |
| 4-31 | Investigate the hang before VM service connection using external cases | PASS | tools/ci/apply-flutter-patch.sh |
🛡️ Adversarial audit evidence
- Falsifiability verified: Yes (Scratch-copy mutants of the script check, skip branch, and stamp reset failed tests.)
- Hollow assertions detected: 0
- Production backdoors detected: 0
- Ground-truth sources verified:
actionlint and shellcheck exit 0 on the workflow and tools/ci scriptsCache probe runs 39261439741 and 39263913123 cited in the PR body for Dart and native reflectionnode --test of the contract file ran 80 of 80 passing at head eae18e1a
🤖 Prompt for all review comments with AI agents
Could we verify each finding against the current code and keep only those that
still apply? Could we make the smallest validated fix and briefly note why any
finding no longer applies?
Inline comments:
- `@.github/workflows/mobile-native-integration.yml:203-204`
Could a follow-up checklist row split this into restore plus a save step guarded by
`github.ref == 'refs/heads/main'`, and compare eviction after a week of runs?
- `@tools/ci/apply-flutter-patch.sh:21-26`
Could the patch header note that a revised patch needs a new file name or a cache
bust, so a later editor is not surprised by the persistent failure?
- `@tools/ci/mobile-native-integration-workflow.test.mjs:82-82`
Could the pattern exclude only the new word, for example `(?<!re)store`? That keeps
restore-keys allowed and still rejects keystore, datastore, and appstore tokens.
---
Outside diff comments:
None.
ℹ️ Review info
⚙️ Run configuration
Configuration used: CLAUDE.md, global rules, and aquila-review skill instructions
Review profile: ASSERTIVE
Plan: Aquila fallback
Run ID: N/A (Aquila fallback)
Review source: Aquila CLI
Repository visibility: public GitHub repository
Trigger:
Discovery review requested once for the current change set
Base:
main@54a62f71d69801c618f32b1ff0237cde4da88db2
Head:
ci/ios-lane-cache-and-attach-3036@eae18e1a52d9be9f3328aad7b2fcbc17924cd6ce
Command:
node compile-review-payload.mjs input.json --output payload-1.json
📥 Commits
Reviewing files changed in this pull request between:
- Base:
54a62f71d69801c618f32b1ff0237cde4da88db2 - Head:
eae18e1a52d9be9f3328aad7b2fcbc17924cd6ce
📒 Files selected for processing (3)
.github/workflows/mobile-native-integration.ymltools/ci/apply-flutter-patch.shtools/ci/mobile-native-integration-workflow.test.mjs
📜 Review details
- 가드 정규식을 (?<!re)store로 바꿔 keystore·datastore·appstore·app_store를 다시 막고 restore만 허용한다. - actions/cache를 restore와 save로 나누고 save는 main push에서 정확한 일치가 없을 때만 한다. - flutter-action SDK 캐시 키에 패치 파일 해시를 넣고, 적용 실패 안내에 SDK 캐시 비우기·패치 파일명 변경을 적었다.
|
No description provided. |
|
No description provided. |
Related issue
Refs AquilaXk/easysubway#3036 (4-30 iOS job 시간, 4-31 산출물 재사용 drive 연결 멈춤)
head SHA:
1f5b120648796834e17c7b69918b063ea5523c63(리뷰 F1~F3 반영. 시간 표 측정은 이전 headeae18e1a까지의 run이며, 그때는 PR run도 캐시를 저장했다)Summary
23.4분 걸린다. 첫 drive의 Xcode 빌드(181378초)와 SwiftPM 내려받기·해석이 매번 처음부터 돈다.The Dart VM service is listening) flutter 도구가 연결하지 못하고 멈춘다. 이 PR 이전 코드로 CI를 다시 돌려 보니 11번 중 4번(36%) 멈췄다(run 39205377932, 39220194223 attempt 1, 39227205071 attempt 4·5).simctl spawn ... log stream이 준비되기 전에 앱이 실행돼 VM service 주소 줄을 놓친다. 같은 경합이 한 곳 더 있다(아래). 상류 수정([flutter_tools] Wait for iOS simulator log stream before launch flutter/flutter#193142, 2026-10-15 master 병합, 3.44.0에는 없음)을 3.44.0 소스에 옮기고 두 번째 경합용 확장을 더해 CI에서 적용한다. 적용 뒤 22번 중 0번 멈췄다. 재시도 예외는 넣지 않았다.Changes
.github/workflows/mobile-native-integration.yml(iOS job만)Apply Flutter iOS simulator log stream fix: Flutter SDK에 패치를 적용한다.Resolve Xcode build cache key,Restore Xcode build cache(actions/cache/restore),Save Xcode build cache(actions/cache/save): DerivedData와apps/mobile/build/ios/SourcePackages를 캐시한다. 저장은 main push에서 정확한 일치가 없을 때만, smoke가 성공한 뒤에 한다. 키는runner.os-runner.arch-Xcode 버전·빌드-Flutter 버전·엔진-hash(pubspec.lock, ios/**)이고, restore-keys는 같은 toolchain 접두사까지만이다.Set up Flutter의 SDK 캐시 키에 패치 파일 해시를 넣었다(cache-key: …-patch-${{ hashFiles('tools/ci/flutter-patches/*.patch') }}). 패치가 바뀌면 이전 패치가 남은 SDK 대신 새 SDK를 받는다. 패치한 SDK가 캐시에 저장되어 다음 run은 패치 단계가 0초다(run 39350287566 attempt 2).Report Xcode build cache: exact hit, partial restore, miss와 캐시 크기를 step summary에 남긴다.paths트리거에 넣었다(pull_request, push 둘 다).tools/ci/apply-flutter-patch.sh: 패치 적용 + tool 재빌드 + 스냅샷 확인. 적용할 수 없거나 스냅샷에 반영되지 않으면 실패한다. 이미 적용된 SDK는 건너뛴다.tools/ci/flutter-patches/3.44.0-ios-simulator-log-stream-ready.patch:packages/flutter_tools/lib/src/ios/simulators.dart한 파일.tools/ci/mobile-native-integration-workflow.test.mjs: 계약 테스트 10개 추가(71개에서 81개). 기존 단언은 가드 정규식 하나만 바꿨다.release|store의store를(?<!re)store로 바꿔restore-keys의 restore만 예외로 하고keystore,datastore,appstore,app_store는 다시 걸린다(별도 테스트가 네 단어와 restore를 단언).native-drive-common.sh,ios-native-drive.sh,android-native-drive.sh(공용 fail-closed 규칙, 구조화 결과 판정 [CI] native lane 대상을 단일 integration_test 진입점으로 묶어 앱 빌드를 1회로 줄임 #492).Scope
Included
Excluded
Ownership / dependencies
조사한 사례와 선택
API·데이터 원천 카탈로그 대조: CI 도구 변경이라 해당 없음(외부 API를 쓰지 않는다).
4-30 캐시
IgnoreFileSystemDeviceInodeChanges와 mtime 복원 사용cache: true가 SDK와 pub 의존성을 캐시버린 대안 (4-30)
macos-15-xlarge): 비용이 든다. 표준 러너 run 사이 편차(같은 설정이 11~21분)가 러너 크기 효과보다 커서 효과를 가려내려면 요금을 내고 재 봐야 한다. 제안만 한다.core.checkStat: 시험해 필요 없음을 확인(설정 있는 run 39244328761과 없는 run 39247469198 모두 복원한 빌드의 CompileC 1건·SwiftCompile 12건).Package.resolved캐시: 이 파일은 저장소에 없고 SwiftPM 의존성이 매번 최신 범위로 풀린다. 캐시하면 키가 바뀔 때까지 영구 고정되어 의존성이 조용히 묵는다. 지금 동작(SourcePackages는 재사용, 해석은 매번)을 유지했다..dart_tool/flutter_build캐시: Dart 커널 컴파일이 5~47초라 이득이 작다.simctl boot가 부팅이 끝날 때까지 막아서(149초) 겹치지 않았고, 백그라운드로 돌리면 3코어 러너에서 캐시 키 계산(88초)과 패치 적용(78초)이 느려졌다. 공용 흐름의 단계 순서를 바꿔야 의미가 있어 이 PR 범위 밖이다.4-31 연결 멈춤
flutter test가 iOS 시뮬레이터에서 40번 중 3번, 20번 중 2번 시작하지 않음. 원인은_IOSSimulatorLogReader의 경합.--no-dds는 효과 없었다고 보고. 우회책은 재시도·감시 스크립트simulators.dart,protocol_discovery.dart,drive_service.dart)--host-vmservice-port·--device-vmservice-port는 로그 줄을 거르기만 하고 놓친 줄을 되살리지 못한다. mDNS는flutter attach에서만 쓰고 run·drive의 앱 시작은 로그만 쓴다.--no-dds는 lane에 이미 있다원인 (로그로 확인)
simctl launch를 실행한다. 느린 러너에서 앱이 주소를 먼저 남기면 tool이 영영 놓친다. 멈춘 run 39220194223 attempt 1의 시뮬레이터 로그에는Runner ... The Dart VM service is listening on http://127.0.0.1:58766/...줄이 있는데 flutter drive 로그에는 연결 줄이 없다.-v로그에서 주소를 찾은 직후simctl spawn ... log stream이 한 번 더 실행됨). 이 stream이 준비되기 전에 테스트가 시작하면 테스트 첫 줄을 잃는다. run 39229893574 attempt 2와 39250828131 attempt 3은 앱이NATIVE_SYSTEM_TEXT_SCALE=줄을 냈는데(시뮬레이터 로그에 있음) drive 로그에는 5초 정도 구간이 비어font_scale_mismatch로 실패했다. 첫 번째 경합이 사라지면 같은 느린 러너가 이 경합에 걸린다.조치
provideVmService(드라이버가 listener를 붙인 직후 부름)에서 같은 준비 신호를 기다린다.측정
iOS job 시간 (분, 시작~완료)
같은 시각에 시작한 짝 비교(이전 설정은 main push run 39227205071을 rerun)
Xcode 빌드 (flutter drive 로그의
Xcode build done, 초)컴파일 작업 수(
flutter drive -v): 캐시를 복원한 drive 빌드는 CompileC 1·SwiftCompile 12·Ld 36(run 39244328761, 39247469198 두 번 같은 값). 비교 감각용으로, 같은 소스를 처음부터 빌드한 진단 빌드(flutter build ios --simulator, x86_64 포함이라 구성이 달라 엄밀한 비교는 아님)는 CompileC 414·SwiftCompile 217·Ld 72였다.해석: 컴파일은 캐시로 확실히 줄지만 job 전체는 러너 속도가 좌우한다. 같은 설정이 11
21분으로 흔들리므로 "항상 15분대"가 아니라 "중앙값 15분 안팎, 멈춰서 실패하는 run 제거"로 읽어야 한다. 캐시 비어 있는 run은 이전과 비슷하고 저장에 5375초가 더 든다. 캐시 복원은 22~39초.4-31 반복 실행
font_scale_mismatch0개 (확장 전 패치만 적용한 job 10개 중 2개)이후 22개 안에는 임시 진단·시험 step이 들어간 job도 포함했다. 멈춤 비율이 이전과 같다면(36%) 22번 연속 0번일 확률은 약 0.005%다.
캐시 정확성
소스를 바꾼 뒤 증분 빌드가 변경을 반영하는지 확인했다(임시 프로브, 이 PR에서 되돌림 — 최종 diff에
AppDelegate.swift와native_smoke_test.dart변경 없음).Runner.app안CACHE_PROBE_NATIVE_v1, drive 로그CACHE_PROBE_DART_v1NSLog("CACHE_PROBE_NATIVE_vN"),native_smoke_test.dart에print('CACHE_PROBE_DART_vN')을 임시로 넣었다. 프로브를 되돌린 뒤의 run(39292224363)은 원래 키로 exact hit이고 통과했다.Contract & Compatibility
Version impact
Release gate impact
Store submission readiness impact
Version decision
Verification
ENOENT로 로드 실패(RED). 구현 후node --test tools/ci/mobile-native-integration-workflow.test.mjs→ tests 81, pass 81, fail 0. 새 테스트: 가드 정규식(keystore·datastore·appstore·app_store는 걸리고 restore는 통과), 캐시 restore/save 분리와 main push 한정, SDK 캐시 키의 패치 해시, 패치 적용·재빌드, 이미 적용된 SDK 건너뜀, 스냅샷이 낡았으면 재빌드, 다른 버전 SDK에서 실패, 재빌드 후 스냅샷에 수정이 없으면 실패, 실패 무시 금지, 워크플로 단계 순서·캐시 키 구성·Android 무변경\bstore\b로 되돌리기, 저장 조건에서 main 한정 빼기, 저장 조건에서 push·main 한정 모두 빼기, SDK 캐시 키 줄 삭제, 스크립트 안내 문구 삭제를 각각 넣으면 해당 테스트가 fail(5/5), 원복 후 81/811f5b1206attempt 1(SDK 캐시 miss라 23.1분,Save Xcode build cacheskipped)·attempt 2(패치한 SDK 캐시 hit, 패치 단계 0초, 16.8분) 모두 PASS. 이전 head: run 39292224363 headeae18e1aattempt 1·2·3 모두 PASS(13.9분, 13.5분, 24.3분(캐시 비움)). Android Journey native smoke 같은 run PASS (이전 head의 run 39277682964 attempt 1에서 Android 에뮬레이터 boot 실패 1회,rerun --failed로 통과, 이 변경과 무관)1f5b1206전 check green (Mobile contracts, Mobile host tests, Android build, Mobile Golden CI, CI scope, Changed Path Classification, osv-scan, CodeQL, 두 native smoke)actionlint .github/workflows/mobile-native-integration.ymlexit 0,shellcheck -x apply-flutter-patch.sh ios-native-drive.sh android-native-drive.sh native-drive-common.sh(tools/ci에서) exit 0dart analyze문제 없음. 시뮬레이터에서flutter drive -v로 주소 발견 직후 두 번째 log stream 시작과 테스트 출력 정상 확인Not run
simulators_test.dart)CpuArch등). 대신 계약 테스트와 CI 반복 실행으로 확인했다Risk
Package.resolved가 저장소에 없어 SwiftPM 의존성은 매 run 최신 범위로 풀린다(기존 동작). 캐시는 이를 고정하지 않는다.Rollout / Recovery
timeout·font_scale_mismatch) 빈도Review focus
apply-flutter-patch.sh의 fail-closed 조건과 패치 머리말의 제거 조건Checklist