Repository navigation
Keep the experimental Pipe backwards compatible - #611
Merged
Merged
Conversation
llucax
force-pushed
the
top-level-pipe
branch
from
November 16, 2026 12:12
70bc727 to
4227f6d
Compare
This was referenced Nov 16, 2026
Closed
llucax
force-pushed
the
top-level-pipe
branch
2 times, most recently
from
November 20, 2026 09:44
636cbe1 to
8bb767e
Compare
Pipe to frequenz.channels and deprecate the experimental onePipe to frequenz.channels and deprecate the old one
Pipe to frequenz.channels and deprecate the old onePipe backwards compatible
llucax
force-pushed
the
top-level-pipe
branch
2 times, most recently
from
November 20, 2026 10:58
20c375d to
3a2f87f
Compare
llucax
marked this pull request as ready for review
November 20, 2026 10:59
llucax
requested review from
florian-wagner-frequenz
and removed request for
a team
November 20, 2026 10:59
There was a problem hiding this comment.
🟡 Changes recommended
The pipe’s stop logic can swallow caller cancellation and interrupt endpoint cleanup, leaving senders open and downstream consumers waiting indefinitely.
4 open issues
What changed in this PR
This PR promotes Pipe to the public channel API while preserving v1 behavior for existing experimental users. Separate implementations let callers migrate deliberately to the new endpoint-closing behavior, addressing #583.
Changes:
- Export a stable
Pipethat handles endpoint cleanup and continues forwarding after transient send errors. - Restore the experimental implementation’s v1 behavior and deprecate it for removal in v3.0.0.
- Add tests, user-guide documentation, and release notes explaining the migration.
| File | Description |
|---|---|
tests/test_pipe.py |
Test stable forwarding, error handling, and endpoint lifecycle behavior. |
tests/experimental/test_pipe.py |
Test legacy behavior and deprecation warnings. |
src/frequenz/channels/experimental/_pipe.py |
Restore the legacy implementation and add migration guidance. |
src/frequenz/channels/_pipe.py |
Add the stable implementation with documented endpoint ownership. |
src/frequenz/channels/__init__.py |
Export and list the public Pipe utility. |
RELEASE_NOTES.md |
Describe the new API and experimental migration path. |
docs/user-guide/utilities/pipes.md |
Add a user-guide page for the stable Pipe. |
Review effort: Max (adaptive)
llucax
force-pushed
the
top-level-pipe
branch
2 times, most recently
from
November 20, 2026 12:09
52e5b01 to
31bbac1
Compare
`frequenz.channels.experimental.Pipe` leaves its sender and its receiver open when it stops by itself, and a failed send ends its task with an exception nobody reads. PR 565 changed that behavior in place, which would silently change what existing users get, so move it to a new top-level `Pipe` instead. The experimental `Pipe` goes back to its old behavior as a separate, deprecated class in the next commit, so both can be used at the same time. The new `Pipe` is the one PR 565 left in `experimental/_pipe.py`, with a change for `TransientSenderError`. When sending fails with one, for example a `SenderHasNoReceiversError`, the sender and its channel can still be used, so the pipe logs it, drops the message and keeps forwarding. Before, it closed both ends for a send without receivers. `close_pipe_on_send_error` now only applies to the other `SenderError`s. A `SenderHasNoReceiversError` is logged at debug level, as a channel without receivers is common and every message would log; any other `TransientSenderError` is logged as a warning. The docstring says who owns and closes each end, and the class is added to the user guide. The tests are the ones for the experimental `Pipe`, using `BroadcastChannel`, plus new ones for the transient errors. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
PR 565 changed `frequenz.channels.experimental.Pipe` in place, so code that upgrades to v2 would silently get a pipe that closes its ends and drops messages. The previous commit adds that behavior as the top-level `Pipe`, so restore the experimental one to its v1 implementation, as a separate class, and deprecate it. It is removed in v3.0.0. It is not an alias of the new `Pipe`, as the two don't behave the same and an alias would change the behavior of existing code. Keeping the old one also lets code that uses it support both v1 and v2, and switch to the new `Pipe` when it requires v2. The new `Pipe` closes its sender when its receiver stops, and both ends when sending fails, while the old one leaves them open. Users should check how they close their ends before they switch, so the warning says so, and not only which class to use. The notice has a short version, and the docstring body lists the differences, as the deprecations guide asks. The tests check that the old `Pipe` keeps its v1 behavior and warns, and a new one checks that it still stops on a send without receivers, which the new `Pipe` doesn't. The example in the docstring uses `BroadcastChannel` instead of the deprecated `Broadcast`. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
PR 565's entries described the behavior change of `experimental.Pipe` in place. That class keeps its v1 behavior and is deprecated now, so replace them with a single migration entry that lists the differences with the new `Pipe`, as the deprecations guide asks. The new `Pipe` is a new feature, with its closing rules. The entry also says what it does with a `TransientSenderError`. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
llucax
force-pushed
the
top-level-pipe
branch
from
November 20, 2026 17:48
31bbac1 to
b1a1083
Compare
llucax
enabled auto-merge
November 20, 2026 17:50
shsms
approved these changes
Nov 23, 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 adds the new
frequenz.channels.Pipeand restoresfrequenz.channels.experimental.Pipeto its v1 behavior, deprecated and removed in v3.0.0.It has three commits:
Add the new Pipe to frequenz.channels: thePipePR 565 left inexperimental/_pipe.py, moved to the top level, with one change: when a send fails with aTransientSenderError(for now onlySenderHasNoReceiversError), the pipe logs it, drops the message and keeps forwarding, as the sender and its channel can still be used.close_pipe_on_send_erroronly applies to the otherSenderErrors. Its docstring says who owns and closes each end, and it has a page in the user guide.Restore experimental.Pipe and deprecate it: the v1 implementation, as a separate class marked@deprecated, removed in v3.0.0. Its warning and its notice say how the newPipecloses its ends differently, so users check that before they switch. The tests check that it keeps its v1 behavior and warns, and that the new one doesn't warn.Update the release notes for the new Pipe: PR 565's entries described the behavior change of the experimentalPipein place. They are replaced by one migration entry for the deprecation, and an entry for the newPipein New Features.The deprecation warning is:
frequenz.channels.experimental.Pipe is deprecated and will be removed in v3.0.0. Use frequenz.channels.Pipe instead, but check how your code closes its sender and receiver first: the new one closes its sender when its receiver stops, and both ends when sending fails, while this one leaves them open.A dropped message is logged at debug level for a
SenderHasNoReceiversError, since a channel without receivers is common and every message would log, and as a warning for any otherTransientSenderError. Before, aSenderHasNoReceiversErrorwas a warning when the pipe closed, and debug withclose_pipe_on_send_error=False.Closes #583.