fix: Omit non-symbol context attributes and protect against cyclic values - #423
Merged
Merged
Conversation
kinyoklion
marked this pull request as ready for review
August 27, 2026 16:33
keelerm84
approved these changes
Aug 27, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6de577. Configure here.
keelerm84
pushed a commit
that referenced
this pull request
Aug 28, 2026
🤖 I have created a release *beep* *boop* --- ## [8.15.1](8.15.0...8.15.1) (2026-08-28) ### Bug Fixes * Omit non-symbol context attributes and protect against cyclic values ([#423](#423)) ([8dae87e](8dae87e)) * Publish the OFF data source status before releasing polling waiters ([#429](#429)) ([d604c19](d604c19)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Summary
Attribute references store every path component as a symbol, so a context attribute with a non-symbol name (for example
"street" => ...instead ofstreet:) can never be addressed: it is invisible to evaluation and bucketing, and a private-attribute reference can never redact it. Today the event filter still copies such attributes into analytics event payloads, with one extra defect: a top-level string-keyed attribute is emitted with anullvalue, because the attribute name comes from raw storage but the value is fetched throughget_value, which symbolizes the name and misses the entry.This PR makes
ContextFilter:_meta.redactedAttributes, since no reference removed them. This also removes the top-levelnullemission described above.AtomicBooleansince the formatter runs on flush workers), so the condition is discoverable without log spam.SystemStackError. The filter now tracks the chain of hashes from the attribute root down each branch and omits a value that points back into its own chain. The same object appearing in different branches (a DAG) is still copied everywhere it appears. One documented nuance: context creation copies each top-level attribute value, so a cycle through that value appears once in the output before it is cut, and private attribute references match the paths that appear in the output (covered by a pinned spec).Behavior change note: string-keyed attribute data that was previously sent in event payloads (intact when nested,
nullat top level) is now omitted.Performance: same-process A/B against
mainon representative context shapes shows 0.99-1.05x on flat and redact-all paths and ~0.90x on deeply nested contexts (the cycle-protection chain costs one small array per nested hash).Regression tests cover: top-level and nested omission, subtree omission, no
redactedAttributesreporting for omitted names, composition with private-attribute redaction, log-once behavior, the previousSystemStackErroron cycles, and DAG preservation. All new tests fail against the previous implementation.Note
Overview
Context filtering for analytics events now drops context attributes whose names are not symbols (top-level, nested, or entire subtrees under a string key), fixing the prior bug where top-level string keys could appear as
nullin payloads. Those keys still cannot be targeted by attribute references or private-attribute redaction, so they are no longer listed in_meta.redactedAttributes.When a logger is supplied (from
EventOutputFormatterviaconfig.logger), the filter logs a single error the first time a non-symbol name is skipped.Nested hash redaction also tracks object identity along each branch and skips edges that cycle back into the same chain, avoiding
SystemStackErrorduring serialization while still emitting shared objects (DAG) under separate branches. Private redaction continues to apply to paths that remain in the output, including partial cyclic structures.Reviewed by Cursor Bugbot for commit 4639d68. Bugbot is set up for automated code reviews on this repo. Configure here.