Add AsyncAPI support with SignalR overlay and server composition refactor - #4
Merged
Merged
Conversation
mamonth
commented
Sep 3, 2026
Owner
- Loader: auto-detect AsyncAPI 3.x (3.0.0/3.1.0), neutral asyncapi view, channel->route mapping for http/ws bindings, single MessageSpec conversion
- Server: extract exampleEngine + exampleRegistry (MessageRenderer), hubManager (ConsumerBus), eventBus, pushScheduler; remove dead adapters pkg; Server slims to a coordinator wired only through New/NewWithDependencies
- Protocols: raw ws adapter, http adapter with {$channel.*} address-param capture, ASP.NET Core SignalR-compatible hub (negotiate, token upgrade, handshake, streams, invocations, targeted/broadcast pushes)
- Events: x-event-trigger -> x-send-events event bus with {$event.*} templating
- Management: delayed/targeted/broadcast push, consumer discovery, recurring schedules, fire-event, disconnect incl. abrupt drop
- Specs: six new asyncapi/event-driver/signalr-hub-runtime specs (coverage 100%)
- Tests: unit + integration suites green, race detector clean, scenario coverage 250/250
…ctor
- Loader: auto-detect AsyncAPI 3.x (3.0.0/3.1.0), neutral asyncapi view,
channel->route mapping for http/ws bindings, single MessageSpec conversion
- Server: extract exampleEngine + exampleRegistry (MessageRenderer), hubManager
(ConsumerBus), eventBus, pushScheduler; remove dead adapters pkg; Server slims
to a coordinator wired only through New/NewWithDependencies
- Protocols: raw ws adapter, http adapter with {$channel.*} address-param capture,
ASP.NET Core SignalR-compatible hub (negotiate, token upgrade, handshake,
streams, invocations, targeted/broadcast pushes)
- Events: x-event-trigger -> x-send-events event bus with {$event.*} templating
- Management: delayed/targeted/broadcast push, consumer discovery, recurring
schedules, fire-event, disconnect incl. abrupt drop
- Specs: six new asyncapi/event-driver/signalr-hub-runtime specs (coverage 100%)
- Tests: unit + integration suites green, race detector clean, scenario coverage 250/250
The GRASP refactor left 12 thin Server forwarders that nothing references (production or tests). golangci-lint 'unused' flagged them; delete them. golangci-lint run: 0 issues. Unit/race/integration suites green, scenario coverage 100%.
The CLI startup tests captured output with a single read issued 100ms after process start, racing slower startup in CI (only the first flushed log line was observed, e.g. registerMockRoutes). Add a captureUntil helper that polls a command's output pipe until every expected substring appears, and use it in the 15 affected tests so assertions are deterministic. Also demote the unconditional "registerMockRoutes called" INFO record to Debug to match the per-route "Registered route" debug logs. Verified: golangci-lint 0 issues, unit/race/integration suites green, CLI suite stable across repeated runs, scenario coverage 100%.
The subprocess-based integration tests reserved ports via a free-port TOCTOU (findFreePort: bind :0, read port, close, later bind by the subprocess). Under parallel test load two subprocesses could be handed the same port, so a server bound it, printed "Mock server started" (previously logged before the bind) and exited on collision, while a collided test still dialed the other live server on that port and hit "connection reset by peer" mid-request. - server: split Start() into Listen()/Serve()/BoundPort(); --port 0 now binds an OS-assigned port and the actual port is knowable before serving. - CLI: bind before logging "Mock server started", log the real bound port, report "port already in use" synchronously with exit code 4 (RS.CLI.17), and accept --port 0 (RS.CLI.32) via validatePort. - clihelper: auto-discovery uses --port 0 and reads the actual port back from the startup log; quiet the benign teardown scanner error. - tests/specs: add RS.CLI.32 (ephemeral port) + TestCLIEphemeralPort and TestValidatePort; docs/cli.md notes --port 0. Verified: golangci-lint 0 issues, unit+race green, full integration suites green, and the previously-flaky packages (cli/management-api/server-core/ jsonrpc/extensions) pass repeated concurrent cross-package stress runs; scenario coverage 100% (251/251).
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.