Skip to content

Conversation

@sca075
Copy link
Owner

@sca075 sca075 commented Jan 8, 2026

This pull request:

  • bump the mcvrender to 0.0.7 sca075/mvcrender@v0.0.6...v0.0.7
  • TrimsCropData added floor to the data class.
  • Update Trims method will now catch also the current_floor when set.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added floor parameter support to trim crop data configuration.
  • Chores

    • Version bumped to 0.1.15.
    • Updated mvcrender dependency to 0.0.7.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@79f3d049-9006-400d-9954-2e5dcd250fa9.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…it bump version in pyproject.toml added to __init__.py Trims and Floor Data

Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ses old key trims_data

Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
@sca075 sca075 self-assigned this Jan 8, 2026
@sca075 sca075 added bug Something isn't working enhancement New feature or request labels Jan 8, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

Changes introduce floor-level tracking to the trim data system by adding a floor field to the TrimCropData dataclass, updating serialization methods, threading the floor parameter through construction methods, establishing a default floor value, and bumping the package version with a dependency update.

Changes

Cohort / File(s) Change Summary
Floor support in trim data
SCR/valetudo_map_parser/config/types.py, SCR/valetudo_map_parser/config/utils.py, SCR/valetudo_map_parser/const.py
Added floor: str field to TrimCropData dataclass with default value "floor_0". Updated from_list() to accept optional floor parameter and forward it during construction. Modified to_dict() and from_dict() serialization methods to include floor. Updated update_trims() to pass current floor when creating trims.
Build metadata
pyproject.toml
Bumped package version from 0.1.14 to 0.1.15. Updated mvcrender dependency from ==0.0.6 to ==0.0.7.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A floor field hops into the data so bright,
Trims now know where they belong, left and right!
From types to utils, the changes align,
With consistent patterns, the updates will shine.
Version bumped up—off we go, fine!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title 'Add floor attribute support to TrimCropData' accurately describes the main change: adding a floor field to the TrimCropData dataclass across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
SCR/valetudo_map_parser/config/types.py (1)

83-92: Critical: Add backward compatibility for missing floor field.

The from_dict method directly accesses data["floor"] which will raise a KeyError when deserializing data that was saved before the floor field was added. This breaks backward compatibility with existing stored configurations.

🔧 Proposed fix for backward compatibility
     @staticmethod
     def from_dict(data: dict):
         """Create dataclass from dictionary."""
         return TrimCropData(
-            floor=data["floor"],
+            floor=data.get("floor", "floor_0"),
             trim_left=data["trim_left"],
             trim_up=data["trim_up"],
             trim_right=data["trim_right"],
             trim_down=data["trim_down"],
         )
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2521d9e and 9426afb.

📒 Files selected for processing (4)
  • SCR/valetudo_map_parser/config/types.py
  • SCR/valetudo_map_parser/config/utils.py
  • SCR/valetudo_map_parser/const.py
  • pyproject.toml
🧰 Additional context used
🧬 Code graph analysis (1)
SCR/valetudo_map_parser/config/utils.py (1)
SCR/valetudo_map_parser/config/types.py (3)
  • TrimsData (293-347)
  • from_list (99-107)
  • from_list (328-338)
🔇 Additional comments (7)
pyproject.toml (2)

3-3: LGTM!

Version bump from 0.1.14 to 0.1.15 is appropriate for the floor-tracking feature addition.


21-21: No issues found with mvcrender 0.0.7 dependency.

Verification confirms that mvcrender version 0.0.7 exists on PyPI and has no known security vulnerabilities or advisories.

SCR/valetudo_map_parser/const.py (1)

86-86: LGTM!

Adding the default floor value "floor_0" to the trims_data dictionary ensures new trim configurations include floor-level tracking.

SCR/valetudo_map_parser/config/types.py (3)

66-67: LGTM!

Adding the floor field to track floor-level information in the trim data structure is a sensible enhancement.


73-81: LGTM!

The to_dict method correctly includes the new floor field in the serialized output.


98-107: LGTM!

The from_list method correctly accepts an optional floor parameter with a sensible default value of "floor_0", maintaining backward compatibility for existing callers.

SCR/valetudo_map_parser/config/utils.py (1)

276-280: No action needed—current_floor is always initialized.

The attribute self.shared.current_floor is guaranteed to be a non-None string before update_trims() is called. It is initialized to "floor_0" in the class definition (line 125 of shared.py) and always set to a string value in the from_dict classmethod (lines 316–327), with fallbacks ensuring "floor_0" is used if the device info does not provide a value. Therefore, there is no risk of passing None to TrimsData.from_list().

@sca075 sca075 linked an issue Jan 8, 2026 that may be closed by this pull request
@sca075 sca075 changed the title Optimize Trims options and fixes. Add floor attribute support to TrimCropData'. Jan 8, 2026
@sca075 sca075 merged commit 4969760 into main Jan 8, 2026
3 checks passed
@sca075 sca075 deleted the dev_main branch January 8, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The trims generate the image to be incorrectly cropped.

2 participants