feat(builder): add subscribe flag for write-only pathways#78
Merged
Conversation
Adds optional `subscribe?: boolean` (default `true`) to PathwaysBuilder.register(). When `false`, .write() works but the in-process pump does not subscribe to that pathway's flow type. Use for analytical / write-only events that have no in-service consumer, avoiding back-pressure on the shared pump queue. Provisioning still creates the flow type and event type for write-only pathways so .write() targets exist in flowcore. Only the pump.start() registrations are filtered via the new private buildSubscribedRegistrations() helper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adds optional
subscribe?: boolean(defaulttrue) toPathwaysBuilder.register(). When set tofalse,.write()still works but the in-process pump does NOT subscribe to that pathway's flow type, so events are not pulled and.handle()will never fire.Use for analytical / write-only events that have no in-service consumer, avoiding back-pressure on the shared pump queue.
Why
Without this option, registering a pathway with
writable: trueand no.handle()causes the in-process pump to subscribe and queue events that are never acknowledged, eventually wedging the shared pump and timing out every othersessionPathway.writeviawaitForPathwayToBeProcessed. We hit this in production forpump-pulse.0in data-pathways CP — that fix lands in a follow-up PR once this version is on npm.Behavior
subscribe: true(default): unchanged — pump subscribes, handler fires.subscribe: false: pump skips subscription..write()works..handle()registered for the pathway will not fire (no events are delivered).Test plan
tests/pathway-subscribe-flag.test.ts(6 steps)deno test -A --ignore=tests/postgres-pathway-state.test.ts— 14 files / 127 steps green