-
Notifications
You must be signed in to change notification settings - Fork 91
fix: attribute loss when updating entity #1667
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
fix: attribute loss when updating entity #1667
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a commented here #1660 (comment) a test case about his issue is needed.
|
@GuillaumeOd please have a look to documentation in the case it has to change to describe the new behaviour with this PR. |
|
This PR is reverting this commit: 166f771 |
6c34980 to
d9e6fdf
Compare
|
@GuillaumeOd not sure if I'm getting the point... You want to send measures like this: and get corresponding attribute at CB this way: is my interpretation correct? |
|
@fgalan Yes, exactly! Regarding the type, I'm not entirely sure if it should be Could you try running the test locally without my fix to confirm it fails as expected? |
In that case, why don't use at provisioning time instead of ? |
|
@fgalan we already send data like this {
"fireDetectionThreshold": 10
}or by using the oid: {
"f_t": 10
}since the version 4.0 it does not work. So after the fix of @GuillaumeOd both works. Why did you change this functionnality? |
So, you mean that you have some devices that are sending like Is my understanding correct? |
|
Yes exactly. Somes use object_id and othes use the name. |
|
OK. Much clearer now :) Thanks!
It was not an intentional change (but not within our use cases, so it was not noticed by us). Thus, the PR is ok, as long as:
What do you think? |
|
Great thank you! that's work, @GuillaumeOd it's in your hands. |
|
thanks @fgalan ! I just merged master to the branch. Please notice that the test I added was failing because of a type error. The expected is:
but for some reason we receive:
Is this the normal behavior ? |
Given the provision is I guess that the correct one is
@AlvaroVega what do you think? |
I think both branch and test were aligned. |
The question is, what should be the expected payload to the test I added ? It appears that we receive a type |
It should be |
I agree, shall I investigate it by myself ? The link with my PR is unlikely but I can try to find the fix and add it to this PR |
It would be great :) |
9ed5a09 to
195ccf8
Compare
|
Hey @fgalan @AlvaroVega @tzzed, The test was failing because the payload included a field named "t" that did not match any object_id defined in the device provisioning. As a result, the IotAgent treated "t" as an untyped attribute and defaulted its type to "Text". However, the test expectation assumed "t" would be interpreted as psBatteryVoltage (with type: Number), which was provisioned with object_id: ".1.0.0.1". This mismatch caused the assertion failure. To fix it, I updated the test payload to use the correct key ".1.0.0.1" instead of "t", so the attribute is properly mapped to psBatteryVoltage with the correct type. Please tell me if the PR is ok for you now ! |
test 021B is still failing: https://github.com/telefonicaid/iotagent-node-lib/actions/runs/15710390480/job/44269756408?pr=1667#step:5:18568 |
195ccf8 to
8807019
Compare
My bad, I forgot to remove my old test. This should be fine now |
b0cad57 to
ced44b0
Compare
CHANGES_NEXT_RELEASE
Outdated
| @@ -1 +1 @@ | |||
|
|
|||
| - Fix attribute loss during device update when both name and object_id are defined by filtering only object_id (issue #1660) No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Fix attribute loss during device update when both name and object_id are defined by filtering only object_id (issue #1660) | |
| - Fix attribute loss during device update when both name and object_id are defined by filtering only object_id (#1660) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgalan is it ok for you ?
d3d7cb1 to
0dd6f8d
Compare
|
@GuillaumeOd we have checked that if the changes your have done in lib/services/ngsi/entities-NGSI-v2.js are reverted, the modified test doesn't break. Thus, the modification to the test are not capturing the fix done. Thus, we propose the following:
Maybe the content in PR #1668 may be useful regarding item 2 |
|
Overpassed by PR #1721 |
related to #1660