Skip to content

♻️ Replace Mashumaro with Probatio#658

Open
frenck wants to merge 1 commit into
mainfrom
frenck/replace-mashumaro-with-probatio
Open

♻️ Replace Mashumaro with Probatio#658
frenck wants to merge 1 commit into
mainfrom
frenck/replace-mashumaro-with-probatio

Conversation

@frenck

@frenck frenck commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Proposed Changes

Replaces Mashumaro with Probatio for turning the Fumis WiRCU API response into the model dataclasses.

The models are now plain frozen dataclasses. FumisInfo.from_dict() validates and constructs the whole tree through Probatio's SchemaMixin with extra=REMOVE_EXTRA, so unmodeled keys (which vary by firmware) are dropped at every level. Field aliases move from Mashumaro's field_options(alias=...) to Key(alias=...), and the old SerializationStrategy classes become inline coercers: Coerce for the string-encoded numbers and versions, FromEpoch for timestamps, AsTimedelta for the seconds counters, and Maybe(Coerce(...)) for the -1-sentinel optionals. Probatio's numeric tower means plain float fields accept the integer values the device sends, so those fields carry no coercer at all.

Probatio validates but does not serialize, so fumis info --json now serializes the model with orjson directly. The output is model shaped (snake_case keys, ISO timestamps, null fields present) rather than the old aliased wire shape; the dump command still emits the raw API payload untouched. The snapshot is updated to match.

This also folds in the error handling cleanup that was in progress: StoveError.from_code() and StoveAlert.from_code() now return a non-optional enum with explicit NO_ERROR / NO_ALERT members instead of None.

Probatio requires Python 3.12, so this drops Python 3.11 (from requires-python, the classifiers, and the CI matrix). Home Assistant is well past 3.11, so this should not hurt in practice.

Related Issues

(Github link to related issues or pull requests)

Copilot AI review requested due to automatic review settings July 7, 2026 19:33
@frenck frenck added dependencies Upgrade or downgrade of project dependencies. breaking-change A breaking change for existing users. labels Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 migrates the Fumis WiRCU API model layer from Mashumaro-based (de)serialization to Probatio-based validation/construction, and updates the CLI/tests to reflect the new model parsing and JSON output shape. It also standardizes “no error/alert” handling by introducing explicit enum members and bumps the minimum supported Python version to 3.12 to satisfy Probatio.

Changes:

  • Replace Mashumaro strategies/aliases with Probatio schemas/coercers and make models plain frozen dataclasses, with FumisInfo.from_dict() driving validation.
  • Change “no error/alert” from None to explicit StoveError.NO_ERROR / StoveAlert.NO_ALERT, updating CLI and tests accordingly.
  • Update CLI --json output and snapshots, and drop Python 3.11 across packaging metadata and CI matrices.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/fumis/models.py Reworks model parsing/validation to Probatio (coercers, aliases, extra-key dropping) and removes Mashumaro strategies.
src/fumis/const.py Adds NO_ERROR/NO_ALERT members and makes from_code() return non-optional enums.
src/fumis/cli/__init__.py Updates info --json emission and adapts error/alert display logic to the new sentinel enums.
src/fumis/cli/tui.py Updates TUI rendering logic to treat NO_ERROR/NO_ALERT as the “empty” state.
tests/test_fumis.py Updates unit tests to expect explicit NO_ERROR/NO_ALERT instead of None.
tests/cli/__snapshots__/test_cli.ambr Refreshes CLI output snapshots to match new JSON/model shape and formatting.
pyproject.toml Replaces Mashumaro dependency with Probatio, bumps requires-python to 3.12, and updates typing tool config.
poetry.lock Updates lockfile for dependency changes (adds Probatio, removes Mashumaro) and Poetry generator version.
.github/workflows/tests.yaml Drops Python 3.11 from the test matrix and updates default Python to 3.12.
.github/workflows/typing.yaml Updates default Python to 3.12.
.github/workflows/linting.yaml Updates default Python to 3.12.
.github/workflows/release.yaml Updates default Python to 3.12.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Parse the Fumis WiRCU API into the model dataclasses with Probatio
instead of Mashumaro. Models become plain frozen dataclasses that
validate and construct through Probatio's SchemaMixin, dropping
unmodeled keys, with field aliases on Key() and coercions on inline
Coerce/FromEpoch/AsTimedelta/Maybe hints. Serialization for the
`info --json` command moves to orjson, since Probatio validates but
does not serialize.

Also resolves error and alert codes to non-optional enums with explicit
NO_ERROR/NO_ALERT members instead of None.

Probatio requires Python 3.12, so 3.11 is dropped.
@frenck frenck force-pushed the frenck/replace-mashumaro-with-probatio branch from 45da224 to ceffaff Compare July 7, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A breaking change for existing users. dependencies Upgrade or downgrade of project dependencies.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants