Skip to content

Commit 187e49c

Browse files
committed
Merge branch 'main' into rlamb/o11y-add-environment-id-support
2 parents 3883d52 + 823772e commit 187e49c

35 files changed

+451
-60
lines changed

.github/workflows/release-please.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
# Needed to get tokens during publishing.
1717
permissions:
1818
id-token: write
19-
contents: read
19+
contents: write
20+
pull-requests: write
2021
runs-on: ubuntu-latest
2122
steps:
2223
# Normally a workflow cannot trigger another workflow. For this workflow we need to create a

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"packages/common":"1.6.0","packages/common_client":"1.6.1","packages/event_source_client":"1.2.0","packages/flutter_client_sdk":"4.11.1"}
1+
{"packages/common":"1.6.1","packages/common_client":"1.6.2","packages/event_source_client":"1.2.1","packages/flutter_client_sdk":"4.11.2"}

apps/sse_contract_test_service/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ packages:
311311
path: "../../packages/event_source_client"
312312
relative: true
313313
source: path
314-
version: "1.2.0"
314+
version: "1.2.1"
315315
lints:
316316
dependency: "direct dev"
317317
description:

packages/common/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to the LaunchDarkly Dart Common will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org).
44

5+
## [1.6.1](https://github.com/launchdarkly/flutter-client-sdk/compare/launchdarkly_dart_common-v1.6.0...launchdarkly_dart_common-v1.6.1) (2025-09-03)
6+
7+
8+
### Bug Fixes
9+
10+
* improves handling of invalid contexts and adds SSE Client logging. ([#207](https://github.com/launchdarkly/flutter-client-sdk/issues/207)) ([fcab81f](https://github.com/launchdarkly/flutter-client-sdk/commit/fcab81f006f6efd78206756447d2587f87b8c43c))
11+
512
## [1.6.0](https://github.com/launchdarkly/flutter-client-sdk/compare/launchdarkly_dart_common-v1.5.0...launchdarkly_dart_common-v1.6.0) (2025-05-09)
613

714

packages/common/lib/src/async/async_single_queue.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ final class _Pending<TTaskReturn> {
3131
_Pending(this._fn, this._completer);
3232

3333
Future<TaskResult<TTaskReturn>> execute() {
34-
this
35-
._fn()
34+
_fn()
3635
.then((value) => _completer.complete(TaskComplete(value)))
3736
.catchError((err) => _completer.complete(TaskError(err)));
38-
return this._completer.future;
37+
return _completer.future;
3938
}
4039

4140
void shed() {
42-
this._completer.complete(TaskShed());
41+
_completer.complete(TaskShed());
4342
}
4443
}
4544

packages/common/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: launchdarkly_dart_common
22
description: Common dart libraries used by LaunchDarkly SDKs. This is an internal package not designed for general use.
3-
version: 1.6.0
3+
version: 1.6.1
44
homepage: https://github.com/launchdarkly/flutter-client-sdk
55
repository: https://github.com/launchdarkly/flutter-client-sdk/tree/main/packages/common
66

packages/common/test/ld_context_test.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ void main() {
6363
expect(LDContextBuilder().build().canonicalKey, '');
6464
});
6565

66+
test('can modify an invalid context to become valid', () {
67+
// Start with an invalid context (no kind specified)
68+
final invalidContext = LDContextBuilder().build();
69+
expect(invalidContext.valid, false);
70+
expect(invalidContext.canonicalKey, '');
71+
72+
// Modify it to become valid by adding a valid kind
73+
final validContext = LDContextBuilder.fromContext(invalidContext)
74+
.kind('user', 'user-key')
75+
.build();
76+
77+
expect(validContext.valid, true);
78+
expect(validContext.canonicalKey, 'user-key');
79+
expect(validContext.keys, <String, String>{'user': 'user-key'});
80+
});
81+
6682
test('can change the key of a context during build', () {
6783
final context = LDContextBuilder()
6884
.kind('user', 'user-key')

packages/common_client/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to the LaunchDarkly Common Client will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org).
44

5+
## [1.6.2](https://github.com/launchdarkly/flutter-client-sdk/compare/launchdarkly_common_client-v1.6.1...launchdarkly_common_client-v1.6.2) (2025-09-03)
6+
7+
8+
### Bug Fixes
9+
10+
* improves handling of invalid contexts and adds SSE Client logging. ([#207](https://github.com/launchdarkly/flutter-client-sdk/issues/207)) ([fcab81f](https://github.com/launchdarkly/flutter-client-sdk/commit/fcab81f006f6efd78206756447d2587f87b8c43c))
11+
512
## [1.6.1](https://github.com/launchdarkly/flutter-client-sdk/compare/launchdarkly_common_client-v1.6.0...launchdarkly_common_client-v1.6.1) (2025-05-09)
613

714

packages/common_client/lib/src/context_modifiers/anonymous_context_modifier.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ const _anonContextKeyNamespace = 'LaunchDarkly_AnonContextKey';
88

99
final class AnonymousContextModifier implements ContextModifier {
1010
final Persistence _persistence;
11+
final LDLogger _logger;
1112

12-
AnonymousContextModifier(Persistence persistence)
13-
: _persistence = persistence;
13+
AnonymousContextModifier(Persistence persistence, LDLogger logger)
14+
: _persistence = persistence,
15+
_logger = logger;
1416

1517
/// For any anonymous contexts, which do not have keys specified, generate
1618
/// or read a persisted key for the anonymous kinds present. If persistence
1719
/// is available, then the key will be stable.
1820
@override
1921
Future<LDContext> decorate(LDContext context) async {
2022
if (!context.valid) {
21-
return context;
23+
_logger.warn(
24+
'AnonymousContextModifier was asked to modify an invalid context and will attempt to do so. This is expected if starting with an empty context.');
2225
}
2326
// Before we make a builder we should check if any anonymous contexts
2427
// without keys exist.

packages/common_client/lib/src/context_modifiers/env_context_modifier.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ final class AutoEnvContextModifier implements ContextModifier {
4242

4343
@override
4444
Future<LDContext> decorate(LDContext context) async {
45+
if (!context.valid) {
46+
_logger.warn(
47+
'AutoEnvContextModifier was asked to modify an invalid context and will attempt to do so. This is expected if starting with an empty context.');
48+
}
49+
4550
final builder = LDContextBuilder.fromContext(context);
4651

4752
for (final recipe in _recipes) {

0 commit comments

Comments
 (0)