Repository navigation
fix: decide a task again where the OS has no URLProtocol.task getter - #9
Merged
Merged
Conversation
On iOS 16.4 the first mocked request ended the app with SIGABRT: -[MapLocalURLProtocol task]: unrecognized selector, from startLoading. The SDK declares URLProtocol.task from iOS 8, so it compiles, but the getter is missing at run time there (17.5 has it; nothing in between was measured). The protocol now asks the running OS once whether instances answer the getter. Where they do, a task still answers with the decision canInit made. Where they don't, startLoading decides the request again (the engine's decision is a pure function of the request and configuration), and canInit keeps no decision that nothing would take back. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016HvfREejSbdqHNbZ87WYdW
6 tasks done
3 of 4 tasks
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.
Summary
A consuming app on iOS 16.4 (simulator, iPhone 14 Pro, built from
feature/ios-16-supportat 340dd4c) crashed on its first mocked request:startLoadingreadsself.taskto take back the decisioncanInit(with task:)made. The SDK declaresURLProtocol.taskfrom iOS 8, so this compiles, but on 16.4 the getter is missing at run time. 17.5 and later have it. Nothing between 16.4 and 17.5 was measured, somain, which supports iOS 17.0, may be affected too. That's why the fix goes tomainand reachesfeature/ios-16-supportby the usual merge.MapLocalURLProtocol.readsTaskasks the running OS once:instancesRespond(to: #selector(getter: URLProtocol.task)). It isn't a#availableboundary, because nobody knows the version where the getter appears.startLoadingdecides the request again withengine.decide(request). That fallback already existed for protocols created from a request.canInit(with task:)keeps no decision there, since nothing would take it back.Cost where the getter is missing: a configuration change between
canInitandstartLoadingchanges the answer for that one task. That is the behaviour a request created without a task already had.Changelog
The 0.2.0 section gets a line in #8 once this is merged, so this PR doesn't touch the changelog that #8 restructures.
Agent interface
No change. No operation, input, output, error or
maplocal.statefield changes. On an OS without the getter, the request log (maplocal.requests.*) still records each mocked request once.Test Plan
readsTaskfalse, a task whose rule switches its response betweencanInitandstartLoadinganswers with the new one (500), not the stored one. Before the fix: 200.readsTaskfalse,canInitkeeps no decision for the task. Before the fix: one was kept.script/ciexit 0: Swift 89 + 131 → 91 + 131, vitest 1143 unchanged.feature/ios-16-supportonce this is merged in.