-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add associated document id field to ChangeMeta #33807
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.
If you're concerned about the rollback issue there are a few options:
- Set
_allow_dynamic_properties
toTrue
onChangeMeta
- Override
ChangeMeta.wrap
to cache wrapping exceptions and retry with the new key removed.
Thanks for this. This seems like a good approach. Do we think there's a good reason to keep |
Yes, that's correct. I don't see a reason to keep it strict. |
I've merged a new PR into master that lets |
Product Description
Technical Summary
Associated ticket: https://dimagi-dev.atlassian.net/browse/SAAS-15054.
This adds an associated_document_id to all
ChangeMeta
objects that allows us to link case changes to the forms that triggered them. It is meant to be somewhat generic, becauseChangeMeta
is used by more than just cases.Note that this PR is difficult to roll back -- while existing kafka changes will simply send a
None
value for the new field, if this change were to be reverted, anything with a setassociated_document_id
would fail to wrap into aChangeMeta
.For this reason, I've isolated just this field change to this PR, and intend to create a separate PR for moving the duplication logic between processors.
Safety Assurance
Safety story
Verified through local testing that the additional field is added and processed correctly. Also verified that changes without the field will be processed without issue with this change. This specific change shouldn't introduce any significant overhead, as we're only slightly expanding the size of a
ChangeMeta
. The potential performance impact would mainly be from using theassociated_document_id
to fetch forms within the case processor.Automated test coverage
Did not feel tests were needed here, but perhaps there's an argument for creating tests that verify kafka changes can still be wrapped with the new field?
QA Plan
No QA planned
Rollback instructions
Rollback of this PR would be difficult, because any changes published with this change will fail to be wrapped to the previous version of
ChangeMeta
. I think if we really wanted to force a revert and did not want to lose data, we'd need to create a custom wrap function forChangeMeta
that ignored theassociated_document_id
field.Labels & Review