Skip to content
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

Detailed diff use minimal edit distance for list attribute diffs #2863

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

VenelinMartinov
Copy link
Contributor

@VenelinMartinov VenelinMartinov commented Jan 21, 2025

This PR uses a minimal edit distance algorithm to compute a sensible list attribute diff.

Uses https://github.com/t0yv0/godifft with a small modification.

Note that this is only done for list attributes as blocks might trigger replaces from a nested property. This matches the terraform behaviour, more details in #2295 (comment)

Alternative to #2862
fixes #2295
fixes #2239

@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Jan 21, 2025

This change is part of the following stack:

Change managed by git-spice.

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 88.46154% with 6 lines in your changes missing coverage. Please review.

Project coverage is 67.53%. Comparing base (140a0fb) to head (2527c95).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/tfbridge/detailed_diff.go 88.46% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2863      +/-   ##
==========================================
+ Coverage   67.50%   67.53%   +0.02%     
==========================================
  Files         327      327              
  Lines       41743    41792      +49     
==========================================
+ Hits        28180    28224      +44     
- Misses      11977    11982       +5     
  Partials     1586     1586              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@t0yv0
Copy link
Member

t0yv0 commented Jan 21, 2025

What is the small modification can you add it for review please?

Base automatically changed from vvm/sdkv2_diff_computed_tests to master January 22, 2025 13:16
@VenelinMartinov
Copy link
Contributor Author

Here is the godifft modification: t0yv0/godifft@main...VenelinMartinov:godifft:main

I've exposed the indices of the changes so that we can use these directly instead of having to match them back to the inputs.

@VenelinMartinov VenelinMartinov force-pushed the vvm/detailed_diff_lists_minimal_edit_distance branch from 9eb5075 to 78de7f4 Compare January 22, 2025 15:43
@VenelinMartinov VenelinMartinov force-pushed the vvm/detailed_diff_lists_minimal_edit_distance branch from 5beda21 to 32e3548 Compare January 24, 2025 16:42
@VenelinMartinov VenelinMartinov requested a review from t0yv0 January 24, 2025 16:44
@t0yv0 t0yv0 self-requested a review January 27, 2025 15:50
Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be good enough. Let's try it.

@VenelinMartinov VenelinMartinov enabled auto-merge (squash) January 27, 2025 17:54
@VenelinMartinov VenelinMartinov merged commit 93de27b into master Jan 27, 2025
71 checks passed
@VenelinMartinov VenelinMartinov deleted the vvm/detailed_diff_lists_minimal_edit_distance branch January 27, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants