feat(mock): env3 런타임 충실화 — 6 env-API sync→Promise + fetchContacts.getPermission 런타임 부재#796
Merged
Merged
Conversation
…Permission 런타임 부재 (#775 확장) sdk-example env1↔env3 재측정에서 남은 8건 mismatch를 닫는다. 전부 상류 SDK의 type↔runtime 불일치(선언 X, 런타임 Y)이고 mock 품질 결함이 아니다. - getPlatformOS/getOperationalEnvironment/getLocale/getDeviceId/ isMinVersionSupported/getSafeAreaInsets(navigation/index.ts): 선언 타입은 전부 동기지만 실기기(2.x×iOS)는 Promise를 반환한다. 시그니처는 상류와 동일하게 두고 반환값만 Promise.resolve(...)로 감싸 캐스트 — __typecheck.ts/ __typecheck-2x.ts 둘 다 그대로 컴파일된다(런타임 Promise는 tsc에 안 보임). - fetchContacts.getPermission(device/contacts.ts): 상류가 타입에는 PermissionFunctionWithDialog로 선언하지만 실기기 런타임엔 부착하지 않는다. withPermission() 대신 bare async fn을 상류 타입으로 캐스트해 접근 시 undefined, 호출 시 native TypeError로 떨어지도록 재현. openPermissionDialog 부재는 측정 근거 없는 합리적 추론으로 주석에 구분 표기, 다른 withPermission API(clipboard/camera/location)로는 확장하지 않음(#783 "측정 밖 확장 금지"). 기존 단위 테스트 중 이 6개 API를 동기로 단정하던 것과, fetchContacts. getPermission()이 resolved를 반환한다고 단정하던 것은 실기기 실측에 맞춰 갱신 — 그 테스트들이 재현하던 동작이 비충실했다. Closes #795
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
목적
sdk-example env1(브라우저+mock)↔env3(실기기 토스 WebView) 재측정에서 남은 8건 mismatch를 닫는다. 전부 상류 SDK의 type↔runtime 불일치(선언은 X, 런타임은 Y)이고 mock 품질 결함이 아니다 — devtools #775 원칙("mock은 타입 선언이 아니라 런타임 실측을 재현한다")을 두 방향(동기/비동기 축, 멤버 존재 여부)으로 확장한다.
Closes #795
Before / After
Part A — 6 env-API (
src/mock/navigation/index.ts)getPlatformOS/getOperationalEnvironment/getLocale/getDeviceId/isMinVersionSupported/getSafeAreaInsetsPromise.resolve(값)(같은 시그니처로 캐스트)선언 타입은 전혀 바꾸지 않았다 —
__typecheck.ts(3.0-beta)·__typecheck-2x.ts(2.x) 둘 다 그대로 컴파일된다(런타임 Promise는 tsc에 안 보임).getSafeAreaInsets는 기존 #770의object캐스트를Promise.resolve(...)로 한 겹 더 감쌌다.Part B —
fetchContacts.getPermission(src/mock/device/contacts.ts)fetchContacts.getPermission()PermissionStatusundefined→ 호출 시 nativeTypeErrorTypeErrorwithPermission()으로 감싸지 않고_fetchContacts를 상류 타입(typeof _fetchContacts & { getPermission; openPermissionDialog })으로만 캐스트했다._fetchContacts내부에서 이미checkPermission을 호출하므로 메인 동작(권한 거부 시FetchContactsPermissionError)은 변화 없음.standalone
getPermission({name:'contacts', access:'access'})는 실기기에서 정상 resolve하므로(src/mock/permissions.ts) 이 변경은fetchContacts에 부착된 메서드에만 적용된다.Part B 상태 — 부분 확장 명시
getPermission부재는 issue의 직접 실측이고 이번 커밋으로 반영했다.openPermissionDialog부재는 측정 근거 없는 합리적 추론이다 — 상류가 fetchContacts에 권한 헬퍼 전체를 붙이지 않는다고 보는 것. 코드 캐스트에서 같은 취급을 했고(둘 다 attached-member 부재), 코드 주석에 이 구분을 명시했다. 호출 시 nativeTypeError로 떨어짐을 직접 확인했다.withPermissionAPI(clipboard/camera/location)로는 확장하지 않았다 — 그쪽 부착 메서드의 실기기 부재는 관측된 바 없다(failureModes 다이얼 3종 확장 — getIsTossLoginIntegratedService·requestNotificationAgreement·getPermission(이름별) #783 "측정 밖 확장 금지" 원칙).Part B 전체를 구현했고 deferred 항목 없음.
테스트 갱신
기존 단위 테스트 중 이 6개 API를 동기로 단정하던 것(
navigation.test.ts,fidelity-qa.test.ts)과,fetchContacts.getPermission()이 resolved를 반환한다고 단정하던 것(contacts.test.ts)은 실기기 실측에 맞춰 갱신했다 — 그 테스트들이 재현하던 동작이 비충실했다.검증
Playwright e2e는 이 PR의 범위(mock 로직 변경, UI 변경 아님)라 실행하지 않았다.
다운스트림 검증 (별도 라운드)
sdk-example이 이 devtools를 물린 뒤
pnpm diff:captures에서 위 8건 mismatch 소멸 확인은 별도 PR/라운드에서 진행한다(SDK-surface 61→69/70 예상, 잔여 1건은 GPS 하드웨어 transient로 범위 밖).Changeset
.changeset/env3-runtime-fidelity-795.md—@ait-co/devtoolspatch.커뮤니티 오픈소스 프로젝트입니다.