Skip to content

[Bridge] Added the stream notifier archetype. - #41

Closed
moetemp wants to merge 32 commits into
moe/bridge/n7-callback-progressfrom
moe/bridge/n8-stream-notifier
Closed

moetemp wants to merge 32 commits into
moe/bridge/n7-callback-progressfrom
moe/bridge/n8-stream-notifier

Conversation

@moetemp

@moetemp moetemp commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds the stream notifier, a CHASM execution per stream that holds its callers' Nexus callbacks.

  • chasm/lib/streamnotifier keys a notifier by workflow/<id>/<first run>/<topic>, so one notifier serves the stream across a run chain.
  • Attach is idempotent and capped by streamnotifier.maxCallbacks. Notify hands the highest counter to every callback, and close completes them all.
  • A notify that doesn't close starts no notifier, since no caller waits. A closed notifier answers late attaches for streamnotifier.closedRetention (7 days).
  • An owner check every streamnotifier.ownerCheckInterval closes the stream when the owner chain ended. streamnotifier.ownerCloseGrace leaves a just-closed owner's stream to its Worker first.
  • It's behind streamnotifier.enabled, off by default.

Why?

A notifier keyed by the stream survives worker restarts and works for every producer kind (DD-31). An owner that ended closes the stream (DD-73), but the Worker's own close with the real result wins (DD-108).

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

Unit tests in chasm/lib/streamnotifier and functional TestStreamNotifierEndToEnd on both caller kinds. The live lane covers it too.

moetemp added 30 commits October 9, 2026 20:17
A stream-returning Nexus operation hands its caller's callback to a CHASM execution per stream,
which delivers the producer's notifications as folded progress and completes every callback when
the stream closes. Attaches are bounded, an idle stream closes with a failure, and a closed
notifier keeps completing late attaches for its retention.
The close result becomes the stream operation's result, and SDKs check it against the blob limit
before sending, so the server refuses an oversized one the same way.
An idle timeout now fails only the waiting callers, a callback whose caller
closed is dropped, a full notifier makes room from finished or quiet callbacks,
and an owner that ended without closing the stream closes it with a failure.
Notifications and IDs are bounded, and the business ID names the owner kind.
A completion that beat the start response named no operation token, so the
caller lost the stream; a caller's cancel left it waiting forever; and a reused
Workflow ID reached the earlier chain's closed notifier.
A caller that refused progress, such as every HSM caller, still waits for its
completion, so only callbacks that are done make room.
Such a reference would key a second notifier, which the owner check would
then close as ended while the stream still runs.
A reader that started after one day failed while the store still held its records.
They hold each caller's token, and a reader could forge a completion with one.
No notifier means no caller waits. This also leaves no orphan notifier for a wrong run ID.
Only the values hold a caller's token, and the keys help a reader debug.
A caller saw success when the owner failed, and the owner check failed callers of an owner that completed. The notifier now completes callers as a Workflow-run operation completes (DD-107).
An empty payload carries no encoding, so a typed caller couldn't decode it and its Workflow Task failed on every try.
The owner check could close a completed owner's stream with an empty result before the Worker's close with the real one, and the notifier keeps the first close (DD-108).
@moetemp

moetemp commented Oct 14, 2026

Copy link
Copy Markdown
Owner Author

Replaced by Jetty #51. Bridge was re-cut onto Jetty (stream wake-ups in one namespace) with no Ford content. The same-namespace notifier parts moved to Jetty, and the Nexus parts are in Bridge v2.

@moetemp moetemp closed this Oct 14, 2026
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