Skip to content

Propagate NoEvents from nested tubes#245

Open
sneakers-the-rat wants to merge 5 commits into
mainfrom
issue-162-239
Open

Propagate NoEvents from nested tubes#245
sneakers-the-rat wants to merge 5 commits into
mainfrom
issue-162-239

Conversation

@sneakers-the-rat

@sneakers-the-rat sneakers-the-rat commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Fix: #162
Fix: #239

Interpret a None return value from a nested tube as a NoEvent in a parent.

This is the gentlest way to do this, without changing the default behavior of tubes to return NoEvent when no events made it to the return node (which we could do later, for consistency's sake) - this keeps the output of a runner falsy when no events are emitted.

two line change, the rest is docs and tests. could have reused existing tubes for this, but wanted to have a specific test for this, so it's more verbose than it could have been

edit: it turns out we needed a bit more, to actually propagate the signals from the return node -> tube node. Normally return nodes have no signals, because their values can't be returned within the tube (they are a "level shift" that brings events up to the calling scope). However when they are used in nested tubes, the return values become signals available in the parent tube. So by correctly inferring those and using those for NoEvent, we are basically fixing unimplemented but implied features of the tube node without adding special cases.


📚 Documentation preview 📚: https://noob--245.org.readthedocs.build/en/245/

@codspeed-hq

codspeed-hq Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing issue-162-239 (2963430) with main (5c236d7)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coveralls

coveralls commented Jul 7, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 84.631% (+0.04%) from 84.589% — issue-162-239 into main

Comment on lines +152 to +153
if not return_nodes:
return {"value": Signal(name="value", annotation=Any)}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

maybe this should just be empty, no point in just always emitting NoEvent as if there was something to subscribe to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return NoEvents from tube nodes NoEvent, return and TubeNode

2 participants