Skip to content

Conversation

stoprocent
Copy link
Contributor

Summary

This MR adds message ID tracking capability to the ObserveReadStream class, enhancing the observability of CoAP observe operations.

Changes Made

Code Changes

  • Added _lastMessageId property to ObserveReadStream class in lib/observe_read_stream.ts
  • Property type: number | undefined to handle cases where no messages have been processed yet
  • Initialization: Set to undefined in constructor
  • Updates: Property is updated in the append() method when processing observe packets

Test Coverage

  • Added test in test/agent.ts within the existing "observe problems" test suite
  • Test verifies:
    • Initial state of _lastMessageId
    • Proper updating after first observe notification
    • Correct tracking after subsequent notifications
  • All existing tests continue to pass

Technical Details

The _lastMessageId property is updated in the append() method at line 55:

this._lastMessageId = packet.messageId

This happens when a packet passes the filtering criteria and is pushed to the stream, ensuring the property always reflects the most recently processed message ID.

Benefits

  • Enhanced debugging: Developers can now inspect which message ID was last processed
  • Better observability: Useful for troubleshooting observe stream issues
  • Consistent with existing pattern: Follows the same approach as _lastId and _lastTime properties

Testing

  • ✅ New test passes successfully
  • ✅ All existing observe tests continue to pass
  • ✅ No breaking changes introduced
  • ✅ Build process completes without errors

Files Changed

  • lib/observe_read_stream.ts - Added _lastMessageId property and logic
  • test/agent.ts - Added test coverage for new functionality

Breaking Changes

None. This is a purely additive change that maintains backward compatibility.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 16913726014

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 92.669%

Totals Coverage Status
Change from base Build 16299845999: 0.006%
Covered Lines: 2921
Relevant Lines: 3106

💛 - Coveralls

1 similar comment
@coveralls
Copy link

coveralls commented Aug 12, 2025

Pull Request Test Coverage Report for Build 16913726014

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 92.669%

Totals Coverage Status
Change from base Build 16299845999: 0.006%
Covered Lines: 2921
Relevant Lines: 3106

💛 - Coveralls

@Apollon77
Copy link
Collaborator

I restarted the tests .. lets see if they pass now

@Apollon77
Copy link
Collaborator

grmppf seems we need to find out what the tests are that flaky currently :-(

@JKRhb I will be on vacation the next two weeks so no clue if I find time before mid september ... I can do reviews from my mobile, but likely no development or testing that out. But seems like the same issue already appeared with the Deps PR ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants