docs: correct three comments the connect-ordering change invalidated
Copilot review round 3 (no new code findings, three stale-comment ones): - `openModernListenStreamOnConnect`'s generation guard was justified by a `connect` listener racing it — which the previous commit made impossible by dispatching `connect` after this call. The guard is still right, for reasons that survive the reorder: `statusChange` has already fired, and a concurrent `subscribeToResource` or `disconnect()` (whose `resetSubscriptionStream` bumps the generation) can supersede it. - `reconcileModernStreamStateAfterFailedRefresh`'s JSDoc still described its branches as "nothing subscribed" vs "URIs live"; they are the empty vs non-empty *filter* now, which differ exactly on the listChanged-only path. - The superseded-failure test carried the same stale `connect` rationale. Comments only; no behavior change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HDdo1rNRVQnVRRdsqSrvG3
This commit is contained in:
parent
d08a53027a
commit
b2dfd4099a
1 changed files with 24 additions and 16 deletions
|
|
@ -431,11 +431,15 @@ describe("resource subscriptions era fork (#1630)", () => {
|
|||
});
|
||||
|
||||
it("leaves a superseded connect-time failure to the refresh that owns the stream", async () => {
|
||||
// `connect` is dispatched before the stream is opened, so a listener can
|
||||
// start and acknowledge a newer refresh while this one is still awaiting
|
||||
// its `listen()`. Reconciling anyway would arm a reconnect against a
|
||||
// healthy stream and tear it down — the same ownership test the
|
||||
// subscribe/unsubscribe paths make.
|
||||
// Nothing about the ordering above makes this call the only refresh that
|
||||
// can be in flight: `statusChange` has already fired, and a concurrent
|
||||
// `subscribeToResource` — or a `disconnect()`, whose
|
||||
// `resetSubscriptionStream` bumps the generation too — can supersede this
|
||||
// one while its `listen()` is pending. Reconciling anyway would arm a
|
||||
// reconnect against a stream that is healthy (or a session that is gone),
|
||||
// so this makes the same ownership test the subscribe/unsubscribe paths
|
||||
// make. Driven here by a stub that bumps twice, standing in for "someone
|
||||
// else advanced it".
|
||||
const started = await startToolsOnlyServer({ tools: true });
|
||||
const connected = new InspectorClient(
|
||||
{ type: "streamable-http", url: started.url },
|
||||
|
|
|
|||
Loading…
Reference in a new issue