Skip to content

Add new feature flag for v2 API changes#6153

Merged
juliawu merged 4 commits intodatacommonsorg:masterfrom
juliawu:v2-feature-flag
Mar 31, 2026
Merged

Add new feature flag for v2 API changes#6153
juliawu merged 4 commits intodatacommonsorg:masterfrom
juliawu:v2-feature-flag

Conversation

@juliawu
Copy link
Copy Markdown
Contributor

@juliawu juliawu commented Mar 31, 2026

Adds a new feature flag use_v2_api to gate frontend changes for the v0/v1 migration.

We'll enable the flag in subsequent PRs. Note that following the create_feature_flags.sh script, we have not added the feature flag to the prod environment yet. We will add it in a separate PR when we are ready to deploy changes to prod.

@juliawu juliawu marked this pull request as ready for review March 31, 2026 03:40
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a new feature flag to gate upcoming frontend changes related to the v2 API migration. By centralizing this configuration across different environments, the team can safely roll out and test new API integrations without impacting production or stable environments.

Highlights

  • New Feature Flag: Introduced the use_v2_api feature flag to manage the migration from v0/v1 to v2 APIs.
  • Environment Configuration: Configured the flag to be enabled by default in local, autopush, and dev environments, while keeping it disabled in prod, custom, and staging.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new feature flag, use_v2_api, across multiple environment configuration files, enabling it for autopush, dev, and local environments while keeping it disabled for custom and staging. Feedback suggests refining the flag's description to clarify its focus on frontend migration and recommends defining a backend constant for the flag to ensure consistency. Additionally, the reviewer noted that the production configuration file is missing from the PR despite being referenced in the description.

Comment on lines +87 to +90
"name": "use_v2_api",
"enabled": true,
"owner": "juliawu",
"description": "Enables features that rely on the V2 REST APIs"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To maintain consistency with the existing feature flag implementation and improve clarity, please consider the following:

  1. Add a constant: Define a constant for this flag in server/lib/feature_flags.py (e.g., USE_V2_API_FEATURE_FLAG = 'use_v2_api') to avoid using hardcoded strings when checking the flag in the backend.
  2. Specific Description: The current description is quite broad. Since this flag is specifically for gating frontend changes during the v0/v1 migration, updating the description to reflect this will help avoid confusion with existing V2 API usage in the codebase.
Suggested change
"name": "use_v2_api",
"enabled": true,
"owner": "juliawu",
"description": "Enables features that rely on the V2 REST APIs"
"name": "use_v2_api",
"enabled": true,
"owner": "juliawu",
"description": "Enables frontend features migrating to V2 REST APIs"

"description": "Enables standardized visualization tool UI for the /tool/map, /tool/scatter, and /tool/timeline pages"
},
{
"name": "use_v2_api",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The pull request description states that this flag should be disabled for the prod environment. However, server/config/feature_flag_configs/prod.json is not included in this PR.

While the feature flag system defaults to false if a key is missing, it is best practice to explicitly define the flag in all environment configurations for better visibility and maintainability.

},
{
"name": "use_v2_api",
"enabled": true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The flags dont exist today, so they arent connected to anything.

I think you should set it all to False. Then put up the PR where you set the flag in the code, and then enable it where it needs to be enabled.

It ll be more explicit that way and we will be able to approve the enablements based on what the flag controls. Since we dont know exactly what the flag is going to control today, it makes it uncertain how the default should apply.

Note rolling out flags takes seconds :) More tiny PRs isnt a bad thing!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

I switched everything to False, and we'll enable as we add features in subsequent PRs.

@juliawu juliawu enabled auto-merge (squash) March 31, 2026 16:20
@juliawu juliawu merged commit ff6cd72 into datacommonsorg:master Mar 31, 2026
13 checks passed
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.

3 participants