Repository navigation
feat(aimx)!: exact-topic subscribes send a late-join snapshot (#438) - #440
Merged
Merged
Conversation
An exact-topic AimX subscribe now sends the record's current value as a `snap` frame, as wildcard subscribes and WebSocket already do. A record with no current value (none written yet, or an `SpmcRing`) sends none. Each record's stream is opened first and its snapshot read right after; the stream then drops leading updates stamped at or before the snapshot. A fresh SingleLatest reader starts on the current value, so without this the value arrived twice: as the snapshot and again as the first event (already the case on wildcard subscribes). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #438. Part of #422.
What changes
An exact-topic AimX subscribe over UDS, TCP or serial now starts with the record's current value as a
snapframe (last: true), followed by events fromseq2. Wildcard subscribes and WebSocket already work this way. A record with no current value sends no snapshot. That covers records with nothing written yet andSpmcRingbuffers.The duplicate this also fixes
A new
SingleLatestreader starts on the record's current value, on tokio (mark_changed) and on embassy (Watch). So:AimxSession::record_streamnow opens the reader and then reads the snapshot, in that order. The stream then drops leading updates stamped at or before the snapshot. A write after the snapshot has a later stamp, so it is still delivered as an event. The snapshot is read withtry_latest_as_json_bytes, the same pathrecord.getuses. The engine callssubscribeand thensnapshots, sosubscribestores the snapshots andsnapshots()hands them over.Client, CLI, MCP
watch::arm+await_updates: no change. The snapshot's stamp equals the baseline, so it is filtered out.armed_watch_sees_only_the_write_after_itstill passes for SingleLatest, ring and Mailbox.aimdb watch <record>: the current value now arrives as a snapshot, followed by the📸 snapshot completeline. It came as the first event before, so--countcounts it as before, and--newstill skips it. The README and CHANGELOG are updated.arm(dropping therecord.get). It can be a follow-up.Tests
New test
exact_subscribe_sends_the_current_value_onceinaimdb-client/tests/aimx_session.rs:ts);With the head filter turned off, the test fails on the duplicate value.
Locally:
std,tracing), UDS, TCP (_test-tokio) and serial (std) tests;alloc,remote,connector-sessionandstd,tracing,observability), client, CLI and MCP;Compatibility
Wire change: AimX exact-topic subscribers now receive a
snapframe before the firstevent. In-repo clients already handlesnap. The core CHANGELOG entry is marked as a wire change.🤖 Generated with Claude Code