fix: handle unknown weather codes#1796
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR improves weather applet error handling by adding a safe fallback icon lookup and centralizing wttr.in request/validation logic with graceful failure handling, documents this fix in the changelog, and adds a Hyprland window rule to float Ghidra's "NO ACTIVE PROJECT" dialog. ChangesWeather Applet Resilience
Hyprland Window Rule
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Configs/.local/lib/hyde/weather.py`:
- Around line 328-330: The compact one-line try/except in get_weather_data is
triggering Ruff E701/E702, so expand it into standard բազմ-line Python syntax
with the try block, request/json parsing, and separate except clause returning
None. Also check the other flagged one-liner in this module (the same lint issue
at the referenced locations) and rewrite it in multiline form so CI linting
passes.
- Around line 328-330: The weather fetch path still allows invalid wttr.in error
payloads to reach downstream indexing. Update get_weather_data() to capture
non-2xx responses before parsing JSON by calling raise_for_status() on the
response and handling HTTPError alongside the existing request/JSON exceptions,
and make main() defensive when reading weather["current_condition"][0] by
checking that the key exists and has at least one entry before indexing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b4dcffd-452a-4fbe-828a-ab96bf2e7057
📒 Files selected for processing (2)
CHANGELOG.mdConfigs/.local/lib/hyde/weather.py
1e77738 to
39a73a1
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
Configs/.config/hyde/wallbash/scripts/wayle-theme.sh (1)
8-21: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winOnly
dcol_pry1is guarded; the other 9dcol_*vars used below are not.Line 8 exits early if
dcol_pry1is empty, butdcol_pry2,dcol_pry3,dcol_txt1,dcol_3xa6,dcol_1xa7,dcol_1xa8,dcol_1xa6,dcol_2xa7, anddcol_3xa7are used unguarded (flagged by shellcheck SC2154 as referenced-but-not-assigned). If any of these are unset for a given wallpaper/theme,wayle config set ... "#"would silently write an invalid/empty color since stderr is discarded with2>/dev/null.♻️ Suggested guard + shellcheck annotations
+# shellcheck disable=SC2154 # dcol_* vars are exported by color.set.sh via `set -a; source "$dcol_file"` command -v wayle >/dev/null 2>&1 || exit 0 pgrep -x wayle >/dev/null 2>&1 || exit 0 -[[ -z "$dcol_pry1" ]] && exit 0 +for v in dcol_pry1 dcol_pry2 dcol_pry3 dcol_txt1 dcol_3xa6 dcol_1xa7 dcol_1xa8 dcol_1xa6 dcol_2xa7 dcol_3xa7; do + [[ -z "${!v}" ]] && exit 0 +done🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Configs/.config/hyde/wallbash/scripts/wayle-theme.sh` around lines 8 - 21, The wayle theme update in wayle-theme.sh only checks dcol_pry1, but the other dcol_* variables used by the palette writes can still be unset and produce invalid empty colors. Update the guard logic around the wayle config set calls so all referenced palette inputs in this block are validated before use, or skip each assignment when its source variable is empty, and add the appropriate shellcheck handling near this section if these values are intentionally provided by the sourcing context.Source: Linters/SAST tools
Configs/.config/hypr/windowrules.conf (1)
95-95: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueAnchor the title regex for consistency.
Unlike the sibling rule on Line 94 (
^(Image Editor)$), this pattern omits the trailing$, so it would also match titles with extra trailing text.🩹 Suggested fix
-windowrule = float true, match:initial_title ^(Ghidra: NO ACTIVE PROJECT) `#Ghidra` Project manager +windowrule = float true, match:initial_title ^(Ghidra: NO ACTIVE PROJECT)$ `#Ghidra` Project manager🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Configs/.config/hypr/windowrules.conf` at line 95, The windowrule for the Ghidra project manager uses an inconsistent title regex in the hypr window rules config: the pattern in the float rule matches extra trailing text because it is not fully anchored. Update the `windowrule = float true, match:initial_title ...` entry to use a fully anchored regex like the sibling rule, keeping the `initial_title` match and adding the missing end anchor so only the exact window title is matched.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Configs/.config/hyde/wallbash/scripts/wayle-theme.sh`:
- Around line 8-21: The wayle theme update in wayle-theme.sh only checks
dcol_pry1, but the other dcol_* variables used by the palette writes can still
be unset and produce invalid empty colors. Update the guard logic around the
wayle config set calls so all referenced palette inputs in this block are
validated before use, or skip each assignment when its source variable is empty,
and add the appropriate shellcheck handling near this section if these values
are intentionally provided by the sourcing context.
In `@Configs/.config/hypr/windowrules.conf`:
- Line 95: The windowrule for the Ghidra project manager uses an inconsistent
title regex in the hypr window rules config: the pattern in the float rule
matches extra trailing text because it is not fully anchored. Update the
`windowrule = float true, match:initial_title ...` entry to use a fully anchored
regex like the sibling rule, keeping the `initial_title` match and adding the
missing end anchor so only the exact window title is matched.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 63b895a6-96e9-4714-b58b-c648535857c0
📒 Files selected for processing (17)
CHANGELOG.mdCONTRIBUTORS.mdConfigs/.config/hyde/wallbash/always/wayle.dcolConfigs/.config/hyde/wallbash/scripts/wayle-theme.shConfigs/.config/hypr/windowrules.confConfigs/.local/bin/hyde-shellConfigs/.local/lib/hyde/globalcontrol.shConfigs/.local/lib/hyde/pm/zypper.pyConfigs/.local/lib/hyde/session.pyConfigs/.local/lib/hyde/volumecontrol.shConfigs/.local/lib/hyde/wallpaper.shConfigs/.local/lib/hyde/weather.pyConfigs/.local/share/hypr/startup.confConfigs/.local/share/wallbash/theme/waybar.dcolScripts/pkg_extra.lstSource/docs/README.zh.mdWiki
💤 Files with no reviewable changes (1)
- Wiki
✅ Files skipped from review due to trivial changes (4)
- CONTRIBUTORS.md
- Configs/.local/lib/hyde/volumecontrol.sh
- CHANGELOG.md
- Configs/.local/lib/hyde/pm/zypper.py
39a73a1 to
39ead6a
Compare
* made ghidra project manager to float * Change Ghidra window rule to float true --------- Co-authored-by: Khing <53417443+kRHYME7@users.noreply.github.com>
- Add wayle to session.py known bars for clean session management - Add wallbash hook (wayle.dcol) to sync wallpaper colors with wayle - Make waybar.dcol conditional: skip waybar update when not running
Uses dcol_* environment variables passed by wallbash's fn_wallbash to set wayle palette colors on every wallpaper/theme change. Files placed in .config/hyde/wallbash/ (non-core component).
39ead6a to
0857990
Compare
Pull Request
Description
Fixes weather applet crashes when wttr.in returns an unmapped weather code or when the wttr.in request/JSON response is unavailable.
The crash observed locally was:
This PR maps code
149to the existing cloudy/foggy icon group, falls back to a generic cloudy icon for future unknown codes, and returns a valid Waybar JSON error object when weather data cannot be fetched or parsed.Type of change
Checklist
Screenshots
Not applicable.
Summary by CodeRabbit
Bug Fixes
Documentation