Skip to content

Conversation

@aepfli
Copy link
Member

@aepfli aepfli commented Nov 27, 2025

with #1797 we introduced this bug, that the format of the response is not correct.

current state:

{ 
    flagConfiguration: {/* flag object */}
}

should be:

{ 
    flagConfiguration: {
       flags: {/* flag object */}
    }
}

Clarification from @toddbaert - this is an UNRELEASED bug so far.

@aepfli aepfli requested review from a team as code owners November 27, 2025 14:11
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Nov 27, 2025
@netlify
Copy link

netlify bot commented Nov 27, 2025

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 6392628
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/69299589002fd50008e695b6

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aepfli, 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 resolves a critical bug in the flag synchronization API where the JSON response format was incorrect. Previously, flag data was directly returned without being encapsulated under a designated 'flags' key. This fix ensures that all flag data is properly nested, aligning the API's output with the expected structure and preventing potential parsing issues for consumers.

Highlights

  • Corrected Sync API Response Format: The SyncFlags and FetchAllFlags gRPC methods now correctly wrap the flag data within a flags key in the JSON response. This addresses a bug introduced in a previous PR where the flag layer was missing from the synchronization response, ensuring the output adheres to the expected format.
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.

@aepfli
Copy link
Member Author

aepfli commented Nov 27, 2025

we definitely need to get everything going for #1821 to prevent this issue in the future

Copy link
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 addresses a bug in the flag sync response format by adding a missing 'flags' layer. The changes in SyncFlags and FetchAllFlags correctly implement this fix. I've suggested a small refactoring to abstract the duplicated logic for creating this response structure into a helper function to improve code maintainability. Additionally, it's worth noting that the existing tests may not be robust enough to catch this kind of structural regression in the JSON response. Strengthening them by unmarshalling and asserting on the response structure could prevent similar issues in the future.

@aepfli aepfli force-pushed the fix/correct-format-for-return-value branch from 7ccd39b to 402a01a Compare November 27, 2025 15:15
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Nov 27, 2025
@aepfli aepfli force-pushed the fix/correct-format-for-return-value branch from bcfd5dc to 69a17a5 Compare November 27, 2025 16:02
@toddbaert
Copy link
Member

Yep, 💯 I found this late last week and was intending to open a bug as well. We need to enhance our testing to run in-process tests to find this - there's much less surface area to test with in-process mode on flagd itself (since evaluation happens in the workload) but it's required to find things like this.

Thanks!

@aepfli aepfli force-pushed the fix/correct-format-for-return-value branch from 69a17a5 to bb91ffa Compare November 28, 2025 07:47
@aepfli aepfli force-pushed the fix/correct-format-for-return-value branch from bb91ffa to 0a5755e Compare November 28, 2025 09:17
@aepfli
Copy link
Member Author

aepfli commented Nov 28, 2025

/gemini review

Copy link
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 correctly fixes a bug in the flag synchronization response format by adding the missing 'flags' layer. The changes in flagd/pkg/service/flag-sync/handler.go are appropriate. I've included a suggestion to refactor some duplicated code to improve maintainability. Additionally, this PR introduces a significant and beneficial refactoring of the integration tests, moving to a testcontainers-based setup, which is a great improvement for test reliability and isolation. I've noted one minor typo in the new test configuration.

Signed-off-by: Simon Schrottner <[email protected]>
@aepfli aepfli force-pushed the fix/correct-format-for-return-value branch from dc8a8e0 to 6392628 Compare November 28, 2025 12:28
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants