diff --git a/.changes/caching-token-source-await b/.changes/caching-token-source-await new file mode 100644 index 000000000..3e8546c02 --- /dev/null +++ b/.changes/caching-token-source-await @@ -0,0 +1 @@ +patch type="fixed" "CachingTokenSource.fetch now awaits its result, so errors surface and the in-flight entry is cleared correctly" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 55ebf58ee..61f8f2616 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,6 +66,12 @@ jobs: - uses: ./.github/actions/setup-flutter - name: Dart Analyze Check run: flutter analyze + # `flutter analyze` runs Flutter's AnalysisOptionsMigration first, which + # forces `web/**` into analysis_options.yaml. This package keeps real Dart + # source there (the E2EE worker), so analyze it separately -- `dart + # analyze` does not run migrators. + - name: Dart Analyze Check (web sources) + run: dart analyze web/ dart-test-check: name: Dart Test diff --git a/analysis_options.yaml b/analysis_options.yaml index b7cb2942b..1c0c39cf8 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -33,6 +33,18 @@ analyzer: # Manager is enabled and this package ships Package.swift. - build/** - example/build/** + # Flutter's AnalysisOptionsMigration (flutter_tools) appends these seven + # patterns to this file on every `flutter analyze`/`pub get`/`run`. There is + # no opt-out, so they are committed here to stop the file being rewritten. + # Note this excludes web/, which in this package holds real Dart source (the + # E2EE worker) rather than just assets -- CI analyzes it explicitly with + # `dart analyze web/`, which does not run migrators. + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** linter: rules: diff --git a/lib/src/token_source/caching.dart b/lib/src/token_source/caching.dart index 2a7cdd345..f82831bcf 100644 --- a/lib/src/token_source/caching.dart +++ b/lib/src/token_source/caching.dart @@ -135,13 +135,13 @@ class CachingTokenSource implements TokenSourceConfigurable { final cached = await _store.retrieve(); if (cached != null && cached.options == options && _validator(cached.options, cached.response)) { completer.complete(cached.response); - return resultFuture; + return await resultFuture; } final response = await _wrapped.fetch(options); await _store.store(options, response); completer.complete(response); - return resultFuture; + return await resultFuture; } catch (e, stackTrace) { completer.completeError(e, stackTrace); rethrow; diff --git a/scripts/check_version.dart b/scripts/check_version.dart index 65b2055a5..57fd3bafc 100755 --- a/scripts/check_version.dart +++ b/scripts/check_version.dart @@ -1,4 +1,5 @@ #!/usr/bin/env dart + /* * Copyright 2025 LiveKit * diff --git a/scripts/create_change.dart b/scripts/create_change.dart index ab5b0c260..ae2cc94c9 100755 --- a/scripts/create_change.dart +++ b/scripts/create_change.dart @@ -1,4 +1,5 @@ #!/usr/bin/env dart + /* * Copyright 2025 LiveKit * diff --git a/scripts/create_version.dart b/scripts/create_version.dart index 6d0dd75e7..9af2bf2a6 100755 --- a/scripts/create_version.dart +++ b/scripts/create_version.dart @@ -1,4 +1,5 @@ #!/usr/bin/env dart + /* * Copyright 2025 LiveKit * diff --git a/web/analysis_options.yaml b/web/analysis_options.yaml new file mode 100644 index 000000000..50d5f9b78 --- /dev/null +++ b/web/analysis_options.yaml @@ -0,0 +1,45 @@ +# +# Copyright 2025 LiveKit +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The repository-root analysis_options.yaml has to exclude `web/**`: Flutter's +# AnalysisOptionsMigration appends that pattern on every `flutter analyze` and +# offers no way to opt out. These files are real Dart source (the E2EE worker), +# not web assets, so this file gives them their own analysis context and keeps +# them covered. CI analyzes them via `dart analyze web/`. + +include: package:lints/recommended.yaml + +analyzer: + errors: + constant_identifier_names: ignore + use_super_parameters: ignore + avoid_print: ignore + deprecated_member_use_from_same_package: ignore + +linter: + rules: + # Preference of the SDK + prefer_single_quotes: true + prefer_final_locals: true + unnecessary_brace_in_string_interps: false + avoid_print: true + + # Enforce this for correct async logic + unawaited_futures: true + discarded_futures: true + +formatter: + page_width: 120 + trailing_commas: preserve