Skip to content

Conversation

hqpho
Copy link
Contributor

@hqpho hqpho commented Oct 3, 2025

No description provided.

Copy link

Summary of Changes

Hello @hqpho, 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 robust control mechanism for deploying feature flag changes, particularly for production environments. It introduces a new CI/CD step that leverages a bash script to enforce time-based restrictions, ensuring that critical production feature flag modifications can only be merged during designated business hours and weekdays. Additionally, it initializes environment-specific feature flag configurations, enabling a new V3 feature across various deployment stages with tailored mirror fractions.

Highlights

  • Merge Restrictions CI/CD Integration: A new Cloud Build configuration (cloudbuild.merge_test.yaml) has been added to integrate a merge restriction script into the CI/CD pipeline, specifically designed for merge queue events.
  • Production Feature Flag Guardrails: A new bash script (enforce_merge_restrictions.sh) has been implemented to prevent changes to production feature flag files from being merged outside of specific business hours (9 AM - 5 PM PT) and days (Monday - Thursday), enhancing deployment safety.
  • Environment-Specific Feature Flag Configurations: New YAML configuration files have been created for autopush, dev, prod, and staging environments. These files all enable a V3 feature and set different V3MirrorFraction values tailored to each environment.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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

@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 CI check to enforce restrictions on merging changes to production feature flags. The changes include a Cloud Build configuration and a bash script to perform the checks, along with several new feature flag configuration files. My review has identified a few critical issues in the implementation that will prevent the CI check from working as intended. Specifically, the script is called incorrectly in the Cloud Build config, and the script uses incorrect exit codes for success paths, which would cause the build to fail when it should pass. I've provided suggestions to fix these issues.

- -c
- |
set -e
./deploy/featureflags/enforce_merge_restrictions.sh

Choose a reason for hiding this comment

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

critical

The enforce_merge_restrictions.sh script is called without the required <config_dir> argument. The script's usage indicates it expects a directory path to scan for feature flag files. Based on the project structure, it seems deploy/featureflags should be passed as the argument.

        ./deploy/featureflags/enforce_merge_restrictions.sh deploy/featureflags


if [[ -z "$MODIFIED_PROD_FILES" ]]; then
echo "No modified 'prod' feature flag files found. No restrictions apply."
exit 1

Choose a reason for hiding this comment

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

critical

The script exits with status 1, which indicates failure. However, this path is taken when no production files are modified, which is a successful outcome for this check. The script should exit with status 0 to indicate success.

Suggested change
exit 1
exit 0

fi

echo "Production change is within the allowed time window. Checks passed."
exit 1

Choose a reason for hiding this comment

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

critical

The script exits with status 1, which indicates failure. This path is taken when a production change is within the allowed time window, which is a successful outcome. The script should exit with status 0 to indicate success and allow the merge to proceed.

Suggested change
exit 1
exit 0

#
# The time checks are always performed in the US Pacific Time Zone.

set -e

Choose a reason for hiding this comment

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

medium

For improved robustness, it's a good practice to validate that required environment variables like _BASE_REF are present at the start of the script. This provides a clearer error if the script is run in an unexpected environment where the variable is not set.

Suggested change
set -e
set -e
if [[ -z "${_BASE_REF}" ]]; then
echo "Error: _BASE_REF is not set. This script is intended to be run in a Google Cloud Build merge trigger." >&2
exit 1
fi

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.

1 participant