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

PIN-5931: added SH feature flag and whitelist #1369

Merged
merged 12 commits into from
Feb 3, 2025

Conversation

borgesis95
Copy link
Contributor

This PR allow to add feature flag to enable SH checks and whitelist in order to give chance to selected organization to test signal-hub platform.

@borgesis95 borgesis95 marked this pull request as ready for review January 14, 2025 16:41
@ecamellini
Copy link
Collaborator

I'm also adding @sandrotaje and @MalpenZibo as reviewers since they joined the feature flag discussion

Comment on lines 456 to 459
isSignalHubEnabled: checkSignalhubFeatureFlag(
authData.organizationId,
seed.isSignalHubEnabled
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if we disable the feature flag on an environment (after its activation) or if we remove an organization from the whitelist? The service could maintain this flag to true.

We should decide if it's possible to disable a feature flag and what happen to the persisted data in that case

Copy link
Collaborator

Choose a reason for hiding this comment

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

on this topic. We should probably apply changes to models and persistent data in an agnostic way respect the feature flag (using optional and default values).
Maybe we could organize a meeting to decide on a common strategy

@borgesis95 borgesis95 requested a review from MalpenZibo January 15, 2025 17:00
packages/catalog-process/src/config/config.ts Outdated Show resolved Hide resolved
@@ -16,8 +16,18 @@ const CatalogProcessConfig = CommonHTTPServiceConfig.and(ReadModelDbConfig)
.object({
ESERVICE_DOCUMENTS_PATH: z.string(),
PRODUCER_ALLOWED_ORIGINS: z.string(),
FEATURE_FLAG_SIGNALHUB_WHITELIST: z
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to create a new config in common for feature flags, so every service can use the same flag.

Plus, feature flags could be optional and default to false. In my mind the idea is to enable only the ones needed, when needed.
No strong opinions, let me know your thoughts

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm afraid to make the feature flag an optional value (with a default false) but I don't have an example of a situation where this behavior could cause problems.
I had to think about it

packages/catalog-process/src/services/catalogService.ts Outdated Show resolved Hide resolved
authData.organizationId,
seed.isSignalHubEnabled
)
: seed.isSignalHubEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the fallback be false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if FEATURE_FLAG_SIGNALHUB_WHITELIST = false it means that hasn't to check WHITELIST so that value will be what has been set from UI (seed.isSignalHubEnabled). Maybe could result a bit tricky due to name of isSignalhubEnabled variable that hasn't not to do with FEATURE_FLAG_SIGNALHUB

Comment on lines 19 to 21
FEATURE_FLAG_SIGNALHUB_WHITELIST: z
.enum(["true", "false"])
.transform((value) => value === "true"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
FEATURE_FLAG_SIGNALHUB_WHITELIST: z
.enum(["true", "false"])
.transform((value) => value === "true"),
FEATURE_FLAG_SIGNALHUB_WHITELIST: z
.enum(["true", "false"])
.default("false")
.transform((value) => value === "true"),

As suggested by @galales we should set a default in case the env variable is not set and I also agree to define dedicated featureFlags configs, you could do it like this maybe by creating a new file featureFlags that we will use to define all the flags' configs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved FEATURE_FLAG_SIGNALHUB_WHITELIST on dedicated file, however I let SIGNALHUB_WHITELIST var on catalog-process config file. I think that whitelist is closely related to catalog-process. Let me know what you think about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Moved FEATURE_FLAG_SIGNALHUB_WHITELIST on dedicated file, however I let SIGNALHUB_WHITELIST var on catalog-process config file. I think that whitelist is closely related to catalog-process. Let me know what you think about it.

I think that it should be included inside the dedicated config since that variable is strictly related to FEATURE_FLAG_SIGNALHUB_WHITELIST, so these should be together IMHO.

Even if, for now, this config is used only in the catalog-process having all the featureFlags configs in commons would be easier for future development

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you've convinced me! moved var into feature flag config file 👍

@beetlecrunch beetlecrunch merged commit 9fd0fe7 into main Feb 3, 2025
45 checks passed
@beetlecrunch beetlecrunch deleted the PIN-5931_added_whitelist_sh branch February 3, 2025 09:56
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.

7 participants