Repository navigation
clients: add opt-in windowed delivery and examples - #529
Draft
Connor Peet (connor4312) wants to merge 8 commits into
Draft
Connor Peet (connor4312) wants to merge 8 commits into
Connor Peet (connor4312) wants to merge 8 commits into
Conversation
Go, Kotlin, and .NET chose SessionState for any snapshot with a lifecycle member, but TerminalState has one too. Require provider as well, and add a terminal snapshot round-trip fixture. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Scripted host conversations and UTF-16 size cases that every client library runs, so buffering, credit, coalescing, and sending behave the same way in each language. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Subscriptions can opt into windowed delivery. Credit follows the consumer, sends wait for the host window, queued data is coalesced, and managed hosts keep windowed subscriptions across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Subscriptions can opt into windowed delivery. Credit follows the consumer, sends wait for the host window, queued data is coalesced, and managed hosts keep windowed subscriptions across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Subscriptions can opt into windowed delivery. Credit follows the consumer, sends wait for the host window, queued data is coalesced, and managed hosts keep windowed subscriptions across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Subscriptions can opt into windowed delivery. Credit follows the consumer, sends wait for the host window, queued data is coalesced, and managed hosts keep windowed subscriptions across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Subscriptions can opt into windowed delivery. Credit follows the consumer, sends wait for the host window, queued data is coalesced, and managed hosts keep windowed subscriptions across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a basic and an advanced windowing example to the TypeScript, Rust, Go, Swift, and .NET clients. Each example runs against an in-memory demo host that follows the window rules, so it needs no server. The basic example shows the host pausing at a full window and resuming on credit. The advanced example shows a slow renderer, built-in coalescing, a custom coalescer that keeps the latest terminal resize, and a paste that waits for the subscription to become writable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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 opt-in windowed delivery to the TypeScript, Rust, Go, Swift and .NET clients, a shared conformance corpus that all five run, and runnable examples for each.
The protocol, the TCP channel and the window-exempt annotations merged in #510 and its stack. This PR adds the client implementations on top of that.
What changed
Shared conformance corpus (
types/test-cases/windowed-delivery/): 24 scripted scenarios between one client and a fake host, plus a table of exact UTF-16 sizes. They cover accepting and declining windowing, automatic and manual release, fragments larger than the window, unknown methods being counted, coalescing (enabled, disabled, never across action origins), sends blocking on a full window, outbound fragments, re-subscribing, and protocol violations. Every client runs the same files through a small driver.Client support (one commit per client): windowing is off by default and opted into per subscription. Each client:
subscribe, falls back to ordinary delivery when the host declines or the transport cannot provide raw text, and reports the reason;waitWritableand the language equivalents);terminal/data,chat/deltaand outgoingtcp/data, and accepts custom coalescers;Each client has a changelog fragment.
Generator fix: the Go, Kotlin and .NET generators treated any snapshot with a
lifecyclemember asSessionState, butTerminalStatehas one too. They now also requireprovider, and a terminal snapshot round-trip fixture covers it.Examples: each client has a basic and an advanced example. They run against an in-memory demo host that follows the window rules, so they need no server.
terminal/resizedactions, so 17 host messages arrive as 6–7 renders. Then a paste into a slow terminal waits for the subscription to become writable before each chunk.npx tsx examples/windowing-basic.tscargo run -p ahp --example windowing_basicgo run ./examples/windowing_basicswift run --package-path clients/swift/Examples WindowingBasicdotnet run --project examples/WindowingBasicEach advanced example has the matching
backpressurename. Swift's examples are a separate local package, so the publishedPackage.swiftis unchanged.Notes for reviewers
negotiatedevent. Rust also reports a blocked/unblocked pair during negotiation, before any data is sent./as\/in outgoing JSON, and .NET's default serializer escapes more characters. Their outgoing messages are slightly larger; the window accounting stays consistent.Validation
npm run generate: no changes. Rootnpm test: 594 passed.typecheck,typecheck:examples, andnpm test(159 passed).cargo fmt --check,cargo clippy --workspace --all-targets -D warnings, andcargo test --workspace(112 passed).gofmt,go vet ./...,go test ./..., and both examples under-race.swift test(134 passed). The examples package builds in Swift 6 mode with no warnings.dotnet testpassed 708 of 709. The remaining test,RealSocketTypeScriptConformanceTests, needs Node.js, which isn't in the .NET SDK container.132x40resize (1192 bytes, the sum of the four resizes) and an intact paste.