Skip to content

Conversation

Copy link

Copilot AI commented Nov 27, 2025

  • Add FLAGD_SYNC_PORT environment variable constant
  • Update updateFromEnvVar() to read FLAGD_SYNC_PORT first, then fallback to FLAGD_PORT for backwards compatibility
  • Update README documentation to reflect the environment variable changes
  • Add unit tests for the new FLAGD_SYNC_PORT functionality
  • Run existing tests to ensure no regressions
  • Run code review and security checks
  • Revert unintentional go.mod and go.sum changes
Original prompt

This section details on the original issue you should resolve

<issue_title>[flagd] Fix in-process provider to use FLAGD_SYNC_PORT (not FLAGD_PORT) for port configuration (backwards compatibility)</issue_title>
<issue_description>## Background

Recent updates to flagd and related tests in flagd-testbed clarified the use of environment variables for ports:

  • FLAGD_PORT is for remote/server mode.
  • FLAGD_SYNC_PORT should be used for in-process/sync providers.

Currently, the in-process provider uses the wrong environment variable (FLAGD_PORT).

Required Changes

  • Fix provider configuration logic to use FLAGD_SYNC_PORT for in-process provider setups, and fall back to FLAGD_PORT for backwards compatibility.
  • Update any relevant documentation and configuration references.
  • Ensure test coverage, ideally using scenarios matching those in flagd-testbed (with @legacy-sync-port tag for backwards compatibility coverage).

References

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI requested a review from aepfli November 27, 2025 09:11
@aepfli aepfli changed the title [WIP] Fix in-process provider to use FLAGD_SYNC_PORT for configuration feat(flagd): Fix in-process provider to use FLAGD_SYNC_PORT for configuration Nov 27, 2025
@aepfli
Copy link
Member

aepfli commented Nov 27, 2025

@copilot please revert all your go.mod and go.sum updates, there is no need to do this within this pullrequest

@aepfli aepfli marked this pull request as ready for review November 27, 2025 09:22
@aepfli aepfli requested review from a team as code owners November 27, 2025 09:22
Copy link
Author

Copilot AI commented Nov 27, 2025

@copilot please revert all your go.mod and go.sum updates, there is no need to do this within this pullrequest

Reverted all go.mod and go.sum changes in 5f67528.

Copilot finished work on behalf of aepfli November 27, 2025 09:25
@aepfli
Copy link
Member

aepfli commented Nov 27, 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 implements the use of FLAGD_SYNC_PORT for the in-process provider, with a fallback to FLAGD_PORT for backward compatibility. The changes are well-documented in the README, and the new logic is thoroughly covered by unit tests.

I have one suggestion to refactor the new updatePortFromEnvVar function in providers/flagd/pkg/configuration.go to make it more concise and improve maintainability. The rest of the changes look good.

Removed duplicate variable declarations for portS and envVarName.

Signed-off-by: Simon Schrottner <[email protected]>
@erka
Copy link
Member

erka commented Nov 27, 2025

@aepfli Could you please change the PR and issue title? feat(..) Fix... doesn't sound right and doesn't explain the change very well.

Copy link
Member

@erka erka left a comment

Choose a reason for hiding this comment

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

it would be better to use table driven tests here.

@aepfli
Copy link
Member

aepfli commented Nov 27, 2025

I will update the repo, we actually do have gherkin tests in the testbed, and this test by copilot is not needed.

@toddbaert toddbaert requested a review from erka November 27, 2025 14:39
@aepfli aepfli changed the title feat(flagd): Fix in-process provider to use FLAGD_SYNC_PORT for configuration fix(flagd): Fix in-process provider to use FLAGD_SYNC_PORT for configuration Nov 27, 2025
@erka erka changed the title fix(flagd): Fix in-process provider to use FLAGD_SYNC_PORT for configuration feat(flagd): Configure in-process provider using FLAGD_SYNC_PORT environment variable Nov 27, 2025
@aepfli
Copy link
Member

aepfli commented Nov 28, 2025

@erka i removed the test generated by copilot - and added the gherkin testsuite tests for this kind of action - which was good because it catched issues in the gherkin files, and in the implementation (as we did not know which resolver we are in, at the previous implementation)

{
name: "RPC",
tags: "@rpc",
tags: "@rpc && ~@forbidden",
Copy link
Member

Choose a reason for hiding this comment

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

this relates to the fatalstatuscodes, which are currently also another open pr

@aepfli aepfli force-pushed the copilot/fix-in-process-provider-port branch from 0b73dbf to 1359170 Compare November 28, 2025 11:33
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.

[flagd] Fix in-process provider to use FLAGD_SYNC_PORT (not FLAGD_PORT) for port configuration (backwards compatibility)