feat(ws): consume gateway change events (issue #784) (#837)

* feat(ws): consume gateway change events (cron/sessions/platforms/pairing) for targeted refresh (issue #784)

* test(chat): complete catch-all request stub — kill frozen-collector capture race (slash-focus flake, 4645a2b CI)

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-07 13:48:17 +03:00
1 parent 7d60057156
commit f34bfa7cf8
15 files changed
+320 -4

No files matched your search

@@ -101,11 +101,13 @@ class ChatViewModelTest {
// fires after unmockkAll and crashes an unrelated later test with
// MockK's "can't find stub" (UncaughtExceptionsBeforeTest). Mirror
// the real request()'s send() delegation (tests verify send calls)
// but return a never-completing deferred — same unanswered behavior,
// no leaked timer.
// but skip the timer. Must COMPLETE (Unit): a never-completing
// deferred freezes the VM's event collector at the SESSION_CREATE
// session.usage await and lets its late completion race per-test
// capture stubs (slash-focus flake, CI 31137581335 on 4645a2b).
every { HermesWsClient.request(any(), any(), any()) } answers {
HermesWsClient.send(arg(0), arg(1)) {}
CompletableDeferred<Any?>()
CompletableDeferred<Any?>(Unit)
}
mockkObject(ApiClient)
mockkObject(HermesDatabase)
@@ -107,10 +107,15 @@ class SlashCommandDispatchRpcTest {
// wsScope that fires after unmockkAll and crashes a later test with
// MockK's "can't find stub". Mirror the real send() delegation (so
// send-based verifications still see the call) but skip the timer.
// Must COMPLETE (Unit): a never-completing deferred freezes the VM's
// event collector at the SESSION_CREATE-triggered session.usage await,
// and that completion then races the per-test capture stubs — the slot
// can end up holding session.usage instead of command.dispatch (CI run
// 31137581335 on 4645a2b: slash-focus flake).
// Specific per-test request() stubs registered later take precedence.
every { HermesWsClient.request(any(), any(), any()) } answers {
HermesWsClient.send(arg(0), arg(1)) {}
CompletableDeferred<Any?>()
CompletableDeferred<Any?>(Unit)
}
}