fix(Where): refresh region welcomes on foreground activation - #314
Conversation
Enable the system tab accessory only while live-region status is visible, so idle and welcome states do not reserve an empty bar. Disable welcome lookup in unrelated root fixtures and give large-text calendar snapshots time to reach their final scroll position.
|
|
||
| /// How long to wait for a one-shot fix before giving up and recording no | ||
| /// captured location. Kept short so a manual entry's Save isn't held up. | ||
| #if DEBUG |
There was a problem hiding this comment.
Hmm, I dont like this; can we put this behind a protocol with a no-op in production or something? Or is this a better pattern?
There was a problem hiding this comment.
Posted by an AI agent on kve's behalf.
Addressed in d6ee7fb9. I replaced the optional test overrides with CurrentLocationRequestDriving: the production driver still calls CLLocationManager, and the CoreLocationSource tests use a conforming fake. This keeps the test seam out of the request coordinator without making production a no-op.
| manager = CLLocationManager() | ||
| super.init() | ||
| manager.delegate = self | ||
| manager.desiredAccuracy = kCLLocationAccuracyKilometer |
There was a problem hiding this comment.
Thinking about this more, we may want a desired accuracy of a lower amount for when you're near a border frequently (eg, NY vs NJ).
There was a problem hiding this comment.
Posted by an AI agent on kve's behalf.
Addressed in 171c37bd. The foreground one-shot now requests 100 m accuracy to improve confidence near region borders. The 1 km hard acceptance cap and 10-second timeout are unchanged; Core Location may still return a coarser fix, which the existing confidence gate handles.
There was a problem hiding this comment.
This is getting pretty complicated, worth a TLA proof and/or a real state machine maybe?
There was a problem hiding this comment.
Posted by an AI agent on kve's behalf.
Addressed in 2146baf7. The one-shot coordinator now has a single idle/pending state that owns its waiters and timeout, with a request ID guarding stale timeout completion. I added cancellation, timeout/retry, and synchronous-callback tests. I used the explicit state machine rather than a TLA model for this bounded lifecycle.
CircleCI's Xcode 27.0 image and the local installation now use build 27A266a. The previous beta-build pin rejected the runner before the iOS build started. All 50 snapshot suites and 2,029 iOS unit tests pass on the new build without reference changes.
Keep the native dynamically enabled tab accessory on iOS 26.1 and later. iOS 26.0 continues resolving and presenting welcomes without an acquisition-status accessory. Validated: ./test WhereUITests (501 passed); ./test --snapshots --only WhereUISnapshotTests/MainTabsSnapshotTests/mainTabs() --review (passed); ./swiftformat --lint; git diff --check.
Summary
27A266a, matching the current CircleCI Xcode 27.0 image.Why
The welcome lookup was owned by the Locations tab and keyed to that view's visibility. A retained tab hierarchy could therefore return from a long trip without triggering a new fix, while passive Core Location callbacks could be too stale or uncertain for an immediate region decision.
Review focus
MainTabsowns the state machine and keys resolution to active-scene entry plus the welcome preference, independent of tab selection.Compatibility
No persistence or backup migration is required. Passive Visits and significant-change monitoring remain unchanged, and valid passive fixes above 1 km remain available as historical evidence. Automatic-recording authorization remains a prerequisite for the welcome.
Backlog reconciliation
Moves the foreground-refresh item from
Where/TODOs.mdto Completed issues with the implemented lifecycle and confidence behavior.Testing
./test --no-generate --no-build WhereCoreTests WhereUITests— 1,109 tests passed after the review fixes../test --no-generate --no-build --snapshots --only WhereUISnapshotTests/LocationsViewSnapshotTests— passed../test --snapshots --no-generate --no-build --only 'WhereUISnapshotTests/RootViewSnapshotTests/root()' --only 'WhereUISnapshotTests/MainTabsSnapshotTests/mainTabs()' --review— 20 app-shell configurations passed together on the final no-record run../test --no-generate --only 'WhereCoreTests/CoreLocationSourceTests'— 10 tests passed with the final source../test --snapshots --review— all 50 snapshot tests passed on Xcode27A266awithout reference changes../test --all— 2,029 iOS unit tests passed on Xcode27A266a../test WhereUITests— 501 tests passed after removing the iOS 26.0 fallback../test --snapshots --only 'WhereUISnapshotTests/MainTabsSnapshotTests/mainTabs()' --review— passed after removing the fallback, without reference changes.python3 -m unittest discover -s Tools/Tests -p 'test_*.py'— 64 tests passed.python3 .circleci/Tests/test_test_artifacts.py— 7 tests passed../swiftformat --lint./sf-symbols --lint./xcstrings --lintgit diff --check