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

Duplicate countries to be in lowercase for x-country header update. #1284

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

goodov
Copy link
Member

@goodov goodov commented Dec 18, 2024

List countries both in upper and lowercase so we can safely update server to use lowercase value in x-country header.

Related devops issue https://github.com/brave/devops/issues/12890

@goodov goodov requested a review from a team as a code owner December 18, 2024 11:06
Copy link
Contributor

github-actions bot commented Dec 18, 2024

✅ Test Seed Generated Successfully

To apply the test seed:

  1. Desktop: Launch the browser with --variations-pr=1284.
    Android: Set the command line to --variations-pr=1284 in debug menu, restart the browser.
    iOS: Set Variations PR to 1284 in Brave Core Switches debug menu, restart the browser.
  2. Wait 5-10 seconds to fetch the seed.
  3. Restart the browser to apply the seed.
  4. Ensure Active Variations section at brave://version starts with the expected seed version (see below).

Seed Details

Parameter Value
Version pull/1284@496d6297abf6d8a755d7428a21ccadd8d9ef3457
Uploaded Wed, 18 Dec 2024 13:06:10 GMT
PR commit 480bd97
Base commit 3a09998
Merge commit 496d629
Serial number da0997b6c4d2f3a98f3aa57e35ff168a

@goodov goodov requested a review from atuchin-m December 18, 2024 11:11
@goodov goodov force-pushed the lowercase-countries branch from 3b150fb to aed9284 Compare December 18, 2024 12:55
@goodov goodov requested a review from a team as a code owner December 18, 2024 12:55
@goodov goodov removed the request for review from a team December 18, 2024 12:56
@goodov goodov force-pushed the lowercase-countries branch 2 times, most recently from 480bd97 to f622be2 Compare December 18, 2024 13:06
@goodov goodov added the generate-seed Generate test seed even if it's not changed label Dec 18, 2024
@goodov goodov force-pushed the lowercase-countries branch from f622be2 to 90e608e Compare December 18, 2024 13:11
@goodov goodov added generate-seed Generate test seed even if it's not changed and removed generate-seed Generate test seed even if it's not changed labels Dec 18, 2024
@goodov goodov force-pushed the lowercase-countries branch from 90e608e to 951850d Compare December 18, 2024 13:13
@goodov goodov removed the generate-seed Generate test seed even if it's not changed label Dec 18, 2024
@goodov goodov force-pushed the lowercase-countries branch from 951850d to 5eb4851 Compare December 18, 2024 13:17
// check if country in uppercase also exists in lowercase
const checkCountriesCase = (countries: string[]) => {
const countrySet = new Set(countries);
for (const country of countries) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: countries.forEach((country) => {...})

Copy link
Member Author

Choose a reason for hiding this comment

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

seems like a style preference to me. I prefer the usual for (...) {} syntax similar to what we have in C++ codebase in Chromium.


function duplicateCountriesAsLowercase(variationsSeed: VariationsSeed) {
// For now duplicate the country filters to lowercase.
const duplicate = (countries: string[]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about Array.from(new Set([...countries, ...countries.map((c) => c.toLowerCase())]))?

Copy link
Member Author

Choose a reason for hiding this comment

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

this will change the order of countries

Copy link
Collaborator

@atuchin-m atuchin-m left a comment

Choose a reason for hiding this comment

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

LGTM with a few nits.

@goodov goodov added this pull request to the merge queue Jan 9, 2025
Merged via the queue into main with commit 04e6ed4 Jan 9, 2025
5 checks passed
@goodov goodov deleted the lowercase-countries branch January 9, 2025 07:42
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.

2 participants