Skip to content

Fiy type can be missing on OnStats#962

Merged
edenhaus merged 1 commit into
devfrom
fix-onStats
May 12, 2025
Merged

Fiy type can be missing on OnStats#962
edenhaus merged 1 commit into
devfrom
fix-onStats

Conversation

@edenhaus

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings May 12, 2025 07:06
@edenhaus edenhaus added the pr: bugfix PR, which fixes a bug label May 12, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses the issue of handling cases where the "type" field may be missing on OnStats events. The changes update the stats event creation in the deebot client to use a safe retrieval method and add a corresponding test case.

  • Updated test cases in tests/messages/json/test_stats.py to include a case with a missing "type" field.
  • Modified deebot_client/messages/json/stats.py to use data.get("type") for safe handling of missing keys.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/messages/json/test_stats.py Added a test case expecting a StatsEvent with type=None when missing.
deebot_client/messages/json/stats.py Changed retrieval of the "type" field to use data.get("type") to allow for missing keys.
Comments suppressed due to low confidence (1)

tests/messages/json/test_stats.py:113

  • [nitpick] The key 'mowid' may be ambiguous; if intentional, consider adding a comment to clarify its purpose for maintainability.
{"mowid": "0", "time": 11269, "area": 2889500, "mowedArea": 1005475}

Comment thread deebot_client/messages/json/stats.py
@codecov

codecov Bot commented May 12, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.60%. Comparing base (a2d906c) to head (80adee0).
Report is 2 commits behind head on dev.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #962   +/-   ##
=======================================
  Coverage   93.60%   93.60%           
=======================================
  Files         128      128           
  Lines        4975     4975           
  Branches      324      324           
=======================================
  Hits         4657     4657           
  Misses        258      258           
  Partials       60       60           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq

codspeed-hq Bot commented May 12, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #962 will not alter performance

Comparing fix-onStats (80adee0) with dev (a2d906c)

Summary

✅ 6 untouched benchmarks

@edenhaus edenhaus enabled auto-merge (squash) May 12, 2025 07:36
@edenhaus edenhaus disabled auto-merge May 12, 2025 07:36
@edenhaus edenhaus merged commit 3848806 into dev May 12, 2025
27 checks passed
@edenhaus edenhaus deleted the fix-onStats branch May 12, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: bugfix PR, which fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Error parsing Ecovacs mower stats (KeyError: 'type' in deebot_client)

2 participants