Skip to content

Validate component IDs when creating component pools#1340

Merged
llucax merged 5 commits intofrequenz-floss:v1.x.xfrom
shsms:pool-input-validation
Jan 29, 2026
Merged

Validate component IDs when creating component pools#1340
llucax merged 5 commits intofrequenz-floss:v1.x.xfrom
shsms:pool-input-validation

Conversation

@shsms
Copy link
Contributor

@shsms shsms commented Jan 5, 2026

No description provided.

@shsms shsms requested a review from a team as a code owner January 5, 2026 12:47
@shsms shsms requested review from ela-kotulska-frequenz and removed request for a team January 5, 2026 12:47
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:data-pipeline Affects the data pipeline labels Jan 5, 2026
@llucax llucax added this to the v1.0.0-rc2300 milestone Jan 5, 2026
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

Assigning to rc2300 because this is a breaking change. Also I think we need to mention it in the upgrading section of the release notes.

Comment on lines +93 to +94
if not self._batteries.issubset(all_batteries):
unknown_ids = self._batteries - all_batteries
Copy link
Contributor

Choose a reason for hiding this comment

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

You could save a line of code and a couple cycles by reversing this:

Suggested change
if not self._batteries.issubset(all_batteries):
unknown_ids = self._batteries - all_batteries
if unknown_ids := self._batteries - all_batteries:

(same for the rest)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that doesn't look like a subset check.

- `FormulaEngine` and `FormulaEngine3Phase` are now type aliases to `Formula` and `Formula3Phase`, fixing a typing issue introduced in `v1.0.0-rc2202`.
<!-- Here goes a general summary of what this release is about -->

## Upgrading
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also add a note here, as this is effectively a breaking change. Users will need to update their code to deal with the exception, or validate the IDs before passing them to new_xxx_pool().

@llucax llucax added the scope:breaking-change Breaking change, users will need to update their code label Jan 5, 2026
@shsms
Copy link
Contributor Author

shsms commented Jan 5, 2026

It is of course not a breaking change, because it was broken much worse earlier when they sent non-battery to battery pool. This is a more predictable meaningful error. Just a bug fix.

@llucax
Copy link
Contributor

llucax commented Jan 14, 2026

It is a breaking change in the sense that raising a new exception is an interface change, but I see your point that passing the wrong ID would also make the user code explode, only in a different and worse way, so OK. Rolling-back the breaking change label and milestone.

@llucax llucax modified the milestones: v1.0.0-rc2300, v1.0.0-rc2204 Jan 14, 2026
@llucax llucax removed the scope:breaking-change Breaking change, users will need to update their code label Jan 14, 2026
llucax
llucax previously approved these changes Jan 14, 2026
@github-project-automation github-project-automation bot moved this from To do to Review approved in Python SDK Roadmap Jan 14, 2026
@llucax
Copy link
Contributor

llucax commented Jan 14, 2026

Added a commit to add the missing Raises section to the docstrings of methods now raising a ValueError.

Needs approval from someone else now. Enabling auto-merge too, as Sahas will be away for a few weeks.

@llucax llucax enabled auto-merge January 14, 2026 11:06
@llucax llucax self-assigned this Jan 14, 2026
@llucax
Copy link
Contributor

llucax commented Jan 14, 2026

Tests still failing for the same reasons as #1343, see comments in that PR for details.

@llucax llucax force-pushed the pool-input-validation branch from 26b8436 to 1c3574d Compare January 14, 2026 12:04
Marenz
Marenz previously approved these changes Jan 14, 2026
shsms added 3 commits January 26, 2026 15:35
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
shsms and others added 2 commits January 26, 2026 15:36
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax
Copy link
Contributor

llucax commented Jan 26, 2026

Rebased to get the CI fix, and needed to merge some conflicts for that, so it needs a new approval.

@llucax llucax added this pull request to the merge queue Jan 29, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit 3a9dfee Jan 29, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Review approved to Done in Python SDK Roadmap Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:data-pipeline Affects the data pipeline part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

Development

Successfully merging this pull request may close these issues.

4 participants