Skip to content

Conversation

@fabriziodemaria
Copy link
Contributor

@fabriziodemaria fabriziodemaria commented Aug 5, 2025

This PR

  • Don't expose MutableContext, only use it in tests
  • Expose a new ImmutableContext, with methods to safely edit it by returning new immutable copies
  • Remove deepCopy operations, not needed with the new ImmutableContext

Related Issues

We've received crash reports on the Confidence Provider that we believe are caused by the passed context object being mutated at runtime.

Breaking Changes

  • MutableContext has to be migrated to ImmutableContext. The context semantics are unchanged: Swift immutability is the only difference that might impact the way the hosting application keeps track and forwards the context data to this SDK. Please make sure to migrate to ImmutableContext throughout your application and make that the only type passed into these APIs: setProvider and setEvaluationContext.

Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
@fabriziodemaria fabriziodemaria changed the title feat: Add ImmutableContext implementation feat!: Add ImmutableContext implementation Aug 5, 2025
Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
@fabriziodemaria fabriziodemaria merged commit e8690d1 into main Aug 6, 2025
10 checks passed
@fabriziodemaria fabriziodemaria deleted the immutable-ctx branch August 6, 2025 08:44
fabriziodemaria pushed a commit that referenced this pull request Aug 6, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.4.0](0.3.1...0.4.0)
(2025-08-06)


### ⚠ BREAKING CHANGES

* Add ImmutableContext implementation
([#70](#70))

### ✨ New Features

* Add ImmutableContext implementation
([#70](#70))
([e8690d1](e8690d1))

---
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>
fabriziodemaria added a commit that referenced this pull request Aug 6, 2025
Small followup from #70

Signed-off-by: Fabrizio Demaria <fabrizio.f.demaria@gmail.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.

3 participants