fix: handle list response in get_solar_intensity to prevent bulk-update crash - #269
Open
Deyi-dev wants to merge 1 commit into
Open
fix: handle list response in get_solar_intensity to prevent bulk-update crash#269Deyi-dev wants to merge 1 commit into
Deyi-dev wants to merge 1 commit into
Conversation
…te crash
get_solar_intensity() assumes get_device_solar_data() returns a dict, but
Garmin occasionally returns a list on some dates. The `or {}` guard only
covers falsy values, so a non-empty list passes through to si_all.get(...)
and raises "AttributeError: 'list' object has no attribute 'get'", which
aborts the entire bulk backfill on that one date.
Normalize the response to the DTO list, handling both dict and list shapes
and guarding element access, so the dict path is unchanged, the list path
no longer crashes, and unexpected shapes degrade to "no data for this date"
instead of killing the run.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
get_solar_intensity()assumesget_device_solar_data()returns a dict:On some dates Garmin returns a
listinstead. Theor {}guard only coversNone/empty (falsy) values — a non-empty list is truthy, so it passes straight through tosi_all.get(...)and crashes the whole run:This is fatal during a bulk backfill: one bad date aborts the entire date range. I hit it on
2026-07-08while backfilling a solar-capable device (Fenix 7 Pro Solar) withsolar_intensityinFETCH_SELECTION.Fix
Normalize the response to the DTO list before indexing, handling both the dict and list shapes (and guarding the element access):
The dict path is unchanged; the list path no longer crashes; anything unexpected degrades to "no solar data for this date" instead of aborting the run. Verified by re-running the same 30-day backfill end-to-end with zero errors.