Sitelet https://github.com/flutter/flutter/pull/191214
Skip to content

[flutter_tools] Resolve symlinks and fix flakiness in widget preview tests - #191214

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-189849
Aug 25, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-189849

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

  • Resolve symbolic links in PreviewDetector's project root directory and ephemeral directories to ensure consistent path matching.
  • Pass the SDK path to AnalysisContextCollection to ensure correct SDK resolution in worktrees.
  • Add a 100ms delay in test helpers before triggering file changes to allow the file watcher to fully initialize on macOS.

Related Issues

Fixes #189849

Tests

  • Updated widget preview unit and regression tests in packages/flutter_tools/test/commands.shard/hermetic/widget_preview/ and packages/flutter_tools/test/commands.shard/permeable/widget_preview/.

…tests

Resolve symbolic links in `PreviewDetector`'s project root directory and ephemeral directories to ensure consistent path matching.

Pass the SDK path to `AnalysisContextCollection` to ensure correct SDK resolution in worktrees.

Add a 100ms delay in test helpers before triggering file changes to allow the file watcher to fully initialize.

Fixes: flutter#189849
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 17, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 17, 2026

@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 updates PreviewDetector to accept Artifacts and configure the AnalysisContextCollection with the engine Dart SDK path. It also resolves symbolic links for the project root and ephemeral directories using a new helper method, and introduces short delays in tests to allow file watchers to initialize. The feedback suggests caching the resolved ephemeral directory paths during initialization to avoid repeated synchronous file system operations on every file watcher event.

Comment thread packages/flutter_tools/lib/src/widget_preview/preview_detector.dart
Comment thread packages/flutter_tools/lib/src/widget_preview/preview_detector.dart Outdated
@bkonyi
bkonyi requested a review from srawlins August 24, 2026 21:03
bkonyi added 2 commits August 24, 2026 21:08
…tector

Cache resolved ephemeral directory paths during initialization to avoid repeated synchronous disk I/O on each file watcher event.
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 25, 2026
Merged via the queue into flutter:master with commit 3700590 Aug 25, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac_arm64 tool_tests_commands is 3.03% flaky

2 participants