fix: do not propagate unrelated changes to other envs#11660
fix: do not propagate unrelated changes to other envs#11660gastonfournier wants to merge 4 commits intomainfrom
Conversation
| @gastonfournier, core features have been modified in this pull request. Please review carefully! |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the client feature toggle delta generation to avoid producing (and serving) deltas for environments that were not affected by a given change event, preventing unrelated environment updates from causing “no-op” deltas elsewhere.
Changes:
- Add environment-aware filtering when computing which feature toggles need to be refreshed per environment during delta updates.
- Remove the single cross-environment
featuresUpdatedlist in favor of an environment-specific list computed inside the update loop. - Add a unit test asserting that an update in one environment does not produce a delta for a different environment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.ts | Filters updated feature names per environment when refreshing delta caches. |
| src/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.test.ts | Adds regression test to ensure unrelated environment changes don’t yield deltas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.ts Outdated Show resolved Hide resolved
src/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.ts Show resolved Hide resolved
src/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.test.ts Show resolved Hide resolved
API Changelog 7.5.1 vs. 7.5.1No changes |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
About the changes
This fixes a bug in delta / streaming propagation where a feature change in one environment could produce a
feature-updatedevent in other connected environments, even when those environments had no in-scope change.The issue was in
ClientFeatureToggleDelta.updateFeaturesDelta(). It built one global set of changed feature names for the revision window and then, for every connected environment, reloaded those feature names in that environment and emittedfeature-updatedevents.That meant a change in
productioncould cause a client streamingdevelopmentto receive:eventIdfeature-updatedpayload containing the currentdevelopmentstateSo, from the client's point of view, this looked like a no-op update with a bumped revision.
This PR narrows feature refreshes by environment before reloading toggles:
I also added a regression test covering the case where a production-only feature update must not emit a synthetic development delta event.
Discussion points
This is intentionally the smaller correctness fix.
A possible follow-up would be to precompute affected environments and skip unaffected delta caches entirely, but that is not required to fix the incorrect payload propagation described above.