Repository navigation
Add a showcase config that broadcasts resource updates for --load-subscribe - #2972
Merged
Merged
Conversation
…scribe (#2964) subscriptions-broadcast-http.json sets the new broadcastResourceUpdates option: every session of the composable server joins one shared hub, and update_resource publishes through it, so one call updates the resource in every session and notifies each one subscribed. A --load-subscribe fan-out run against it delivers every notification instead of reporting all but the calling session as missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
There was a problem hiding this comment.
🟡 Changes recommended
A rejected sessionless HTTP POST can leave an unregistered server retained in the hub, leaking resources and escaping shutdown cleanup.
1 open issue
What changed in this PR
Adds a legacy HTTP showcase server for manually exercising --load-subscribe fan-out, addressing #2964 within the existing composable test-server infrastructure.
Changes:
- Adds an opt-in broadcast hub that updates resource content across sessions, notifies subscribers, and replays the latest content to new sessions.
- Adds a showcase configuration and tests for broadcast delivery, stock behavior, replay, and cleanup.
- Links the fixture from the test-server guide, CLI README, and test-server skill.
| File | Description |
|---|---|
test-servers/src/test-server-fixtures.ts |
Routes resource updates through the optional hub. |
test-servers/src/resource-update-broadcast.ts |
Implements broadcasting, replay, and shared text replacement. |
test-servers/src/resolve-config.ts |
Creates one hub per opted-in configuration. |
test-servers/src/load-config.ts |
Declares the JSON broadcast option. |
test-servers/src/index.ts |
Exports the broadcast API. |
test-servers/src/composable-test-server.ts |
Connects resource state and server lifecycle to the hub. |
test-servers/configs/subscriptions-broadcast-http.json |
Adds the legacy HTTP broadcast showcase. |
docs/test-servers.md |
Explains broadcast behavior and manual fan-out usage. |
clients/cli/README.md |
Points --load-subscribe users to the fixture. |
clients/cli/__tests__/subscriptions-broadcast.test.ts |
Tests CLI fan-out and hub behavior. |
.claude/skills/test-servers/SKILL.md |
Adds the fixture to common starting points. |
Review effort: Balanced
A sessionless HTTP POST the transport rejects builds a server that is never registered as a session nor closed; joined at construction, the hub held it forever. Nothing can subscribe before initialized and the hub replays the latest updates on join, so waiting loses nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
Member
Author
|
Copilot round 1 — 1 finding, fixed in 16bc7a4:
No suppressed comments. Requesting round 2. |
Member
Author
|
Copilot review loop closed — round 2 was clean (no inline comments, no suppressed comments; round 1's finding resolved). Exit: clean round. |
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.

Closes #2964
What
A new showcase config,
test-servers/configs/subscriptions-broadcast-http.json(legacy era, port 3225), whose resource updates reach every subscribed session, so--load-subscribecan be tried by hand without writing a server.It is the stock
subscriptions-legacy-http.json(threenumbered_resources+update_resource,subscriptions: true) plus one new composable option,broadcastResourceUpdates: true:test-servers/src/resource-update-broadcast.ts—createResourceUpdateBroadcast(), a hub shared by every session of one server. Each session joins it increateMcpServer(after its resources are registered) and leaves onserver.onclose(chained, not replaced).publish(uri, text)applies the text to every session's copy of the resource and sendsnotifications/resources/updatedto each session subscribed; a session whose send fails is skipped rather than failing the call. The latest text per URI is replayed to a session that joins later, so a fresh session reads the updated content.setResourceTextis the one place a resource's text is replaced, now shared with the non-broadcast path.resolveConfigturnsbroadcastResourceUpdates: trueinto one hub on the resolvedServerConfig.resourceUpdateBroadcast; every session is built from that one object, so they all share it. In-process callers can pass a hub directly.update_resourcepublishes through the hub when there is one (and reports how many subscribed sessions it notified); without one its behavior is unchanged.Docs: a row and a section in
docs/test-servers.md, a "Common starting points" row in thetest-serversskill, and a pointer from the CLI README's--load-subscribesection.Evidence — the issue's run, by hand
Built server + launcher from this branch, same command against each config:
Tests
clients/cli/__tests__/subscriptions-broadcast.test.ts:--load-subscribeCLI run: 4 updates × 3 subscribers = 12 delivered, 0 missed; a fresh session reads the last update; and the hub is empty afterward (every session left on close);test-servers/is test infrastructure outside every coverageinclude, so no per-file gate applies to it.npm run local:gategreen.🤖 Generated with Claude Code