[patch] [engg]: Remove obsolete availability checks - #1919
Conversation
Remove runtime OS gates and fallback branches made unreachable by the iOS 16 and macOS 12 deployment floors while retaining newer-version and SDK guards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d4af6210-550f-424a-86c5-e8619d0b0178
There was a problem hiding this comment.
Pull request overview
Removes runtime OS availability branches that are now unreachable due to the project’s updated deployment floors (iOS 16+, macOS 12+), simplifying SSO/UI behavior and macOS utility code while keeping compile-time SDK guards intact.
Changes:
- Eliminates redundant
@available(...)runtime checks in SSO request/delegate and macOS utility paths. - Simplifies UI automation helpers by removing pre–iOS 13 fallback behaviors.
- Updates integration test execution path and records the cleanup in the changelog.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| IdentityCore/tests/integration/MSIDSSOExtensionRequestDelegateTests.m | Runs the interaction-required error mapping test unconditionally on supported SDKs (still behind MAX_ALLOWED guards). |
| IdentityCore/tests/automation/ui_tests_lib/XCUIElement+CrossPlat.m | Removes legacy iOS version branching in text selection helper; marks unused app parameter. |
| IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m | Removes pre–iOS 13 keyboard-tap loop; marks unused app parameter. |
| IdentityCore/src/util/mac/MSIDXpcProviderCache.m | Removes macOS 12 availability gating around XPC provider existence check; simplifies control flow. |
| IdentityCore/src/util/ASAuthorizationSingleSignOnProvider+MSIDExtensions.m | Sets userInterfaceEnabled directly under compile-time guards (no runtime availability check). |
| IdentityCore/src/requests/broker/MSIDSSOExtensionRequestDelegate.m | Maps ASAuthorizationErrorNotInteractive directly under compile-time guards (no runtime availability check). |
| IdentityCore/src/MSIDDeviceId.m | Uses the macOS 12+ kIOMainPortDefault path directly for serial-number retrieval. |
| changelog.txt | Adds an entry documenting removal of redundant runtime availability checks. |
Use the documented Xcode 16.2 baseline to remove compile-time SDK checks that are guaranteed true, while retaining runtime availability, platform, and future-SDK guards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d4af6210-550f-424a-86c5-e8619d0b0178
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
IdentityCore/src/util/mac/MSIDXpcProviderCache.m:207
- Local variable name
folderConstratsappears to be a typo ("Constrats" vs "Constraints"), which makes the intent of the substring check harder to read. Since this is a local variable, it can be safely renamed for clarity.
#if DEBUG
NSString *folderConstrats = @"DerivedData";
#else
NSString *folderConstrats = @"Applications";
#endif
|
This change hinges on every build using an SDK new enough that these symbols are declared, since removing the Do we pin the toolchain everywhere this is consumed — CI templates and any downstream MSAL/broker builds — so nobody can build this on an older Xcode? If the 16.2 floor is real and enforced, this is fine and the description just needs to match (the comment on the |
|
Good catch on the description — it was overstating the baseline, and I have rewritten that section. Short answer: the floor is real and enforced, but it is not Xcode 16.2, and this PR is not what establishes it. Per-symbol requirements. Checking each symbol you named against the SDK headers:
So the highest requirement introduced is the macOS 14.0 SDK (Xcode 15.0), not 16.2/15.2. One correction on The floor already exists on
Anyone on an SDK older than macOS 14.4 / iOS 17.4 already fails to compile Pinning. Every build path pins at or above that:
Caveat worth flagging: that shared ACES template lives in On the two bot nits: the |
Perform the tap in the single-argument method so it no longer allocates an XCUIApplication solely to pass into an overload that ignores it. The app: overload is retained as a thin wrapper because it is public API of this shared test library and MSAL automation still calls it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d4af6210-550f-424a-86c5-e8619d0b0178
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Suppressed comments (2)
IdentityCore/src/util/NSURL+MSIDExtensions.m:136
- The availability check only gates macOS 13+, but the comment and behavior change also apply to iOS 16+. As written, the host-validation block may be skipped on iOS builds. Consider using a multi-platform availability check so the validation runs on both iOS 16+ and macOS 13+.
if (@available(macOS 13.0, *))
IdentityCore/src/util/mac/MSIDXpcProviderCache.m:207
- Typo in the local variable name (
folderConstrats) makes the code harder to read/grep and looks accidental. Rename it tofolderConstraints(and update the single use) to avoid propagating the misspelling.
#if DEBUG
NSString *folderConstrats = @"DerivedData";
#else
NSString *folderConstrats = @"Applications";
#endif
|
Copilot resolve the merge conflicts in this pull request |
Co-authored-by: josephpab <175344915+josephpab@users.noreply.github.com>
Head branch was pushed to by a user without write access
Done in bb0b3c6 — merged
No semantic conflicts — the 11 source/test files in this PR are disjoint from the files |
Drop the overstated Xcode 16.2 reference from the changelog entry. The highest SDK any removal in this PR requires is macOS 14.0 (Xcode 15.0), and dev already had an effective Xcode 15.3 floor, so the shipping note now cites the deployment targets and supported toolchains without a version figure that would go stale. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d4af6210-550f-424a-86c5-e8619d0b0178
PR Checklist (must be completed before review)
PR Title Format
Required Format:
[Keyword1] [Keyword2]: Descriptionmajor,minor, orpatch(case-insensitive)feature,bugfix,engg, ortests(case-insensitive)Examples:
[MAJOR] [Feature]: new API[minor] [bugfix]: fix crash[PATCH][tests]:add coverageProposed changes
Remove first-party runtime OS checks and compile-time SDK-version guards that are dead under CommonCore's supported deployment targets and build toolchains:
ASAuthorizationErrorNotInteractivedirectly.*_VERSION_MAX_ALLOWEDwrappers, keeping every runtime@availablegate so behavior on macOS 12 and other supported OS versions is unchanged.Changed areas:
MSIDDeviceId,MSIDXpcProviderCache, SSO extension request/provider handling,MSIDExternalSSOContext, URL host validation, related unit tests, iOS automation helpers, andchangelog.txt.Type of change
Risk
Additional information
Deployment targets
Current
devsetsIPHONEOS_DEPLOYMENT_TARGET = 16.0andMACOSX_DEPLOYMENT_TARGET = 12.0. Runtime@availablegates are preserved everywhere, so runtime behavior on macOS 12 is unchanged.Compile-time SDK floor
Removing a
*_VERSION_MAX_ALLOWEDwrapper makes the enclosed symbol a compile-time requirement. The SDK each removal actually requires:userInterfaceEnabledASAuthorizationErrorNotInteractiveNSURLComponents.percentEncodedHostASAuthorizationProviderExtensionLoginManagerASAuthorizationProviderExtensionKeyTypeCurrentDeviceSigningThe highest requirement introduced here is the macOS 14.0 SDK (Xcode 15.0). The
percentEncodedHostguard never gated a symbol at all — that API dates to macOS 10.9 / iOS 7, and the guard only wrapped a behavioral difference, so its removal has no SDK implication.This does not establish a new floor, because
devalready requires a higher SDK than any of the above. These are used today with a runtime@availablegate and no*_MAX_ALLOWEDguard:devASWebAuthenticationSession.additionalHeaderFields(MSIDASWebAuthenticationSessionHandler.m)WKWebView.inspectable(MSIDOAuth2EmbeddedWebviewController.m)So the effective floor on
devis already Xcode 15.3, above the Xcode 15.0 maximum this PR requires.Toolchain pinning
Every build path pins an Xcode version at or above that floor:
/Applications/Xcode_16.2.appexplicitly.Pipeline YAMLs/shared/aces-macos-job.yml@pipelinesSharedtemplate, documented in-repo as the source of truth for toolchain setup.select_xcode.sh.Guards intentionally retained
__MAC_OS_X_VERSION_MAX_ALLOWED >= 260000for the macOS 26-onlyisSetupAssistantFlowdeclaration — above every pinned toolchain, so it is a genuine future-SDK guard.#ifdef __MAC_OS_X_VERSION_MAX_ALLOWEDchecks in keychain code. These are platform discriminators (the macro is undefined for iOS/visionOS), not version thresholds, and preserve macOS-only data-protection-keychain attributes.*_VERSION_MAX_ALLOWEDchecks were present. There are no first-party sample paths or nested submodules.Newer runtime checks remain intact, including macOS 13/14 XPC and Platform SSO paths, iOS 16.4/macOS 13.3 web inspection, iOS 17/macOS 14 URL parsing tests, and iOS 18/macOS 15/visionOS 2 web-authentication APIs.
Validation
Completed with local code signing disabled:
xcodebuild test -workspace IdentityCore.xcworkspace -scheme 'IdentityCore iOS' -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,id=F0DB19C7-8299-4AB3-AEB7-027FE3AC41D0' -only-testing:'IdentityCoreTests iOS/MSIDSSOExtensionRequestDelegateTests' -only-testing:'IdentityCoreTests iOS/NSURLExtensionsTests' -parallel-testing-enabled NO CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet— passed on iOS 16.4.xcodebuild test -workspace IdentityCore.xcworkspace -scheme 'IdentityCore Mac' -configuration Debug -destination 'platform=macOS' -only-testing:'IdentityCoreTests Mac/MSIDSSOExtensionRequestDelegateTests' -only-testing:'IdentityCoreTests Mac/NSURLExtensionsTests' -only-testing:'IdentityCoreTests Mac/MSIDDeviceInfoTests' -parallel-testing-enabled NO CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet— passed.xcodebuild build-for-testing -workspace IdentityCore.xcworkspace -scheme 'IdentityCore iOS' -configuration Debug -sdk xrsimulator -destination 'platform=visionOS Simulator,id=33A7323A-038C-41D4-ADBC-19E99C863C17' CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet— passed on visionOS 2.5.xcodebuild build -project IdentityCore/IdentityCore.xcodeproj -target 'IdentityAutomationTestLib iOS' -configuration Debug -sdk iphonesimulator CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet— passed.xcodebuild build -project IdentityCore/IdentityCore.xcodeproj -target 'IdentityAutomationTestLib Mac' -configuration Debug CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet— passed.CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO ./build.py --targets mac_library --no-xcpretty --no-clean— full macOS build and test suite passed.[Common Core] PR Validation(iOS + macOS) and[MSAL] Common core submodule check v2(iOS + macOS) passed.