fix(pump): forward the notifier type discriminator to the data pump - #102
Merged
Conversation
buildNotifierOptions() emitted `{ dataSource, auth, pollerIntervalMs }` and
`{ dataSource, auth, natsServers }`. @flowcore/data-pump reads
options.notifier?.type === "poller" ? options.notifier.intervalMs : undefined
options.notifier?.type === "nats" ? options.notifier.servers : undefined
so both branches resolved to undefined and every pump fell through to
waitWebSocket, regardless of what the caller configured. `poller` and `nats`
have been dead options. It also nested `dataSource`/`auth` under `notifier`,
which the pump never reads — both come from the top-level pump options.
Emit the FlowcoreDataPumpNotifierOptions union exactly, typed against a local
mirror so the shape cannot drift silently across the dynamic-import boundary.
BEHAVIOUR CHANGE for anyone who configured a non-default notifier. They have
been running websocket; after this they get what they asked for.
- nats: the pump now really connects. service-tenant-store-api sets
NATS_SERVERS in production and has been on websocket since pathways 2.4.0 —
confirm reachability before upgrading, since a failing connect drops the
pump into restart backoff.
- poller: the pump now really polls. Upstream waits
Math.min(pollerIntervalMs, 1000), so any interval above 1s still polls every
second. Filed separately against data-pump.
Consumers on the default or explicit websocket are unaffected.
Also:
- waitForPathwayToBeProcessed now states that the timed-out write succeeded
and is durable, so callers stop retrying and duplicating a stored event.
The message still begins with the original text, so log greps and alerts
matching "Pathway processing timed out" keep working.
- README documents notifier selection, the notifier-recovery vs
pathwayTimeoutMs relationship, and fireAndForget on request paths.
- tests/pathway-pump-notifier.test.ts asserts the emitted options exactly;
5 of its 6 steps fail against the previous implementation.
- retargeted the existing per-group event-type assertion at the top-level
dataSource, which is the field the notifier actually reads.
Co-Authored-By: Claude Opus 5 (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.
Description
buildNotifierOptions()emitted a shape@flowcore/data-pumpdoes not read. Thetypediscriminator was never sent and the key names differed:Both branches resolved to
undefined, so every pump fell through towaitWebSocket.pollerandnatshave been dead options for every consumer. The nesteddataSource/authwere also ignored — the notifier takes both from the top-level pump options.This emits
FlowcoreDataPumpNotifierOptionsexactly, typed against a local mirror so the shape cannot drift silently across the dynamic-import boundary.Found while investigating "Lost
event.stored.*notifications stall pathway consumers" (board task5c0bce51-158f-4501-b706-f45f17a447c8), which reports platform-wide 500s on writes that actually succeeded.Consumers on the default or explicit
{ type: "websocket" }are unaffected (identical code path). Anyone who configured a non-default notifier has been silently running websocket and will now get what they configured:nats— the pump really connects.service-tenant-store-apisetsNATS_SERVERSin production and has been on websocket since pathways 2.4.0. Confirm reachability from the workload before upgrading; a failing connect drops the pump into restart backoff.poller— the pump really polls. Upstream waitsMath.min(pollerIntervalMs, 1000), so any interval above one second still polls every second. Worth weighing against currentservice-event-type-apiingest latency. To be filed separately against data-pump.Type of Change
No public API signature changes.
PumpNotifierConfigis unchanged —pollerIntervalMs/natsServersstay the consumer-facing names and are mapped internally.Testing
tests/pathway-pump-notifier.test.tsdeno fmt --check,deno lint,deno check src/mod.tsall clean.Also in this PR
waitForPathwayToBeProcessednow states the timed-out write succeeded and is durable, so callers stop retrying and duplicating a stored event. The message still begins with the original text, so log greps and alerts matchingPathway processing timed outkeep working.pathwayTimeoutMsrelationship,fireAndForgeton request paths, and an upgrade warning.dataSource, which is the field the notifier actually reads.Additional Notes
This does not fix the dropped notifications themselves — it makes the workarounds reachable and the failure legible. Two follow-ups remain: forwarding
timeoutMsfromFlowcoreDataPump.create()intoFlowcoreNotifier(currently dead config, pinning recovery at 20s whilepathwayTimeoutMsdefaults to 10s), and the producer-side investigation into whyevent.stored.*frames go missing.🤖 Generated with Claude Code