Stamp capture time explicitly (four-slot timestamp model) - #7
Merged
Conversation
serverTs is the CAPTURE time (edgecommons/edgecommons#79): for a direct-client Modbus adapter, receive IS capture, so it must be stamped at register-read completion, not left to the data() facade's serverTs=now-at-publish default, which drifts under batchMs batching. - poll_manager: the block-read-failure path now captures the failure timestamp when the exception is caught and passes it through as server_ts (it previously fell back to publish-time stamping in the publisher's value-less path). Successful reads and decode failures already stamped read_ts at read completion. - command_service: sb/read captures serverTs explicitly at read completion (same stamp as the poll path) instead of inline at reply assembly. - publisher: docstring states the capture-time contract for every poll-path sample; the facade's at-publish default remains only as a last-resort fallback. - tests: a delayed batched flush (simulated batching latency) must carry the read-time serverTs, not the publish time, for both valued and value-less samples; the block-read-failure test now pins the capture stamp. - docs: reference/messaging-interface.md states the four-slot model (serverTs = capture time; sourceTs absent; receivedTs not emitted). 131 tests pass, coverage 95.68% (gate 90%). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iQDskU2E1HLStYHoZrSTn
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.
Implements the SOUTHBOUND four-slot timestamp model (edgecommons/edgecommons#79) for the Modbus adapter:
serverTsis the capture time — the moment the protocol read the value. For this direct-client adapter, receive IS capture, so the stamp is taken at register-read completion and passed explicitly through to each sample, never left to thedata()facade'sserverTs=now-at-publishdefault (which drifts underbatchMsbatching).sourceTsstays absent (Modbus supplies no device time);receivedTsis not emitted (degenerate for a direct client).What was drifting
poll_manager._poll_group): BAD samples for a failed block read carried noserver_ts, so the publisher's value-less path stamped them at publish/flush time — drifting by up to the wholebatchMswindow. Now the failure timestamp is captured when the exception is caught and passed through.read_tsat read completion;sb/readreplies stamped inline at reply assembly — now captured explicitly at read completion with the same stamp as the poll path.Changes
modbus_adapter/poll_manager.py— capture the failure timestamp on the block-read-failure path and pass it asserver_ts.modbus_adapter/command_service.py—sb/readcapturesserverTsat read completion.modbus_adapter/publisher.py— module docstring states the capture-time contract.tests/test_publish_events.py— new test: a delayed batched flush (simulated batching latency) carries the read-timeserverTs, not the publish time, for valued and value-less samples; block-read-failure test now pins the capture stamp.docs/reference/messaging-interface.md— one reference paragraph stating the four-slot model in present tense.Validation
🤖 Generated with Claude Code
https://claude.ai/code/session_014iQDskU2E1HLStYHoZrSTn