tests: add change-tracking tests for embedded attributes#2166
Merged
zachdaniel merged 1 commit intoash-project:mainfrom Jun 26, 2025
Conversation
These tests check that change-tracking in changesets works as expected for changes to attributes that are embedded resources.
rellen
commented
Jun 26, 2025
Comment on lines
+682
to
+684
| {_result, notifications} = Ash.update!(changeset, return_notifications?: true) | ||
|
|
||
| assert List.first(notifications).changeset.context[:changed?] == false |
Contributor
Author
There was a problem hiding this comment.
Is this an acceptable way to get access to the changeset after the change has been executed?
Another way could be to add an after_action hook to send a message with the changeset back to the test process.
Contributor
There was a problem hiding this comment.
Hmm...yeah, I think the latter would be the preferred way in this scenario. I don't want to necessarily lean on the notification.changeset particulars
Contributor
There was a problem hiding this comment.
I think it might also be good to assert on the creation or non-creation of versions as that is the primary use case we're concerned with here. However, that can be done in addition to what's already been done, so I'll merge this.
zachdaniel
approved these changes
Jun 26, 2025
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These tests check that change-tracking in changesets works as expected for changes to attributes that are embedded resources.
We are tracking down a strange bug somewhere in Ash or AshPaperTrail, and these tests imply that the issue is not in Ash, but thought it would be worthwhile to add them to the test suite.
Contributor checklist
Leave anything that you believe does not apply unchecked.