Skip to content

Conversation

@kentonv
Copy link
Member

@kentonv kentonv commented Dec 22, 2025

DO NOT MERGE until the autogate introduced in #5738 is fully rolled out and working.

Until then I'm putting this up just to show what we'll be able to remove.

The design of `StreamSink` makes it fairly complicated and somewhat inefficient to implement. For example:

* It requires the use of `setPipeline()` so that the caller can start to enable promise pipelining on the `StreamSink` before it actually returns results.
* Every call must create a `resultsStreamSink` object in advance, before it knows if there will be any streams in the results.
* Generally there's just a lot of contortions involved in supporting it.

It occurred to me that a different design is possible: one where we have an object that is created *per-IoContext* (instead of per-call) which can be used to "push" values into that IoContext, so that they can then be referenced as externals by subsequent JsValues.

This commit introduces that design, including specifying how it would work to implement `ReadableStream`. Subsequent commits will actually implement this design.

Eventually, after everyone in production is updated to understand and then use the new design, we can deprecate and remove StreamSink, thus cleaning up all the mess it created.
capnp PR: capnproto/capnproto#2475

The comment in this file says not to hand-edit it, but I don't understand how to use update-deps.py to update to a not-yet-merged PR...
This doesn't yet support any actual pushed types, this is just the infrastructure needed to make it available.

This introduces an autogate which opts into using ExternalPusher for calls. The caller decides (based on the autogate) whether to use ExternalPusher for the whole call. We can turn on the autogate once all call receivers in production understand the new protocol.
Currently, it appears that we do not run wd-tests with all-autogates. We probably should but that'll have to be a separate change. For now, this arranges just to run js-rpc-test and abortsignal-test a second time with the ExternalPusher autogate on.
DO NOT MERGE until the autogate introduced in #5738 is fully rolled out and working.

Until then I'm putting this up just to show what we'll be able to remove.
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.

1 participant