Repository navigation
feat(position)!: give position-history points contiguous, stable sequences - #176
Merged
Merged
Conversation
…ences Collinear samples now extend only the newest point while no read has returned it; snapshot() and since() seal every point they return. A coalesced point keeps its sequence, so point i of a frame always has sequence first_sequence + i and a delivered point never changes. Deltas therefore only append, and the tail-replacement bookkeeping is gone. Capacity eviction no longer advances the generation, which used to turn every delivery into a full replacement once the history was full. Frames carry oldest_sequence instead, and consumers drop their points before it. Replacements remain for the initial frame, clear and reconfiguration, and a cursor that fell behind the oldest retained point. BREAKING CHANGE: PositionHistoryFrame field 5 (replacement_count) is reserved and new field 7 (oldest_sequence) reports the retained window. Eviction no longer sends a replacement, so consumers must trim their copy to oldest_sequence to stay bounded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame's wire format changes incompatibly anyway, so reuse the removed replacement_count's number instead of reserving it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Makes position-history sequence numbers contiguous and stable, so a consumer can identify every point it receives and the stream stops resending the whole history once it is full.
Why
replacement_countto replace a tail the consumer had already seen.What changes
snapshot()andsince()finalize every point they return.first_sequence + i, and a delivered point never changes. Deltas only append;replacement_rootandreplacement_countare removed.oldest_sequence, the oldest point still retained, and consumers drop their points before it.clear()and reconfigurationnext_sequencenative/server/README.mddescribes the new contract.Compatibility
Breaking change in
PositionHistoryFrame:replacement_counttooldest_sequence. The number is reused rather than reserved, since consumers have to update together with the server anyway.oldest_sequence. Consumers must update together with the server.Trade-off
Merging stops at each read, so a long straight move now adds about one point per delivery (50 ms) instead of staying a single point. With the default 10 ms sampling and a 20,000-point history, that covers about 17 minutes of continuous straight motion, or about 3 minutes of continuous curves (curves never merged). Idle time adds nothing.
Tests
native_edge_tests.ccnow covers:oldest_sequenceThe
replacement_counttests are removed.Not verified
The full server build and the live websocket integration tests were not run, because no current patched LinuxCNC build was available. The domain-only build and its tests pass,
telemetry_session.cccompiles against the regenerated proto, and clang-format and clang-tidy are clean on the changed files.🤖 Generated with Claude Code