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

fixed segments not being copied #2105

Merged
merged 17 commits into from Oct 10, 2022

Conversation

andreas-unleash
Copy link
Contributor

@andreas-unleash andreas-unleash commented Sep 28, 2022

Currently when you tried to copy a strategy (or all strategies) from one env to another, the segments where not being copied as expected.

This PR fixes the bug by adding an optional copyOf parameter in the CreateFeatureStrategy schema, so that the handling of copying the segments over is moved to the backend

The need for handling this this way was created by the desired functionality of copying all strategies from one env to another

About the changes

Closes # .

Important files

Discussion points

@vercel
Copy link

vercel bot commented Sep 28, 2022

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

Name Status Preview Updated
unleash-docs ✅ Ready (Inspect) Visit Preview Oct 7, 2022 at 11:06AM (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview Oct 7, 2022 at 11:06AM (UTC)

# Conflicts:
#	src/lib/__snapshots__/create-config.test.ts.snap
@andreas-unleash andreas-unleash marked this pull request as ready for review September 29, 2022 09:00
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

Would like a test to see that we return the expected data on the features call

@@ -70,6 +71,8 @@ export class PublicInviteController extends Controller {
openApiService.validPath({
tags: ['Public signup tokens'],
operationId: 'addPublicSignupTokenUser',
summary:
Copy link
Contributor

Choose a reason for hiding this comment

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

Unsure if the schema updates for public-invite belongs in this PR. Fine for now, but we should aim to separate PR concerns in the future

Comment on lines +730 to +735
if (segments && segments.length > 0) {
result = {
...result,
segments: segments.map((segment) => segment.id),
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a test that validates that this gives the correct result?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, if there are no segments defined, should we return an empty array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@andreas-unleash It seems this is not reflected in the specification, at least I can't see a spec update for this data structure.

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LG

@andreas-unleash andreas-unleash merged commit 64b8df7 into main Oct 10, 2022
@andreas-unleash andreas-unleash deleted the fix/segments_not_copied_with_strategy branch October 10, 2022 12:32
sighphyre pushed a commit that referenced this pull request Oct 13, 2022
* fixed segments not being copied

* fix fmt

* bug fix

* return segmentId[] when getting a feature strategy

* do not return segments if they are not there

* Update src/lib/services/feature-toggle-service.ts

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* fix lint

* fix: more explicit column sorting and bug fix

* update snapshot

* rollback

* add segment ids to feature strategies

* bug fix

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
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.

None yet

2 participants