-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Full diff change tracking mode #18
Full diff change tracking mode #18
Conversation
We should implement the behavior for all built in types but also add a callback that can be implemented by custom types to control how they diff. This looks awesome! |
One thing to consider is that we may want to capture the input to each action (attributes/arguments) unchanged too. I.e "they provided X, the changes were Y". This is probably independent of this specific work. |
Good ideas. I will an add an issue for both, plus I a way to set the change_tracking_mode to be an mfa for custom diffing. |
* main: fix: Honour upstream attribute constraints. (ash-project#31) chore: update deps, add .tool-versions chore: resolve more CI issues chore: update all of our deps chore: update credo/check & fix credo issues ci: add CI.
@zachdaniel this is feature complete and well tested. I'm going to start running it production on my app. No need to merge immediately. If this is too much code specific to my use case, I can make the |
Looks pretty slick! Happy to have it built in, especially since it is opt in. A few CI related things to address and then we can get it in. |
Adds a new
full_diff
change tracking mode. The goal is to get a full diff that is human readable, relatively easy to render in a UI, and contains enough data that a revert and undo action could be implemented in the future.Changes look like:
All attributes are dumped with the dump_embedded_value, except (ironically) embedded resources.
Embedded resources are marked as created/updated/destroyed/unchanged
Arrays of embedded resources have an index change. Items in arrays move when simple types have the same value or embedded resources are updated.
Union objects work as well and can change type.
Embedded Union objects are created/updated/destroyed and can be mixed with non-embedded types
You can even have arrays of unions moving. See the
full_diff_test.exs
for complete coverage.