Commit d93f52d
authored
fix(ci): unbreak Dart Format and Dart Analyze on main (#1181)
`Build` has been failing on `main` and therefore on every PR, regardless
of what the PR changes — visible on #1180,
`max/fix-ios-audio-session-before-recording` and `sync-upstream-2.11.0`,
all of which show `Build ✗` with `Changeset Check ✓`. Two jobs are
responsible.
## Dart Format
Three files under `scripts/` are not formatted, so `dart format .
--set-exit-if-changed` exits 1. Straight from the CI log:
```
Formatted scripts/check_version.dart
Formatted scripts/create_change.dart
Formatted scripts/create_version.dart
Formatted 227 files (3 changed) in 0.72 seconds.
##[error]Process completed with exit code 1
```
Formatting only, no behaviour change.
## Dart Analyze
```
lib/src/token_source/caching.dart:138:9 • unawaited_return_in_try_block
lib/src/token_source/caching.dart:144:7 • unawaited_return_in_try_block
```
`CachingTokenSource.fetch` returned `resultFuture` from inside its
`try`, so the surrounding `catch` could not observe a failure from that
future and `finally` removed the in-flight entry before it settled. Both
returns now `await`.
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.md`
calls 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 a
`patch type="fixed"` changeset.
## The analysis_options churn, and a coverage hole it was hiding
`flutter analyze` kept leaving `analysis_options.yaml` modified. The
cause is `AnalysisOptionsMigration`
(`flutter_tools/lib/src/migrations/analysis_options_migration.dart`,
invoked from `project.dart:429`), which appends seven patterns —
`build/**`, `android/**`, `ios/**`, `web/**`, `windows/**`, `macos/**`,
`linux/**` — on every `flutter analyze` / `pub get` / `run`. It is
unconditional; there is no feature flag or config to disable it, unlike
the UIScene migrator's `enable-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, so `web/**` silently drops it from analysis. That was
already happening in CI, since `flutter analyze` runs 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 to `web/e2ee.logger.dart`: it reported `No issues
found!`. Giving `web/` its own `analysis_options.yaml` creates a
separate context that is genuinely analyzed; the same canary then
correctly reports `return_of_invalid_type`. That file mirrors the root's
error overrides and its formatter settings (`page_width: 120`,
`trailing_commas: preserve`) so `dart format` output is unaffected, and
`build.yaml` gains a `dart analyze web/` step.
## Verified locally
```
dart format . --set-exit-if-changed PASS (227 files, 0 changed)
flutter analyze PASS (No issues found)
dart analyze web/ PASS (and fails on an injected error)
flutter test PASS (+398)
dart run scripts/check_version.dart PASS
import_sorter --exit-if-changed PASS
```
## Not included
Pinning the Flutter version in
`.github/actions/setup-flutter/action.yml`, which currently passes only
`channel: stable` and so tracks whatever the newest stable release is.
That is a genuine fragility — `unawaited_return_in_try_block` arrived
this way — but it is a separate decision from unbreaking CI, and worth
its own discussion.
Draft because #1180 should confirm this actually turns `Build` green
once rebased on it.1 parent f62d479 commit d93f52d
8 files changed
Lines changed: 69 additions & 2 deletions
File tree
- .changes
- .github/workflows
- lib/src/token_source
- scripts
- web
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments