go-sdk-contrib icon indicating copy to clipboard operation
go-sdk-contrib copied to clipboard

feat(flagd): Fix in-process provider to use FLAGD_SYNC_PORT for configuration

Open Copilot opened this issue 1 month ago • 4 comments

  • [x] Add FLAGD_SYNC_PORT environment variable constant
  • [x] Update updateFromEnvVar() to read FLAGD_SYNC_PORT first, then fallback to FLAGD_PORT for backwards compatibility
  • [x] Update README documentation to reflect the environment variable changes
  • [x] Add unit tests for the new FLAGD_SYNC_PORT functionality
  • [x] Run existing tests to ensure no regressions
  • [x] Run code review and security checks
  • [x] 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

  • Parent: https://github.com/open-feature/flagd/issues/1573
  • Testbed: https://github.com/open-feature/flagd-testbed/issues/266</issue_description>

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

  • Fixes open-feature/go-sdk-contrib#788

💡 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 avatar Nov 27 '25 08:11 Copilot

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

aepfli avatar Nov 27 '25 09:11 aepfli

@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 avatar Nov 27 '25 09:11 Copilot

/gemini review

aepfli avatar Nov 27 '25 09:11 aepfli

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

erka avatar Nov 27 '25 13:11 erka

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

aepfli avatar Nov 27 '25 13:11 aepfli

@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)

aepfli avatar Nov 28 '25 10:11 aepfli