From 4c2ff99a0265b96627e6f9a204b0bd4318194d77 Mon Sep 17 00:00:00 2001 From: Andrew Kolos Date: Thu, 21 Nov 2024 12:25:46 -0800 Subject: [PATCH] In the `Event.exception` constructor, modify a clone of the `args` argument instead of `args` itself (#1201) --- .github/workflows/cli_config.yml | 1 - .github/workflows/extension_discovery.yml | 1 - .github/workflows/graphs.yml | 7 +++---- .github/workflows/unified_analytics.yml | 1 - pkgs/unified_analytics/CHANGELOG.md | 3 +++ pkgs/unified_analytics/lib/src/constants.dart | 4 ++-- pkgs/unified_analytics/lib/src/event.dart | 2 +- pkgs/unified_analytics/pubspec.yaml | 2 +- pkgs/unified_analytics/test/event_test.dart | 8 ++++++++ 9 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cli_config.yml b/.github/workflows/cli_config.yml index 62b7dd90d..ccc2ffef9 100644 --- a/.github/workflows/cli_config.yml +++ b/.github/workflows/cli_config.yml @@ -3,7 +3,6 @@ permissions: read-all on: pull_request: - branches: [main] paths: - ".github/workflows/cli_config.yml" - "pkgs/cli_config/**" diff --git a/.github/workflows/extension_discovery.yml b/.github/workflows/extension_discovery.yml index ce3a2318f..d9c140766 100644 --- a/.github/workflows/extension_discovery.yml +++ b/.github/workflows/extension_discovery.yml @@ -3,7 +3,6 @@ permissions: read-all on: pull_request: - branches: [ main ] paths: - '.github/workflows/unified_analytics.yml' - 'pkgs/extension_discovery/**' diff --git a/.github/workflows/graphs.yml b/.github/workflows/graphs.yml index 7895e9d24..54bd636cc 100644 --- a/.github/workflows/graphs.yml +++ b/.github/workflows/graphs.yml @@ -2,13 +2,12 @@ name: package:graphs permissions: read-all on: - # Run on PRs and pushes to the default branch. - push: - branches: [ main ] + # Run CI on all PRs (against any branch) and on pushes to the main branch. + pull_request: paths: - '.github/workflows/graphs.yml' - 'pkgs/graphs/**' - pull_request: + push: branches: [ main ] paths: - '.github/workflows/graphs.yml' diff --git a/.github/workflows/unified_analytics.yml b/.github/workflows/unified_analytics.yml index 6fe64bbcd..47a451667 100644 --- a/.github/workflows/unified_analytics.yml +++ b/.github/workflows/unified_analytics.yml @@ -3,7 +3,6 @@ permissions: read-all on: pull_request: - branches: [ main ] paths: - '.github/workflows/unified_analytics.yml' - 'pkgs/unified_analytics/**' diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index bee8205e5..425eb3348 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,3 +1,6 @@ +## 6.1.6 +- Fixed `UnsupportedError` thrown when Event.exception is called without providing a value for `args`. + ## 6.1.5 - Remove any `data` entries with a null value in the `Event.exception` constructor. diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index 8982ee576..915872a9d 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -26,7 +26,7 @@ const String kConfigString = ''' # All other lines are configuration lines. They have # the form "name=value". If multiple lines contain # the same configuration name with different values, -# the parser will default to a conservative value. +# the parser will default to a conservative value. # DISABLING TELEMETRY REPORTING # @@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20); const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '6.1.5'; +const String kPackageVersion = '6.1.6'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/lib/src/event.dart b/pkgs/unified_analytics/lib/src/event.dart index 0b5450d6e..1273b591d 100644 --- a/pkgs/unified_analytics/lib/src/event.dart +++ b/pkgs/unified_analytics/lib/src/event.dart @@ -496,7 +496,7 @@ final class Event { }) : eventName = DashEvent.exception, eventData = { 'exception': exception, - ...data..removeWhere((key, value) => value == null), + ...Map.from(data)..removeWhere((key, value) => value == null), }; /// Event that is emitted from the flutter tool when a build invocation diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index 8bf4395ff..c4b6378c8 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -5,7 +5,7 @@ description: >- # LINT.IfChange # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 6.1.5 +version: 6.1.6 # LINT.ThenChange(lib/src/constants.dart) repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics diff --git a/pkgs/unified_analytics/test/event_test.dart b/pkgs/unified_analytics/test/event_test.dart index 2809af965..150314647 100644 --- a/pkgs/unified_analytics/test/event_test.dart +++ b/pkgs/unified_analytics/test/event_test.dart @@ -443,6 +443,14 @@ void main() { expect(constructedEvent.eventData.length, 3); }); + test('Event.exception constructor works when no data is provided', () { + Event generateEvent() => Event.exception( + exception: 'exception', + ); + + expect(generateEvent, returnsNormally); + }); + test('Event.timing constructed', () { Event generateEvent() => Event.timing( workflow: 'workflow',