diff options
Diffstat (limited to 'scripts/.claude/ct-fix-weather-fallback.yaml')
| -rw-r--r-- | scripts/.claude/ct-fix-weather-fallback.yaml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/.claude/ct-fix-weather-fallback.yaml b/scripts/.claude/ct-fix-weather-fallback.yaml new file mode 100644 index 0000000..97823c7 --- /dev/null +++ b/scripts/.claude/ct-fix-weather-fallback.yaml @@ -0,0 +1,64 @@ +name: "Fix WeatherActivity silent fallback to San Francisco" +description: "WeatherActivity silently uses lat=37.8, lon=-122.4 (San Francisco Bay) when GPS is unavailable, showing real API weather data for the wrong location with no indication to the user." +agent: + model: "sonnet" + working_dir: "/workspace/nav" + instructions: | + Context + ------- + WeatherActivity has: + (android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt, lines ~23-24) + + private val defaultLat = 37.8 + private val defaultLon = -122.4 + + When GPS permission is denied or location unavailable, loadWeatherAtDefault() calls + viewModel.loadWeather(defaultLat, defaultLon) and displays the result as if it were + the user's actual location weather — with no disclaimer or error state shown. + + Goal + ---- + Instead of silently fetching weather for San Francisco, show an explicit error/unavailable + state when the device location cannot be obtained. Do not fetch any weather data in that path. + + Remove defaultLat/defaultLon and loadWeatherAtDefault() entirely. + When location is unavailable, set UiState.Error("Location unavailable") so the existing + error UI in the layout is shown instead. + + Step 1 — Read the current WeatherActivity + ----------------------------------------- + Read android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt in full + to understand the current permission and location flow before making changes. + + Step 2 — Remove the fallback + ---------------------------- + - Delete the defaultLat and defaultLon fields + - Delete the loadWeatherAtDefault() method (or equivalent fallback call) + - Where loadWeatherAtDefault() was called (on permission denied or location null), + replace with: + viewModel.setError("Location unavailable — enable GPS to load weather") + OR if MainViewModel does not have setError(), use: + // Just leave UiState.Loading — do not fetch for a fake position + + The simplest correct fix: do nothing when location is unavailable. + The existing "Loading" spinner is less harmful than wrong-location data. + + Step 3 — Build + -------------- + cd android-app && ANDROID_HOME=/opt/android-sdk ./gradlew assembleDebug 2>&1 | tail -5 + Confirm BUILD SUCCESSFUL. + + Step 4 — Commit and push + ------------------------ + git add android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt + git commit -m "fix(weather): remove silent fallback to San Francisco coordinates + + When GPS was unavailable, WeatherActivity fetched and displayed real weather + data for lat=37.8 lon=-122.4 (San Francisco Bay) with no indication to the + user. Remove the fallback; leave the loading state when location is unavailable." + git push github main && git push local main +timeout: "15m" +tags: + - "weather" + - "bug" + - "ux" |
