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: pass e2e unleash experiments as a header to Metaphysics #13557

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Server/middleware/featureFlagMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ export function featureFlagMiddleware(serviceType: symbol) {
}
}, {})

const e2eFeatureFlags = Object.fromEntries(
Object.entries(featureFlags).filter(
([key, value]) => key.startsWith("e2e_") && value.flagEnabled
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Despite what we proposed in the tech plan, this recommends hyphenating feature names so maybe we should align with that.


updateSharifyAndContext(res, "FEATURE_FLAGS", featureFlags)
updateSharifyAndContext(res, "E2E_FEATURE_FLAGS", e2eFeatureFlags)

next()
})
Expand Down
6 changes: 6 additions & 0 deletions src/System/Relay/createRelaySSREnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ export function createRelaySSREnvironment(config: Config = {}) {
logger.warn("Browser does not support i18n API, not setting TZ header.")
}

const e2eFeatureFlags = getENV("E2E_FEATURE_FLAGS")

if (e2eFeatureFlags) {
headers["X-Variants"] = JSON.stringify(e2eFeatureFlags)
}

const authenticatedHeaders = !!user
? {
...headers,
Expand Down
1 change: 1 addition & 0 deletions src/Typings/sharify.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ declare module "sharify" {
CSRF_TOKEN: string
CURRENT_PATH: string
CURRENT_USER: User
E2E_FEATURE_FLAGS: any
EIGEN: boolean
ENABLE_CONVERSATIONS_MESSAGES_AUTO_REFRESH: boolean
ENABLE_I18N_DEBUG: boolean
Expand Down