Skip to content

[tool] Pin platform below 3.2.0 to fix repo-wide analyze failure - #12785

Draft
danielleon-cmd wants to merge 2 commits into
flutter:mainfrom
victogomez-cs:script-tool-pin-platform-pre-final-classes
Draft

[tool] Pin platform below 3.2.0 to fix repo-wide analyze failure#12785
danielleon-cmd wants to merge 2 commits into
flutter:mainfrom
victogomez-cs:script-tool-pin-platform-pre-final-classes

Conversation

@danielleon-cmd

@danielleon-cmd danielleon-cmd commented Sep 8, 2026

Copy link
Copy Markdown

package:platform 3.2.0 redesigned Platform (and the legacy FakePlatform/LocalPlatform) as final classes. script/tool/test/mocks.dart does class MockPlatform extends Mock implements Platform, which no longer compiles under 3.2.0:

test/mocks.dart:16:44 - The class 'Platform' can't be implemented outside of its library because it's a final class.

script/tool's constraint (platform: ^3.0.2) allows 3.2.0, so this broke on the next pub get picking it up. Since script/tool backs the repo's own "analyze repo tools" postsubmit task, this has failed on every commit to main for about two weeks, surfacing as a persistent tree-status failure unrelated to each individual PR's own changes.

platform 3.1.6 (the version just below 3.2.0) still has the classic abstract class Platform API that MockPlatform relies on, so pinning below 3.2.0 is the minimal fix. Migrating the ~31 test files that use MockPlatform to the new platform API (FakePlatform/TestNativePlatform) is a larger, separate effort better done deliberately rather than as a drive-by fix.

Tracked internally at https://cloudsufi.atlassian.net/browse/FPOCTSMP-35

FPOCTSMP-35

Pre-Review Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the AI contribution guidelines and understand my responsibilities, or I am not using AI tools.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter.
  • I signed the CLA. — pending; the CLA bot flagged this as a first-time contribution from this account.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I linked to at least one issue that this PR fixes in the description above. — no existing tracking issue covers this specific breakage; happy to file one if a maintainer wants it tracked separately, but didn't want to file one unilaterally as part of this fix.
  • I followed the version and CHANGELOG instructions, using semantic versioning and the repository CHANGELOG style (added to the existing NEXT section — script/tool's version bumps are cut separately from individual PRs, as its pre-existing NEXT entries show).
  • I updated/added any relevant documentation (doc comments with ///). — not applicable, no public API surface changed.
  • I added new tests to check the change I am making, or I have commented below to indicate which test exemption this PR falls under1. — this is a dependency constraint fix with no behavior change; the fix is verified by the pre-existing dart analyze/dart test suite itself going from failing to passing (see test plan).
  • All existing and new tests are passing.

Test plan

  • dart pub get in script/tool — resolves platform to 3.1.6 (was 3.2.0)
  • dart analyze in script/tool — no issues found (was 1 error)
  • dart test in script/tool — all 1235 tests pass

Note: The Flutter team is currently trialing Gemini Code Assist for GitHub. Comments from gemini-code-assist[bot] aren't authoritative Flutter-team feedback; I'll wait for a human reviewer's guidance on which automated comments (if any) should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.

package:platform 3.2.0 redesigned Platform (and the legacy FakePlatform/
LocalPlatform) as final classes, so script/tool's test/mocks.dart, which
does `class MockPlatform extends Mock implements Platform`, no longer
compiles: "The class 'Platform' can't be implemented outside of its
library because it's a final class."

Since script/tool backs the repo's own "analyze repo tools" postsubmit
task, this has been failing on every commit to main for the last two
weeks, showing up as a persistent tree-status failure unrelated to any
individual PR's own changes.

platform 3.1.6 (the version just below 3.2.0) still has the classic
abstract Platform API that MockPlatform relies on, so pinning below
3.2.0 is the minimal fix; migrating the ~31 test files that use
MockPlatform to the new platform API (FakePlatform/TestNativePlatform)
is a larger, separate effort.

Verified: `dart analyze` (was 1 error, now none) and `dart test` (1235
tests, all passing) in script/tool.
@danielleon-cmd danielleon-cmd self-assigned this Sep 8, 2026
@danielleon-cmd danielleon-cmd added CICD Run CI/CD team: infra Infrastructure like devicelab, Cirrus, or LUCI. dependencies Pull requests that update a dependency file labels Sep 8, 2026
Resolves conflicting fixes for the same platform 3.2.0 breakage:
main already landed the full migration (a26b623, "[tool] Adopt
platform 3.2.0 (flutter#12789)"), which properly updates MockPlatform ->
TestNativePlatform across script/tool instead of pinning the
dependency backward. Took main's side entirely on both conflicting
hunks (pubspec.yaml, CHANGELOG.md); this branch's own fix is now
superseded and its diff against main is empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD dependencies Pull requests that update a dependency file team: infra Infrastructure like devicelab, Cirrus, or LUCI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant