Remove/deprecate remainain instances of _with_issues functions - #272
Merged
Conversation
The electrical component connection converters are new in this development cycle (the `_electrical_component_connection.py` module did not exist in v0.4.0), so the `_with_issues` flavor was never released and can be removed outright rather than deprecated. Its only diagnostic — a "self-referencing connection" major issue — is already encoded in the return type: a connection whose source and destination match is returned as a `SelfReferencingElectricalComponentConnection`. Routing the same fact through a side-channel `major_issues`/`minor_issues` string list (and the wrapper's warning/debug logging built from it) was therefore redundant. Fold the conversion directly into `electrical_component_connection_from_proto`, which now reports malformed input purely via the returned type, and drop the issue arrays, the logging and the now-unused `logging` import. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `ElectricalComponent` message-level converters are new in this
development cycle (v0.4.0 shipped only the enum converters in this module),
so the `_with_issues` flavor was never released and can be removed outright
rather than deprecated.
Every diagnostic it collected is already encoded in the returned type:
* an unspecified category -> `UnspecifiedElectricalComponent`
* an unrecognized category -> `UnrecognizedElectricalComponent`
* a category that disagrees with its carried info ->
`MismatchedCategoryElectricalComponent`
* an unspecified/unrecognized battery, EV charger or inverter type ->
the matching `Unrecognized*` class (preserving the raw wire `type`)
Routing the same facts through a side-channel `major_issues`/`minor_issues`
string list (and the wrapper's warning/debug logging built from it) was
therefore redundant.
Fold the conversion into the plain `electrical_component_from_proto`, which
now reports malformed input purely via the returned type, and simplify the
private helper to `_electrical_component_base_from_proto` (no issue
arguments). The now-unused `logging` import and module logger go with them.
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `MetricSample` and `MetricConnection` converters only shipped in the `_with_issues` flavor, which reports an unspecified/unrecognized metric or category through a side-channel `major_issues`/`minor_issues` string list. That information is already carried by the returned type, though: `MetricSample.metric` and `MetricConnection.category` are `... | int` (the raw `0` for unspecified, the raw value for unrecognized) and bounds are a `BoundsSet | InvalidBoundsSet`, so the issue list is redundant. Add plain `metric_sample_from_proto` and `metric_connection_from_proto` converters that drop the issue arrays and let callers read validity off the returned object (or the raising `get_*()` accessors). `RELEASE_NOTES.md` already referred to `metric_sample_from_proto` as the dataclass-level converter; this makes it real. The released `_with_issues` variants are intentionally left untouched here; they are deprecated in a follow-up commit. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
`metric_sample_from_proto_with_issues` and `metric_connection_from_proto_with_issues` were released in v0.4.0, so they are deprecated rather than removed, in favour of the type-system `metric_sample_from_proto` / `metric_connection_from_proto` added in the previous commit. Add the `@deprecated` decorator and a `Warning: Deprecated` docstring admonition to both, matching the existing `bounds_from_proto_with_issues` deprecation. `metric_sample_from_proto_with_issues` still delegates to the now-deprecated `metric_connection_from_proto_with_issues` to preserve its released issue-collecting behaviour, so wrap that internal call in a `warnings.catch_warnings()` block: calling the sample converter then emits only its own `DeprecationWarning`, not the connection one as well. Update the existing tests to expect the deprecation via `pytest.deprecated_call`; the raw-int-0 / no-enum-warning guarantees now live on the new converters' tests. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
llucax
requested review from
florian-wagner-frequenz
and removed request for
a team
August 19, 2026 12:18
llucax
enabled auto-merge
August 19, 2026 13:21
Marenz
approved these changes
Aug 20, 2026
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.
This PR deprecates and removes all the remaining instances of
_with_issues()functions, that should now have an anternative that reports issues via the type system. This should finalize #239 for the v0.4.1 release.