Skip to content

Add AsyncAPI support with SignalR overlay and server composition refactor - #4

Merged
mamonth merged 4 commits into
mainfrom
feature/asyncapi-support-refactor
Sep 4, 2026
Merged

Add AsyncAPI support with SignalR overlay and server composition refactor#4
mamonth merged 4 commits into
mainfrom
feature/asyncapi-support-refactor

Conversation

@mamonth

@mamonth mamonth commented Sep 3, 2026

Copy link
Copy Markdown
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).
@mamonth
mamonth merged commit c43fc63 into main Sep 4, 2026
6 checks passed
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