Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server] Add support for SupportsFilteredRetain #2913

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Archie-Miller
Copy link
Contributor

Proposed changes

Add support for SupportsFilteredRetain - Issue 2142

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply. You can also fill these out after creating the PR.

  • Bugfix (non-breaking change which fixes an issue)
  • [ x ] Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [ x ] I have read the CONTRIBUTING doc.
  • [ x ] I have signed the CLA.
  • [] I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • [ x ] I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

One potential issue is that the ConditionState SupportsFilteredRetain property should be handled by the ObjectModeller. When this is implemented, this property and member variable will need to be removed.

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 55.65%. Comparing base (5b3f91d) to head (751136a).

Files with missing lines Patch % Lines
...raries/Opc.Ua.Server/Subscription/MonitoredItem.cs 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2913      +/-   ##
==========================================
+ Coverage   55.40%   55.65%   +0.24%     
==========================================
  Files         352      352              
  Lines       67605    67644      +39     
  Branches    13851    13860       +9     
==========================================
+ Hits        37456    37645     +189     
+ Misses      26044    25873     -171     
- Partials     4105     4126      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@romanett romanett changed the title Archie/2142 filter retain redo [Server] Add support for SupportsFilteredRetain Dec 18, 2024
@romanett romanett linked an issue Dec 18, 2024 that may be closed by this pull request
5 tasks
@mregen mregen requested review from mrsuciu and Copilot December 19, 2024 15:13

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

Libraries/Opc.Ua.Server/Subscription/MonitoredItem.cs:1086

  • [nitpick] The method name 'CanSendFilteredAlarm' is ambiguous. Consider renaming it to 'ShouldSendFilteredAlarm' to better reflect its purpose.
protected bool CanSendFilteredAlarm(FilterContext context, EventFilter filter, IFilterTarget instance)

Libraries/Opc.Ua.Server/Subscription/MonitoredItem.cs:1086

  • The new behavior introduced by 'CanSendFilteredAlarm' should be covered by tests to ensure it works as expected.
protected bool CanSendFilteredAlarm(FilterContext context, EventFilter filter, IFilterTarget instance)
@mregen mregen requested a review from Copilot December 19, 2024 18:43

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

Libraries/Opc.Ua.Server/Subscription/MonitoredItem.cs:1045

  • [nitpick] The method name 'CanSendFilteredAlarm' is ambiguous and does not clearly convey its purpose. Consider renaming it to 'ShouldSendFilteredAlarm' to better reflect its functionality.
if ( !CanSendFilteredAlarm( context, filter, instance ) )

Libraries/Opc.Ua.Server/Subscription/MonitoredItem.cs:1135

  • The comment includes a date 'December 17 2024' which may be a typo or placeholder. Ensure the date is correct or remove it if unnecessary.
// Archie - December 17 2024

Libraries/Opc.Ua.Server/Subscription/MonitoredItem.cs:1144

  • The variable 'saved' is used without being initialized in some cases. Ensure 'saved' is properly initialized before use to avoid potential null reference errors.
if ( saved )
alarmCondition.SupportsFilteredRetain.Value &&
filter.SelectClauses != null)
{
int lastIndex = filter.SelectClauses.Count - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does lastIndex allways point to the ConditionId ? Can't the client request it in another order together with other SelectClauses?


bool canSend = passedFilter;

// ConditionId is valid only if FilteredRetain is set for the alarm condition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the ConditionId only valid if FilteredRetain is set ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is specifically for SupportsFilterRetain, so if it is not set, the remainder of the function is not required, only the filter check at the top of the function.

This is still a work in progress, I'm going to move it to draft for now.

@Archie-Miller Archie-Miller marked this pull request as draft December 20, 2024 15:57
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.

SupportsFilteredRetain support in NETStandard SDK
3 participants