fix(ci): unbreak Dart Format and Dart Analyze on main - #1181
Merged
Conversation
`dart format . --set-exit-if-changed` reformats three files under scripts/, which fails the Dart Format CI job on main and therefore on every PR. No behaviour change; formatting only.
`fetch` returned `resultFuture` from inside its `try` block, so the surrounding `catch` could not observe a failure from that future and the `finally` clause removed the in-flight entry before it settled. Dart 3.13's analyzer flags this as `unawaited_return_in_try_block`, failing the Dart Analyze CI job; un-awaited async state updates are also a recurring source of bugs in this codebase. Both returns now `await` the future, so errors route through the existing catch and the in-flight map is cleaned up only once the request is done. The completer is completed immediately before each return, so the awaited future is already resolved and behaviour is unchanged.
`AnalysisOptionsMigration` in flutter_tools appends build/**, android/**, ios/**, web/**, windows/**, macos/** and linux/** to analysis_options.yaml on every `flutter analyze`, `pub get` and `run`. It is unconditional -- there is no feature flag or config to disable it -- so the file showed up as modified after any Flutter command. Committing the patterns makes the migrator a no-op. It also documents the one that matters here: web/ holds the E2EE worker sources, not just assets, so excluding it silently drops them from analysis. That already happens in CI today, because `flutter analyze` runs the migrator before analyzing; the following commit restores that coverage explicitly.
The root analysis_options.yaml now excludes web/**, because Flutter's AnalysisOptionsMigration forces that pattern in and cannot be turned off. In this package web/ is not assets -- it holds the E2EE worker sources -- so that exclusion silently dropped them from analysis. This already happened in CI, since `flutter analyze` runs the migrator before it analyzes. Passing the path explicitly does not help: `dart analyze web/` still honours the root exclude and reports success on a file with a type error. Giving web/ its own analysis_options.yaml creates a separate context that is genuinely analyzed. Verified by appending a deliberate type error to web/e2ee.logger.dart, which the new setup reports and the old one did not. The file mirrors the root's error overrides and its formatter settings (page_width 120, trailing_commas preserve) so `dart format` output is unchanged, and CI gains a `dart analyze web/` step.
hiroshihorie
marked this pull request as ready for review
August 26, 2026 17:36
hiroshihorie
requested review from
cloudwebrtc and
xianshijing-lk
as code owners
August 26, 2026 17:36
The web/ config only carried the analyzer and formatter sections, so the E2EE sources lost prefer_single_quotes, prefer_final_locals, unawaited_futures and discarded_futures. Confirmed via canary: those lints did not fire before this change and do now. web/ passes clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Buildhas been failing onmainand therefore on every PR, regardless of what the PR changes — visible on #1180,max/fix-ios-audio-session-before-recordingandsync-upstream-2.11.0, all of which showBuild ✗withChangeset Check ✓. Two jobs are responsible.Dart Format
Three files under
scripts/are not formatted, sodart format . --set-exit-if-changedexits 1. Straight from the CI log:Formatting only, no behaviour change.
Dart Analyze
CachingTokenSource.fetchreturnedresultFuturefrom inside itstry, so the surroundingcatchcould not observe a failure from that future andfinallyremoved the in-flight entry before it settled. Both returns nowawait.Behaviour is unchanged — the completer is completed on the line immediately before each return, so the awaited future is already resolved — but errors now route through the existing
catch, and the in-flight map is cleared only once the request settles.AGENTS.mdcalls out un-awaited async state updates as a recurring bug class here, so this is a real latent issue rather than a lint silence. Includes apatch type="fixed"changeset.The analysis_options churn, and a coverage hole it was hiding
flutter analyzekept leavinganalysis_options.yamlmodified. The cause isAnalysisOptionsMigration(flutter_tools/lib/src/migrations/analysis_options_migration.dart, invoked fromproject.dart:429), which appends seven patterns —build/**,android/**,ios/**,web/**,windows/**,macos/**,linux/**— on everyflutter analyze/pub get/run. It is unconditional; there is no feature flag or config to disable it, unlike the UIScene migrator'senable-uiscene-migration.Committing the patterns makes it a no-op. But one of them matters: this package keeps real Dart source in
web/(the E2EE worker), not just assets, soweb/**silently drops it from analysis. That was already happening in CI, sinceflutter analyzeruns the migrator before it analyzes.Passing the path explicitly does not work —
dart analyze web/still honours the root exclude. I confirmed this by appending a deliberate type error toweb/e2ee.logger.dart: it reportedNo issues found!. Givingweb/its ownanalysis_options.yamlcreates a separate context that is genuinely analyzed; the same canary then correctly reportsreturn_of_invalid_type. That file mirrors the root's error overrides and its formatter settings (page_width: 120,trailing_commas: preserve) sodart formatoutput is unaffected, andbuild.yamlgains adart analyze web/step.Verified locally
Not included
Pinning the Flutter version in
.github/actions/setup-flutter/action.yml, which currently passes onlychannel: stableand so tracks whatever the newest stable release is. That is a genuine fragility —unawaited_return_in_try_blockarrived this way — but it is a separate decision from unbreaking CI, and worth its own discussion.Draft because #1180 should confirm this actually turns
Buildgreen once rebased on it.