Skip to content

Fix review findings: chi path params, JSON-RPC conformance, SignalR/s… - #6

Merged
mamonth merged 2 commits into
mainfrom
fix/review-chi-rpc-signalr-robustness
Sep 5, 2026
Merged

Fix review findings: chi path params, JSON-RPC conformance, SignalR/s…#6
mamonth merged 2 commits into
mainfrom
fix/review-chi-rpc-signalr-robustness

Conversation

@mamonth

@mamonth mamonth commented Sep 5, 2026

Copy link
Copy Markdown
Owner

…hutdown robustness

Correctness:

  • chi v5.2.5 requires {param} braces; OpenAPIPatternToChi no longer rewrites to :id, so OpenAPI/AsyncAPI parameterized routes actually match through the router (was silently broken for every {id} route). Add end-to-end tests.
  • JSON-RPC 2.0 conformance: ParseBody returns ordered RpcEntry[] with correct -32600 Invalid Request (was all -32700), malformed batch elements no longer abort siblings, empty batch is invalid, all-notification batches answer 204, and procedure path params are extracted against the procedure's own pattern.
  • SignalR delivery: Candidates dedupes per connection (was NxN streams), the negotiate response advertises Text-only matching the handshake, handshake errors are JSON-escaped, and dead removeConnectionStreams is removed.
  • Manage-stream sockets get a read deadline (idle reaping); Shutdown cancels pending delayed emissions; state.GetNamespace/GetAll deep-copy nested values.
  • /_mock/examples validate (default true) now validates the response body against the route's OpenAPI schema instead of being a silent no-op.

Design:

  • Collapse loader/server mirror types to type aliases (RouteMapping, SchemaInfo, RequestRecord, ResponseRecord); delete convert.go and the copy layers.
  • Single-source constants: protocol names -> asyncapi.Protocol*, expression source names -> runtime.Source*.
  • Consolidate "push to channel" onto the ConsumerBus; central writeJSON helper; pushPayload dead code removed.
  • docs/architecture.md and api/openapi.yaml reconciled with implementation; derivedExamples fails loud on a mis-typed match and deep-copies extensions.

Specs: add RS.ASP.11, RS.AMG.29/30, RS.SHR.22, RS.JRP.33/34, RS.MAPI.34 and align RS.SHR.8/RS.JRP.22; 300/300 scenario coverage retained.

…hutdown robustness

Correctness:
- chi v5.2.5 requires {param} braces; OpenAPIPatternToChi no longer rewrites
  to :id, so OpenAPI/AsyncAPI parameterized routes actually match through the
  router (was silently broken for every {id} route). Add end-to-end tests.
- JSON-RPC 2.0 conformance: ParseBody returns ordered RpcEntry[] with correct
  -32600 Invalid Request (was all -32700), malformed batch elements no longer
  abort siblings, empty batch is invalid, all-notification batches answer 204,
  and procedure path params are extracted against the procedure's own pattern.
- SignalR delivery: Candidates dedupes per connection (was NxN streams), the
  negotiate response advertises Text-only matching the handshake, handshake
  errors are JSON-escaped, and dead removeConnectionStreams is removed.
- Manage-stream sockets get a read deadline (idle reaping); Shutdown cancels
  pending delayed emissions; state.GetNamespace/GetAll deep-copy nested values.
- /_mock/examples validate (default true) now validates the response body
  against the route's OpenAPI schema instead of being a silent no-op.

Design:
- Collapse loader/server mirror types to type aliases (RouteMapping, SchemaInfo,
  RequestRecord, ResponseRecord); delete convert.go and the copy layers.
- Single-source constants: protocol names -> asyncapi.Protocol*, expression
  source names -> runtime.Source*.
- Consolidate "push to channel" onto the ConsumerBus; central writeJSON helper;
  pushPayload dead code removed.
- docs/architecture.md and api/openapi.yaml reconciled with implementation;
  derivedExamples fails loud on a mis-typed match and deep-copies extensions.

Specs: add RS.ASP.11, RS.AMG.29/30, RS.SHR.22, RS.JRP.33/34, RS.MAPI.34 and
align RS.SHR.8/RS.JRP.22; 300/300 scenario coverage retained.
@mamonth
mamonth merged commit 3988b64 into main Sep 5, 2026
6 checks passed
@mamonth
mamonth deleted the fix/review-chi-rpc-signalr-robustness branch September 5, 2026 18:43
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