Skip to content

ci: commit the analyzer excludes the Flutter migrator rewrites on every pub get - #1

Merged
anilcancakir merged 1 commit into
developfrom
fix/ci-analysis-options-migrator
Aug 21, 2026
Merged

ci: commit the analyzer excludes the Flutter migrator rewrites on every pub get#1
anilcancakir merged 1 commit into
developfrom
fix/ci-analysis-options-migrator

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

What

analysis_options.yaml now carries the analyzer.exclude block the Flutter tool's migrator writes, so the migrator is a no-op and a CI checkout stays clean.

Why

This repo's CI has not run since 2026-05-21, which is why nothing has reported it: the next run on any branch would have failed, and it is not a cosmetic warning.

flutter pub get runs the Flutter tool's analysis_options.yaml migrator:

Upgrading analysis_options.yaml to exclude build and platform directories.

That is the first step of both ci.yml and publish.yml. The Validate publish archive step later in the same job (ci.yml:53) then inspects the tree it was handed:

* 1 checked-in file is modified in git.
  Modified files:
  analysis_options.yaml
Package has 1 warning.

Reproduced on a clean checkout of develop, with the exit code read directly rather than through a pipe:

$ flutter pub publish --dry-run >/tmp/dr.log 2>&1; echo "REAL EXIT=$?"
REAL EXIT=65

publish.yml shares that step in its validate job, so this would have blocked a release too, not just a PR.

Reverting the file inside the workflow was rejected as the alternative: it hides the drift and leaves every contributor's tree dirty after a pub get. The excludes are also harmless on their own terms, since this package has none of those directories.

The hand-written comment above the block survives a pub get: the migrator reads the parsed YAML, finds the excludes already present, and skips the file. Confirmed by running pub get twice and checking git status.

Gates

Run locally on the branch tip, matching ci.yml step for step:

  • dart format --output=none --set-exit-if-changed lib/ test/: 2 files, 0 changed.
  • dart analyze lib/ test/: No issues found.
  • flutter test --coverage --timeout=30s: 6 passed.
  • Coverage floor, using the workflow's own awk rule: 80.00% (LH=4, LF=5), PASS at the 80.0 floor.
  • flutter pub publish --dry-run on the committed tree: Package has 0 warnings, exit 0.

Note on the coverage floor

The package sits at exactly 80.00% with LH=4 of LF=5, so a single new uncovered line drops it under the gate. Not changed here, just worth knowing before the next feature lands.

Same fix upstream

Landed in fluttersdk_wind as fluttersdk/wind#178, where it had turned Lint & Test red on all four open PRs at once.

…ry pub get

`flutter pub get` runs the Flutter tool's `analysis_options.yaml` migrator,
which appends an `analyzer.exclude` block for `build/` plus the six platform
runner directories. It is the first step of both `ci.yml` and `publish.yml`,
so by the time `flutter pub publish --dry-run` runs later in the same job the
checkout is dirty: "1 checked-in file is modified in git", exit 65.

Nothing had caught it because the last CI run in this repo predates the
migrator (2026-05-21). The next run on any branch would have failed, and
publish.yml shares the step, so it would have blocked a release as well.

Committing the block the migrator wants makes the migrator a no-op. The
hand-written comment above it survives a `pub get`, since the migrator reads
the parsed YAML, finds the excludes present and skips the file.

Same fix as fluttersdk/wind#178.
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@anilcancakir

Copy link
Copy Markdown
Contributor Author

@kodizm review

1 similar comment
@anilcancakir

Copy link
Copy Markdown
Contributor Author

@kodizm review

@kodizm

kodizm Bot commented Aug 21, 2026

Copy link
Copy Markdown

Note

Kodizm (AI-generated). May contain mistakes; verify before acting.

No findings - the change is correct, and I reproduced both the failure it fixes and the fix itself.

Both files in the pull request were read in full (analysis_options.yaml, CHANGELOG.md); nothing was dropped for size or listed without a diff. The repo has no AGENTS.md, CONTRIBUTING.md, CLAUDE.md or .cursorrules, so I judged against the config that does encode rules (pubspec.yaml, .pubignore, .gitignore, both workflows) and against the existing file style.

Why I believe it is correct:

  • The committed analyzer.exclude list is byte-identical to what the migrator writes, which is what makes it a genuine no-op rather than a near-miss that would be rewritten with a different ordering or set.
  • include: sitting below the analyzer: block is fine - it is a YAML mapping, so key order carries no meaning, and dart analyze confirms it.
  • The excludes cannot narrow what CI checks: both workflows call dart analyze lib/ test/ with explicit paths, and none of build/, android/, ios/, web/, windows/, macos/, linux/ exist in this package.
  • The [Unreleased] CHANGELOG entry is prose in the same register as the [1.0.0] entry above it, and the release-notes awk in publish.yml extracts by ## [VERSION], so an [Unreleased] section cannot leak into a tagged release body.

Tests

No test change, and none is warranted - the change is analyzer configuration with no Dart behaviour attached. The existing 6 tests still pass. Separately confirming the note in the description: coverage is exactly LH=4 / LF=5 = 80.00% against an 80.0 floor, so the next uncovered line fails the gate. Not introduced here, so not a finding.

Checks I ran

  • flutter pub get on the branch tip: no Upgrading analysis_options.yaml... message, git status --porcelain empty, hand-written comment intact. Repeated a second time - still a no-op.
  • Negative control on develop's version of the file, in a scratch copy: Upgrading analysis_options.yaml to exclude build and platform directories. then M analysis_options.yaml. The premise holds.
  • dart format --output=none --set-exit-if-changed lib/ test/: Formatted 2 files (0 changed), exit 0.
  • dart analyze lib/ test/: No issues found!, exit 0.
  • flutter test --coverage --timeout=30s: +6: All tests passed!, exit 0.
  • Coverage floor via the workflow's own awk rule: LH=4 LF=5 pct=80.00, PASS.
  • flutter pub publish --dry-run on a clean tree, exit code read directly rather than through a pipe: Package has 0 warnings., exit=0. Tree still clean afterwards.

One caveat on my own process, for the record: my first dry-run reported exit 65. That was my fault, not the branch's - I made the scratch copy of the checkout before running the negative control, and because .git here is a worktree pointer file the copy shared this checkout's index, so the control staged develop's version underneath me. I reset the index and re-ran on the true head state, which is the exit 0 above. The tree is clean as I leave it.

Toolchain used: Flutter 3.47.1 stable, Dart 3.13.1. Worth noting the fix is only durable while the migrator's exclusion list stays as it is - if a future Flutter version adds a directory to it, the migrator starts rewriting again. That is not a defect here, and the Validate publish archive step is exactly the thing that would catch it loudly, which is the behaviour you want.

@anilcancakir
anilcancakir merged commit 7acc6c0 into develop Aug 21, 2026
2 checks passed
anilcancakir added a commit to fluttersdk/telescope that referenced this pull request Aug 21, 2026
…ry pub get (#23)

`flutter pub get` runs the Flutter tool's `analysis_options.yaml` migrator,
which appends an `analyzer.exclude` block for `build/` plus the six platform
runner directories. It is the first step of both `ci.yml` and `publish.yml`, so
by the time `dart pub publish --dry-run` runs later in the same job the
checkout is dirty: "1 checked-in file is modified in git", exit 65.

Reproduced on a clean checkout of master, reading the exit code directly rather
than through a pipe. Nothing had reported it because no CI run in this repo
postdates the migrator, and publish.yml shares the step, so the next release
would have been blocked too.

Committing the block the migrator wants makes it a no-op. The hand-written
comment above it survives a `pub get`, since the migrator reads the parsed
YAML, finds the excludes present and skips the file.

Same fix as fluttersdk/wind#178 and
fluttersdk/wind_diagnostics_contracts#1.
@anilcancakir
anilcancakir deleted the fix/ci-analysis-options-migrator branch August 21, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant