fix(client): honor authenticated close before correlation

Treat a decoded, authenticated, token-matched close flag as a session-level signal after classifying the packet. Classification events now deterministically precede SessionClosed for pending, duplicate, retained-timeout, evicted-late, and untracked sequences.

Wrong-token and bad-HMAC close packets remain non-terminal. Public event documentation records the ordering contract, and focused regressions cover every correlation class.
This commit is contained in:
Nils Andreas Svee committed 2026-07-27 23:58:16 +07:00
1 parent 91db85cc63
commit 1bf44a1746
4 files changed
+430 -91

No files matched your search

+3 -2
View File
@@ -66,9 +66,10 @@ pub enum ClientEvent {
/// Client timestamp when the open reply was accepted.
at: ClientTimestamp,
},
/// The client sent a close request and considers the session closed.
/// The session closed locally or through an authenticated peer close.
///
/// This is a local lifecycle event, not an acknowledgement from the server.
/// For a peer close-flagged echo reply, the reply's measurement or
/// classification event is emitted immediately before this event.
/// Managed sessions disconnect event subscribers after the worker exits,
/// while leaving already queued events available to drain.
SessionClosed {