Skip to content

WIP: removing the strategy for new installations of Unleash #9800

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gastonfournier
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Apr 17, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 17, 2025 3:49pm

Copy link
Contributor

@gastonfournier, core features have been modified in this pull request. Please review carefully!

Copy link
Contributor

github-actions bot commented Apr 17, 2025

Dependency Review

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

Scanned Files

None

@@ -6,7 +6,6 @@ exports.up = function (db, cb) {
ALTER TABLE strategies ADD COLUMN sort_order integer DEFAULT 9999;
UPDATE strategies SET sort_order = 0 WHERE name = 'default';
UPDATE strategies SET sort_order = 1 WHERE name = 'flexibleRollout';
UPDATE strategies SET sort_order = 2 WHERE name = 'userWithId';
Copy link
Member

@nunogois nunogois Apr 21, 2025

Choose a reason for hiding this comment

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

I'm pretty sure we shouldn't update existing migrations and that this would silently fail if it can't find any row with name = 'userWithId', which is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Instead, we should add a new migration that removes the strategy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's intentional, that way we only affect new installations and don't change existing installations. We don't want to remove the strategy on existing installations, only if it's new.

It's true that the other migrations would not apply if you don't find the strategy due to the where filter, but it feels cleaner to remove those.

@@ -6,7 +6,6 @@ exports.up = function (db, cb) {
ALTER TABLE strategies ADD COLUMN display_name text;
UPDATE strategies SET display_name = 'Standard', description = 'The standard strategy is strictly on / off for your entire userbase.' WHERE name = 'default';
UPDATE strategies SET display_name = 'Gradual rollout', description = 'Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.' WHERE name = 'flexibleRollout';
UPDATE strategies SET display_name = 'UserIDs', description = 'Enable the feature for a specific set of userIds.' WHERE name = 'userWithId';
Copy link
Member

Choose a reason for hiding this comment

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

-- update strategy descriptions and sort order
update strategies set sort_order = 1, description = 'This strategy turns on / off for your entire userbase. Prefer using "Gradual rollout" strategy (100%=on, 0%=off).' WHERE name = 'default';
update strategies set sort_order = 0 WHERE name = 'flexibleRollout';
update strategies set description = 'Enable the feature for a specific set of userIds. Prefer using "Gradual rollout" strategy with user id constraints.' WHERE name = 'userWithId';
Copy link
Member

Choose a reason for hiding this comment

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

@@ -9,13 +9,9 @@ exports.up = function (db, callback) {
and deprecated
and not exists (select * from feature_strategies where strategy_name = name limit 1);

-- deprecate strategies on v5
update strategies set deprecated = true where name in ('userWithId');
Copy link
Member

Choose a reason for hiding this comment

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

"required": false
}
]
},
Copy link
Member

Choose a reason for hiding this comment

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

This affects an existing migration, 20170211090541-add-default-strategies.js, so same as /Users/nunogois/dev/unleash/unleash/src/migrations/20170211090541-add-default-strategies.js

@gastonfournier gastonfournier moved this from New to In Progress in Issues and PRs Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants