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

ephemeral: render write-only attributes in plan UI #36187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Dec 10, 2024

Fixes TF-18619

Target Release

1.11.x

Draft CHANGELOG entry

NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS

@DanielMSchmidt DanielMSchmidt force-pushed the TF-18617 branch 2 times, most recently from aee7e70 to 3a962e8 Compare December 12, 2024 09:56
Base automatically changed from TF-18617 to main December 12, 2024 14:59
@DanielMSchmidt DanielMSchmidt force-pushed the TF-18619 branch 2 times, most recently from cf0e19e to 8586fb6 Compare December 12, 2024 16:06
@DanielMSchmidt DanielMSchmidt marked this pull request as ready for review December 13, 2024 08:22
@DanielMSchmidt DanielMSchmidt requested a review from a team as a code owner December 13, 2024 08:22
Copy link
Member

@liamcervante liamcervante left a comment

Choose a reason for hiding this comment

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

Looks fine, I just think I figured out a way to avoid the double computation of the block action which just saves us some cycles.

@@ -28,6 +28,7 @@ func ComputeDiffForBlock(change structured.Change, block *jsonprovider.Block) co
current := change.GetDefaultActionForIteration()

blockValue := change.AsMap()
blockAction := change.CalculateAction()
Copy link
Member

@liamcervante liamcervante Dec 13, 2024

Choose a reason for hiding this comment

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

I should have noticed this before, sorry! This does an internal reflect.DeepEqual, which means we're essentially doing quite a lot of work on large diffs twice now (as the ComputeDiffForBlock function does go on to attempt to perform a deep analysis of the change again.

I wonder if you could make a list / map / slice of write only attributes as you discover them, then at the end of the function when the change for the overall block has been calculated naturally add them in at that point?

Copy link
Member

Choose a reason for hiding this comment

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

See at line 118, you can use current at that point to know what the change is properly, and just call computeDiffForWriteOnlyAttribute directly with the known write only diffs. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants