Skip to content

fix(q): harden response handling and encode dict results - #5

Merged
singaraiona merged 3 commits into
RayforceDB:masterfrom
belowzeroff:fix/q-response-message-type
Sep 3, 2026
Merged

fix(q): harden response handling and encode dict results#5
singaraiona merged 3 commits into
RayforceDB:masterfrom
belowzeroff:fix/q-response-message-type

Conversation

@belowzeroff

@belowzeroff belowzeroff commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

How it looks from the user's side

A q client asks a Rayforce Q-wire server for a native dictionary result:

h "(dict ['a 'b] [1 2])"

Before -- the server failed to serialize the native RAY_DICT, so the user saw a Q error instead of the dictionary:

test/rfl/server/types.rfl:45: LHS error: error: q: cann  -- src: (.q.send h "(dict ['a 'b] [1 2])")

After -- the same expression round-trips as a Q dictionary:

T["dict"; (`a`b!1 2)~h"(dict ['a 'b] [1 2])"]
real-q interop ok (30 assertions)

A client asking real q for the identity value also now gets a Rayforce null instead of a decode error:

(nil? (.q.send h "::")) -- true

What changed

Fixes several Q IPC response edge cases:

  • Rejects non-response frames in blocking q_exchange, so pushed or malformed frames are not mistaken for sync replies.
  • Encodes native RAY_DICT values as Q dictionaries on the wire.
  • Decodes Q identity (::, wire type 101 primitive 0) as Rayforce null.
  • Suppresses SIGPIPE / MSG_NOSIGNAL on send, so closed peers fail as ordinary send errors instead of terminating the process.
  • Uses a release helper for ray_error values in decode/server cleanup paths.

Tests

make test

Covered:

  • codec selftest
  • exchange selftest
  • Rayforce server round-trip tests
  • malformed Q frame handling
  • real-q interop
  • client tests against real q
  • event-loop client and push tests

@belowzeroff belowzeroff changed the title fix(q): reject non-response frames fix(q): harden response handling and encode dict results Aug 25, 2026
@belowzeroff
belowzeroff force-pushed the fix/q-response-message-type branch from 3ec6721 to 4cf7ce6 Compare September 2, 2026 19:37
@singaraiona
singaraiona merged commit e22b03c into RayforceDB:master Sep 3, 2026
1 check 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.

2 participants