Skip to content

Refuse weather coordinates off the globe - #18553

Merged
omarchybot merged 1 commit into
quattrofrom
weather-coords-on-globe
Nov 16, 2026
Merged

omarchybot merged 1 commit into
quattrofrom
weather-coords-on-globe

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

omarchy-weather-location --set <name> 91,181 stored coordinates that are not on the globe and exited 0, replacing the saved location. --set only checked that the pair looked like two numbers, and the panel's reader of weather.json (parseLocationFile) only checked that each value parsed, so the pair went to Open-Meteo, which answers HTTP 400 ("Latitude must be in range of -90 to 90°"). With coordinates set, only an Open-Meteo answer gives the bar its label, so the weather icon never appears and the panel stays on "Fetching forecast…". The same happens for a weather.json written by hand.

  • --set now refuses a latitude outside -90 to 90 or a longitude outside -180 to 180 with Invalid coordinates: 91,181 (latitude -90 to 90, longitude -180 to 180), exits 1 and leaves weather.json as it was. The edges, 90,180 and -90,-180, are still accepted. The check runs inside the jq call that already builds the file, since bash has no floats, and the file is written only when jq produced something: the script has no set -e, so a jq that printed nothing used to overwrite the location with an empty file.
  • parseLocationFile drops an off-globe pair and keeps the name, as it already does for a pair that does not parse. A file saved before this change, or written by hand, then gets the weather by the place's name.

#16406 (live radar) range-checks the coordinates it sends to its radar view only; with this change that check becomes a second guard. #13113, #17454, #17452, #17443, #8278, #8277 and #16615 edit the same --set or hasCoordinates lines, so whichever lands second carries the range check along.

Found by Prime's QA run.

🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Codex Medium and Muse Wonder High via Pi.

--set checked only the shape of the pair, so 91,181 was stored and the panel asked Open-Meteo for a place that cannot exist, which never answers and leaves the bar without its weather icon. The range check runs inside the jq call that builds the file, since bash has no floats, and the file is written only when jq produced something. The panel's reader drops an off-globe pair and keeps the name, which also repairs a file saved before this change or written by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Muse Wonder High via Pi <noreply@meta.com>
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

This PR rejects weather coordinates outside the globe and preserves the saved location when JSON generation fails.

  • Weather location saves reject coordinates outside the globe.
  • The weather panel uses place names when saved coordinates fall outside the globe.

Reviews (1) · Last reviewed commit: "Refuse weather coordinates off the globe" · Reviewed by Greptile

@omarchybot
omarchybot merged commit b52dd3a into quattro Nov 16, 2026
3 checks passed
@omarchybot
omarchybot deleted the weather-coords-on-globe branch November 16, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants