Skip to content

[flutter tool] honor inherited DASH__SUPPRESS_ANALYTICS - #194750

Merged
pq merged 9 commits into
flutter:masterfrom
pq:analytics_inheritSuppression2
Oct 26, 2026
Merged

pq merged 9 commits into
flutter:masterfrom
pq:analytics_inheritSuppression2

Conversation

@pq

@pq pq commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

When a parent Dash tool sets DASH__SUPPRESS_ANALYTICS=true (for example, during the root tool's first run), the Flutter CLI now stops reporting analytics itself. Before this change, getAnalytics() only checked FLUTTER_SUPPRESS_ANALYTICS. Flutter passed the flag on to the tools it launches (#194261), but still reported on its own.

getAnalytics() now returns NoOpAnalytics when the flag is set. Like FLUTTER_SUPPRESS_ANALYTICS, this also means no crash reports and no consent message for that invocation. Only the exact string true counts as a request to suppress, which matches package:unified_analytics, the dart CLI, and ErrorHandlingProcessManager.

A no-op instance can't change the telemetry setting. So when the flag is set, --enable-analytics, --disable-analytics, and flutter config --[no-]analytics now print a warning that the setting wasn't changed and why. Before, they reported success without saving anything.

Test notes:

  • Some runner_test.dart tests now override Platform. The test process can inherit DASH__SUPPRESS_ANALYTICS=true from the flutter test that launched it: on bots, or when telemetry is disabled locally.
  • Any new test of the opt-out/opt-in commands needs to override Platform the same way.

Follow-up to #194261.

(Fixes flutter/dash-devexp-internal#98.)

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Oct 19, 2026
@pq
pq marked this pull request as ready for review October 19, 2026 22:55
@pq
pq requested a review from bkonyi October 19, 2026 22:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements support for suppressing analytics via the DASH__SUPPRESS_ANALYTICS environment variable. When this variable is set to true, attempts to enable or disable analytics via command-line flags or configuration will output a warning instead of modifying telemetry settings, and a no-op analytics instance will be used. Relevant unit tests have been added to verify this behavior. A review comment identifies a typo in a comment within runner.dart.

Comment thread packages/flutter_tools/lib/runner.dart Resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@pq
pq enabled auto-merge October 20, 2026 22:10
@DanTup

DanTup commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@pq I think this needs the CI/CD label to run the bots (and I think the autosubmit label might be used for auto-submitting, rather than the GH automerge button?)

@pq pq added the CICD Run CI/CD label Oct 26, 2026
@pq

pq commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, Danny!

@pq
pq added this pull request to the merge queue Oct 26, 2026
@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #194750 at sha 92e8949

suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…4750)

When a parent Dash tool sets `DASH__SUPPRESS_ANALYTICS=true` (for
example, during the root tool's first run), the Flutter CLI now stops
reporting analytics itself. Before this change, `getAnalytics()` only
checked `FLUTTER_SUPPRESS_ANALYTICS`. Flutter passed the flag on to the
tools it launches (flutter#194261), but still reported on its own.

`getAnalytics()` now returns `NoOpAnalytics` when the flag is set. Like
`FLUTTER_SUPPRESS_ANALYTICS`, this also means no crash reports and no
consent message for that invocation. Only the exact string `true` counts
as a request to suppress, which matches `package:unified_analytics`, the
`dart` CLI, and `ErrorHandlingProcessManager`.

A no-op instance can't change the telemetry setting. So when the flag is
set, `--enable-analytics`, `--disable-analytics`, and `flutter config
--[no-]analytics` now print a warning that the setting wasn't changed
and why. Before, they reported success without saving anything.

Test notes:
- Some `runner_test.dart` tests now override `Platform`. The test
process can inherit `DASH__SUPPRESS_ANALYTICS=true` from the `flutter
test` that launched it: on bots, or when telemetry is disabled locally.
- Any new test of the opt-out/opt-in commands needs to override
`Platform` the same way.

Follow-up to flutter#194261.

(Fixes flutter/dash-devexp-internal#98.)


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants