Make CoreLocation geolocation resilient to cold starts#10
Merged
Conversation
The helper made a single-shot requestLocation with a 10s budget, so a cold start (right after wake, before wifi positioning is ready) failed and fell back to coarse IP geolocation. That fallback can trip the Tempest station proximity gate and silently disable enrichment, and the result was cached for the whole server lifetime. - wait for a real fix: startUpdatingLocation, 30s budget, treat kCLErrorLocationUnknown as transient, accuracy gate on the fix - cache failures for only 120s (success 1h) so a cold-start miss self-heals once locationd is warm - rebuild the helper when its swift source changes, keyed off a hash
test_binary_exists_returns_path created the binary but no .swift-version marker, so the new version gate fell through to a real swiftc call that fails on the Linux CI runners. Write the marker so the cache-hit short-circuit is exercised as the test name intends.
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.
Work Done
When CoreLocation failed on a cold start (e.g. right after wake-from-sleep, before WiFi positioning is ready), location resolution fell back to coarse IP geolocation. That fallback can land far enough from a configured Tempest station to trip the station proximity gate and silently disable Tempest enrichment — and because the resolved location was cached for the whole server lifetime, a single cold-start miss pinned the entire session to the wrong location.
startUpdatingLocationrather than one-shotrequestLocation, a 30 s budget,kCLErrorLocationUnknowntreated as transient, and an accuracy gate so a stale coarse fix isn't accepted.Testing
ENABLE_CORELOCATION=true~/Library/Application Support/stormscope/StormscopeLocation.appto force a clean buildget_conditionswith no coordinatesdata_sourceto readtempest~/Library/Application Support/stormscope/StormscopeLocation.app/Contents/.swift-versionnow existsget_conditionsagain