fix: Stop per-context private attributes from leaking between contexts - #416
Draft
kinyoklion wants to merge 1 commit into
Draft
fix: Stop per-context private attributes from leaking between contexts#416kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
Found while investigating the contract test failures fixed in #415. Not covered by the current contract test suite.
Describe the solution you've provided
ContextFilter#filter_single_contextcombined the globally configured private attributes with the context's own_meta.privateAttributesusingArray#concat, which mutates@private_attributesin place. Every context filtered by aContextFiltertherefore permanently added its private attributes to the filter's configuration, so a context's private attributes were applied to all contexts filtered afterwards — including the other kinds of the same multi-kind context.Before (single
ContextFilter.new(false, [])):The fix builds a new array (
@private_attributes + context.private_attributes) instead of mutating the configured list. Event processors reuse a singleContextFilterfor the lifetime of the client, so the leak was cumulative across all events.Describe alternatives you've considered
Constructing the filter per event — unnecessary allocation churn, and the mutation is the actual defect.
Additional context
Full contract test suite against harness v3.2.0-alpha.6 passes with this change (combined with #415): 4723 total, 14 skipped, all ran passed.
Link to Devin session: https://app.devin.ai/sessions/316afaccd2604f8d802a72c9080f6921
Requested by: @kinyoklion