Repository navigation
fix(session): AimX over serial — every reconnect gets its events (#328) - #350
Merged
Merged
Conversation
- Changelogs: `aimdb-core` (session engine fixes, `Session::starts_session`), `aimdb-serial-connector`, `aimdb-client`, and the root changelog. - `aimdb-serial-connector`: "Sessions on a line that never closes" in the crate docs: a client's `hello` starts a new session; a client that leaves without another connecting keeps its subscriptions until the next `hello`; size subscriber slots for remote access on top of a record's taps and links. - `aimdb-core`: drop a redundant explicit doc link target on `Session::starts_session`, which failed `make doc` (`-D warnings`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #328: over a serial line (UART, e.g. the ST-LINK virtual COM port of a NUCLEO board), every other client that reconnected without a board reset got no events. Its subscription was acknowledged, but nothing arrived.
This merges the feature branch
feat/328-serial-session-reset. Each fix was reviewed as its own PR into that branch.subwhose ID is still live is refused withDeniedSession::starts_session, AimX:hello)Internalunder the subscribe ID)embassy-mqtt-connector-demo: the sensor records get a subscriber slot for remote accessaimdb-client: a subscription the server ended no longer reads as "engine/transport failure"aimdb-core,aimdb-serial-connector,aimdb-client, root) and the "Sessions on a line that never closes" section in the serial connector docsCauses
cancelswas keyed by the client's subscription ID, and every client starts at 1. The new subscribe replaced the old entry, and the old pump's cleanup then removed the new one.Buffer::subscribe()can't fail. Without a free SPMC slot, the stream ended at once, and the client was never told.On the board, all three combined. The analysis is in #328.
Behaviour changes
helloon a connection that already had one ends that connection's previous session: its subscriptions stop and their queued events are dropped. This applies to every transport. On UDS/TCP it doesn't happen with a well-behaved client.subwhose ID is still live getsDeniedinstead of silently replacing the live subscription.Internalerror instead of just stopping.aimdb-client: a subscription's terminalInternalreads "the server ended the subscription (its source closed or could not be opened)". Calls keep "engine/transport failure".Session::starts_session(method), with a default (false), so not breaking.Tests
aimdb-core/tests/session_engine.rs: six new tests (live ID refused, ID reused afterunsub, second handshake, first handshake, ended subscription reported, dropped subscription not reported).aimdb-serial-connector/tests/reconnect.rs(new): three clients one after another on a pipe that stays open like a UART, each with exactly its values from its own subscription.aimdb-client: unit tests for the subscription and call error texts.Live on a NUCLEO-H563ZI
Four
aimdb watch command.temp.indoorclients over the ST-LINK UART, one after another without a board reset, three commands published over MQTT per client:mainaimdb watch sensor.temp.indoor, on a record with no free subscriber slot: before, "Watching…" and silence; now, after 1 s,the server ended the subscription (its source closed or could not be opened), exit code 1.seq:1.Known gap (documented, not fixed)
A client that leaves without another one connecting stays invisible: its subscriptions keep streaming into the UART until the next
hello. Detecting that would need a timeout, and the session engine is deliberately timer-free.Verified locally
aimdb-core,aimdb-client,aimdb-uds-connector,aimdb-tcp-connector,aimdb-serial-connector,aimdb-websocket-connector,aimdb-cliandaimdb-mcp.-D warnings) foraimdb-coreandaimdb-serial-connector, includingthumbv7em.cargo doc -D warningsforaimdb-core(including--all-features) andaimdb-serial-connector.Related Issue
Checklist
make check). The affected crates pass locally; the full run is left to CI.🤖 Generated with Claude Code
https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e