HS: socket namespaced names + timeout plumbing (+2)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s

Native JS wrapper: replace SX dict with (host-new "Object") so
host-set! mutations persist for rpc and closed? updates. bind-path!
uses (host-new "Object") for intermediate namespace nodes so dotted
paths like MyApp.chat bind correctly. Fix _hs_make_rpc_proxy call
wrapper to strip the nil this-arg. Land tests 4+16: namespaced sockets
work, with timeout parses and uses the configured timeout. 5/16 total.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 10:22:09 +00:00
parent a20c9c4625
commit ce39a35c6b
5 changed files with 71 additions and 56 deletions

View File

@@ -11524,7 +11524,11 @@
(deftest "dispatchEvent sends JSON-encoded event over the socket"
(error "SKIP (untranslated): dispatchEvent sends JSON-encoded event over the socket"))
(deftest "namespaced sockets work"
(error "SKIP (untranslated): namespaced sockets work"))
(hs-cleanup!)
(eval-hs "socket MyApp.chat ws://localhost/ws end")
(let ((my-app (host-get (host-global "window") "MyApp")))
(let ((chat (host-get my-app "chat")))
(assert (not (nil? (host-get chat "raw")))))))
(deftest "on message as JSON handler decodes JSON payload"
(error "SKIP (untranslated): on message as JSON handler decodes JSON payload"))
(deftest "on message as JSON throws on non-JSON payload"
@@ -11552,7 +11556,12 @@
(deftest "rpc reconnects after the underlying socket closes"
(error "SKIP (untranslated): rpc reconnects after the underlying socket closes"))
(deftest "with timeout parses and uses the configured timeout"
(error "SKIP (untranslated): with timeout parses and uses the configured timeout"))
(hs-cleanup!)
(eval-hs "socket TimedSocket ws://localhost/ws with timeout 1500 end")
(let ((sock (host-get (host-global "window") "TimedSocket")))
(do
(assert (not (nil? sock)))
(assert (not (nil? (host-get sock "rpc")))))))
)
;; ── swap (4 tests) ──