fix: explicity set updated_at field when updating identity #4131
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.
Problem
The updated_at field in the identities table is not being updated when an identity's traits are modified. This is unexpected behavior because the pop library should automatically update the
updated_at
field when a record is modified.However, in the current implementation, the identity is being saved with the old
updated_at
timestamp, which causes the pop library to skip updating this field. As a result, theupdated_at
field does not reflect recent changes, which can lead to issues with auditing, synchronization, or downstream systems relying on the correct timestamps for updated data.Cause
The issue arises because the existing code inadvertently preserves the previous updated_at value during the update operation. When saving the identity, the pop library sees that the field is already set and, as a result, does not overwrite it with the current timestamp.
Solution
This PR explicitly sets the
updated_at
field when updating an identity. By ensuring the field is updated within the code, we force the correct behavior, even if the underlying pop library does not update the field automatically.Steps to manually reproduce:
updated_at
field in the identities table to confirm that it reflects the recent update.Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments