-
Notifications
You must be signed in to change notification settings - Fork 11
Fix merge of spine data types when messages arrive with unset identifiers #52
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
base: dev
Are you sure you want to change the base?
Conversation
… with unset/nil fields tagged "key"
When no filter is provided list data is updated as full notify/write (simply set new data).
|
We discussed this, and decided on a couple of TODOs to make this PR better:
Some work on these points has already been done and I'll update the PR with the changes soon |
Specifically: - Include type of function data in log messages when function data update is rejected because of invalid data - Evaluate how to handle list data updates item by item (merge or copy to all existing) - If a there is a single invalid item (some but not all identifiers set) in new data reject the whole list - Added tests to update_test.go which test behaviour when there is an invalid item in list, or there are items with all and no identifiers mixed in one list.
The Github action should use Go v1.22 as the go.mod also requires v1.22 as a minimum.
|
So I just found a device that sends the following message: This would fail with this PR as not all list entries have all identifiers set (only the first measurement has both measurementId and valueType set).
I'm not entirely sure how we want to handle this, but I think we might need the ability to differentiate between mandatory identifiers and optional identifiers. I'm going to put more work into this PR in that direction, but I'm open to any comments or great ideas in this regard. |
|
The SPINE message is not a partial message. So it should overwrite the complete existing data and no merge may happen. |
|
With the integration of #66 this PR should be obsolete. Would you agree? If so, we could close it. |
When a device sends e.g. a measurementListData response containing incomplete identifiers, and then sends a second measurementListData response containing complete identifiers the data from the second response is not correctly merged with the first response and queries to measurements by ID will always return the value of the first incomplete response and will never update to later values.
Our current approach implemented in this PR is to reject (negative acknowledgement) spine updates containing incomplete identifiers because to my knowledge devices really shouldn't be sending spine messages with incomplete identifiers (and to preclude needing to write a general merge function for generic spine data with potentially incomplete identifiers).
Commit bd9e7c8 adds a (initially failing) test for this scenario to help in reproduction and I've attached trace logs of this scenario happening on a real system below:
The identifiers in this case being the measurementId and the valueType, the first message only contains the measurementId while the second message contains both measerumentId and valueType. In the merge function the checked identifier for the first message is e.g. "4" while the checked identifier for the second message would be "4|value".
End result of this is that functions (such as in the eebus-go usecases) querying data receive multiple values for the same measurementId and have no way of identifying which of those should be correct.
This PR is in Draft state because I still wanted to test with the device producing this data how it responds to receiving a negative acknowledgement on the initial write with incomplete identifiers, and in case I might be missing something.