Repository navigation
fix(open-meteo-app): guard malformed forecast payloads - #14333
Conversation
Forecast parsing assumed every documented container was present and correctly\ntyped: payload, current, current_units, daily and daily_units were used as\ndicts, daily series as lists, and each series item as a number. An upstream\nshape change or a null series raised an unhandled error instead of the\nN/A / no-data path the formatters already implement.
Drives the real request/parse path with a fake httpx client serving non-dict containers, null series, non-numeric entries and an undecodable body, so the new guards are pinned rather than merely present.
Returning the original int/float instead of a coerced float keeps the existing rendering byte-identical for integer-sourced values, and the widened helper signatures match what the guards actually accept.
|
Verified against main and ran the suite myself ( plugins/omi-open-meteo-app/main.py
plugins/omi-open-meteo-app/test_main.py
Notes, non-blocking:
Clean, cohesive hardening that finishes what #13923 started. Leaving the workflow approval and merge call to the maintainers. AI-generated maintainer feedback posted on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Open-meteo malformed-payload fix: root cause + tests but diff is 413 lines, exceeds 300-line scope gate = 3/5. Approve only.
Forecast parsing assumed every documented container was present and correctly typed:
payload,current,current_units,dailyanddaily_unitswere used as dicts, the daily series as lists, and each series item as a number. An upstream shape change, a null series, or a non-numeric entry raised an unhandled error instead of theN/A/ no-data path the formatters already implement.Normalize at the parse boundary with
_as_dict,_as_listand_numeric_item, so the rendering code stays unchanged and well-formed responses render exactly as before.Verification:
python3 -m pytest plugins/omi-open-meteo-app/ -q-> 24 passed.Failure-Class: none