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

feat: Change request applied diff for update strategy #8859

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Nov 26, 2024

About the changes

Show correct title diff and payload diff (e.g. rollout %) when change request is applied
Screenshot 2024-11-26 at 10 01 58

Previously we were always comparing title and payload against the current strategy. But after the strategy is applied there's no diff anymore. What's more when the strategy is updated in future we're diffing against a future value. This PR always looks at the snapshot for change request when the change request is applied.
I added tests showing both cases in detail.

There will be another PR in the backend to take a snapshot when the CR is being applied.

Also we should add snapshots for deleted strategies since so that we can show diffs for them after applying CRs.
Update: added delete strategies improvements and extract method refactor in this PR

Important files

Discussion points

Copy link

vercel bot commented Nov 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 10:56am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Nov 27, 2024 10:56am

Copy link
Contributor

github-actions bot commented Nov 26, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@kwasniew kwasniew changed the title feat: Change request applied diff feat: Change request applied diff for update strategy Nov 26, 2024
@@ -1,5 +1,5 @@
import type React from 'react';
import type { VFC, FC, ReactNode } from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

VFC is deprecated

currentStrategy: IFeatureStrategy | undefined;
actions?: ReactNode;
}> = ({ change, changeRequestState, currentStrategy, actions }) => {
const name =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

extracted DeleteStrategy component so that we can do the ifs checks outside of the inline calls

currentStrategy: IFeatureStrategy | undefined;
actions?: ReactNode;
}> = ({ change, changeRequestState, currentStrategy, actions }) => {
const hasVariantDiff = hasDiff(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

extracted component can have display data calculation outside of the inline calls

@@ -185,139 +326,35 @@ export const StrategyChange: VFC<{
<div>{actions}</div>
</ChangeItemCreateEditDeleteWrapper>
<StrategyExecution strategy={change.payload} />
<ConditionallyRender
condition={hasVariantDiff}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for add strategy diff checking doesn't make sense

@@ -80,29 +78,32 @@ const Truncated = styled('div')(() => ({
}));

export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({
change,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was unnecessary coupling

@@ -80,29 +78,32 @@ const Truncated = styled('div')(() => ({
}));

export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({
change,
name,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

strategy name and title passing give us more flexibility in caller code (can select current live strategy vs snapshot depending on CR state)

};

type ChangeRequestDeleteStrategy = {
id: string;
name: string;
name?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for applied change requests this one is never provided

@kwasniew kwasniew merged commit 570f8d2 into main Nov 27, 2024
10 of 11 checks passed
@kwasniew kwasniew deleted the change-request-applied-diff branch November 27, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants