Skip to content

fix: Correct privateAttributes JSON tag in context comparison params - #392

Merged
keelerm84 merged 1 commit into
v3from
mk/SDK-2739/private-attributes-omit-empty-v3
Jul 21, 2026
Merged

keelerm84 merged 1 commit into
v3from
mk/SDK-2739/private-attributes-omit-empty-v3

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Summary

ContextComparisonSingleParams.PrivateAttributes used a colon instead of a comma in its struct tag (json:"privateAttributes:omitempty"). Go treats the whole string as the field name, so the field marshaled to the wire key privateAttributes:omitempty instead of privateAttributes, and omitempty was silently ignored. As a result the harness never sent private attributes to SDK test services for the contextComparison command, and the context-comparison private-attribute assertions passed vacuously.

This corrects the tag to json:"privateAttributes,omitempty" and adds two negative context-comparison tests where private attributes are the sole differentiator (two otherwise-identical contexts expected to be not equal). The existing suite only asserted the equal direction, which cannot detect an SDK that drops private attributes.

Verified on the v2 line by running the affected suite (context type/compare) against the flutter-client-sdk contract service: 16 tests run, all pass, including the two new negative tests. This is the v3 backport of that fix.

Capability exercised: context-comparison (declared today by ruby-server-sdk, flutter-client-sdk, ios-client-sdk).


Note

Low Risk
Small harness serialization fix and contract tests only; no production SDK runtime behavior in this repo.

Overview
Fixes a typo in ContextComparisonSingleParams.PrivateAttributes so the harness marshals privateAttributes on contextComparison commands instead of the invalid key privateAttributes:omitempty, which had prevented private attributes from reaching SDK test services.

Adds two context compare tests that expect contexts not equal when private attributes are missing on one side or differ, so SDKs that ignore private attributes can no longer pass the suite vacuously.

Reviewed by Cursor Bugbot for commit 7220f5d. Bugbot is set up for automated code reviews on this repo. Configure here.

The ContextComparisonSingleParams.PrivateAttributes field used a colon
instead of a comma in its struct tag (`privateAttributes:omitempty`), so
the field marshaled to the wire key "privateAttributes:omitempty" and was
never sent to SDK test services. As a result the context-comparison
private-attribute assertions passed vacuously.

Correct the tag to `privateAttributes,omitempty` and add two negative
context-comparison tests where private attributes are the sole
differentiator, so an SDK that mishandles private attributes is caught.
@keelerm84
keelerm84 marked this pull request as ready for review July 21, 2026 17:49
@keelerm84
keelerm84 requested a review from a team as a code owner July 21, 2026 17:49
@keelerm84
keelerm84 merged commit d9d2c01 into v3 Jul 21, 2026
7 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-2739/private-attributes-omit-empty-v3 branch July 21, 2026 19:02
kinyoklion pushed a commit that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.2.0-alpha.6](v3.1.1-alpha.6...v3.2.0-alpha.6)
(2026-08-12)


### Features

* Add contract test for streaming connection close on client shutdown
([#403](#403))
([0f91b2a](0f91b2a))
* Add contract tests for client-side secure mode hash (h query param)
([#376](#376))
([3e3012c](3e3012c))
* Add hook-environment-id capability and test
([#412](#412))
([922989a](922989a))
* Add migration op event context redaction tests
([#385](#385))
([34d68e9](34d68e9))
* add tests for handling redacting attributes prefixed with `/`
correctly
([#381](#381))
([ff6929d](ff6929d))
* Verify the in operator keeps booleans and numbers distinct
([fac2879](fac2879))


### Bug Fixes

* Correct privateAttributes JSON tag in context comparison params
([#392](#392))
([d9d2c01](d9d2c01))
* Fix capability guarding custom event redaction
([#387](#387))
([4d3419b](4d3419b))
* Only expect custom-event anonymous redaction for server SDKs
([#389](#389))
([032ae14](032ae14))
* prevent client side wrapper test datasystem from colliding with
primary connection mode
([#394](#394))
([fb40bc6](fb40bc6))

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Release-only PR** — bumps the package from `3.1.1-alpha.6` to
**`3.2.0-alpha.6`** in `.release-please-manifest.json`, `main.go`
(`versionString`), and adds the matching **CHANGELOG** section.
> 
> No harness or test code changes appear in this diff; the changelog
summarizes work already merged on the branch (new contract tests for
streaming shutdown, client-side secure mode `h` param,
hook-environment-id, migration/context redaction, `/`-prefixed attribute
redaction, and `in` operator type distinction, plus fixes for
`privateAttributes` JSON tagging, custom-event redaction capability
guards, server-only anonymous redaction expectations, and client-side
wrapper datasystem collision).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
104ac51. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants