Skip to content

fix(sync): synchronize readiness state#2006

Merged
toddbaert merged 1 commit into
open-feature:mainfrom
Baltsat:fix/2004-synchronize-readiness-state
Jul 27, 2026
Merged

fix(sync): synchronize readiness state#2006
toddbaert merged 1 commit into
open-feature:mainfrom
Baltsat:fix/2004-synchronize-readiness-state

Conversation

@Baltsat

@Baltsat Baltsat commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This PR

Related Issues

Fixes #2004

Notes

The issue's blob item is already synchronized by #1991, so this PR leaves it unchanged.

How to test

  • cd core && go test -race -short ./pkg/sync/grpc ./pkg/sync/http
  • cd core && go test -race -count=3 -run "TestIsReadyRaceFreeDuring" ./pkg/sync/grpc ./pkg/sync/http
  • cd core && go vet ./...
  • cd core && go test -short ./...
  • git diff --check

Copilot AI review requested due to automatic review settings July 25, 2026 13:48
@Baltsat
Baltsat requested review from a team as code owners July 25, 2026 13:48
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 25, 2026
@netlify

netlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit e67f001
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6a67584706e10600088a3005

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df06f2e6-9bf1-4d7e-af18-584e753de4f6

📥 Commits

Reviewing files that changed from the base of the PR and between 30ef582 and e67f001.

📒 Files selected for processing (4)
  • core/pkg/sync/grpc/grpc_sync.go
  • core/pkg/sync/grpc/grpc_sync_test.go
  • core/pkg/sync/http/http_sync.go
  • core/pkg/sync/http/http_sync_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • core/pkg/sync/http/http_sync.go
  • core/pkg/sync/grpc/grpc_sync_test.go
  • core/pkg/sync/http/http_sync_test.go

📝 Walkthrough

Walkthrough

The gRPC and HTTP sync implementations now use atomic readiness flags. New concurrency tests exercise readiness checks during startup, and HTTP tests update callbacks to use *Sync.

Changes

Sync readiness concurrency

Layer / File(s) Summary
gRPC atomic readiness
core/pkg/sync/grpc/grpc_sync.go, core/pkg/sync/grpc/grpc_sync_test.go
The gRPC readiness flag now uses atomic.Bool, with concurrent stream-start coverage and an EOF client stub.
HTTP atomic readiness and test updates
core/pkg/sync/http/http_sync.go, core/pkg/sync/http/http_sync_test.go
The HTTP readiness flag now uses atomic operations, startup concurrency is tested, and response callbacks receive *Sync.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: toddbaert, anxkhn

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making sync readiness state concurrent-safe.
Description check ✅ Passed The description matches the code changes and mentions the atomic.Bool race fix and tests.
Linked Issues check ✅ Passed The PR fixes the unsynchronized ready reads/writes in gRPC and HTTP, and leaves blob unchanged as noted in #1991.
Out of Scope Changes check ✅ Passed The added tests and minor formatting updates support the readiness race fix and stay within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Use atomic readiness state for gRPC and HTTP sync paths, and add production-path race regressions.

Signed-off-by: Konstantin Baltsat <baltsat2002@mail.ru>
@toddbaert
toddbaert force-pushed the fix/2004-synchronize-readiness-state branch from 30ef582 to e67f001 Compare July 27, 2026 13:08
@sonarqubecloud

Copy link
Copy Markdown

@toddbaert
toddbaert merged commit 317a7e0 into open-feature:main Jul 27, 2026
18 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 27, 2026
toddbaert pushed a commit that referenced this pull request Jul 27, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.16.1</summary>

##
[0.16.1](flagd/v0.16.0...flagd/v0.16.1)
(2026-07-27)


### 🐛 Bug Fixes

* add server ReadTimeouts, update security deps
([#1980](#1980))
([0e1e8b3](0e1e8b3))
* handle invalid selector errors
([#1976](#1976))
([409a62e](409a62e))
* **security:** update module google.golang.org/grpc to v1.82.1
[security] ([#2005](#2005))
([4281adf](4281adf))
* **security:** update vulnerability-updates [security]
([#1984](#1984))
([2a5a6b6](2a5a6b6))


### ✨ New Features

* **sync:** configurable gRPC keepalive enforcement on sync server
([#1999](#1999))
([19e57b9](19e57b9))
</details>

<details><summary>flagd-proxy: 0.9.7</summary>

##
[0.9.7](flagd-proxy/v0.9.6...flagd-proxy/v0.9.7)
(2026-07-27)


### 🐛 Bug Fixes

* add server ReadTimeouts, update security deps
([#1980](#1980))
([0e1e8b3](0e1e8b3))
* **security:** update module google.golang.org/grpc to v1.82.1
[security] ([#2005](#2005))
([4281adf](4281adf))
* **security:** update vulnerability-updates [security]
([#1984](#1984))
([2a5a6b6](2a5a6b6))
</details>

<details><summary>core: 0.16.1</summary>

##
[0.16.1](core/v0.16.0...core/v0.16.1)
(2026-07-27)


### 🐛 Bug Fixes

* **certreloader:** re-check reload condition under write lock
([#1994](#1994))
([86489da](86489da))
* handle invalid selector errors
([#1976](#1976))
([409a62e](409a62e))
* readyz never true of multiple gRPC syncs are used
([#1985](#1985))
([29833e8](29833e8))
* **security:** update module google.golang.org/grpc to v1.82.1
[security] ([#2005](#2005))
([4281adf](4281adf))
* **security:** update vulnerability-updates [security]
([#1984](#1984))
([2a5a6b6](2a5a6b6))
* **sync:** avoid send on closed channel in fileinfo watcher Close
([#1992](#1992))
([a7339ea](a7339ea))
* **sync:** handle non-string YAML map keys in config parsing
([#1990](#1990))
([3c72e6f](3c72e6f))
* **sync:** re-establish file watch after delete and restore
([#2001](#2001))
([d434adf](d434adf))
* **sync:** synchronize readiness state
([#2006](#2006))
([317a7e0](317a7e0))


### ✨ New Features

* improve ETag and body hash support to blob/http sync
([#1991](#1991))
([1e210d4](1e210d4))


### 🧹 Chore

* fix flaky test
([7ff137d](7ff137d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ready flag has an unsynchronized read/write across grpc/blob/http syncs

3 participants