Skip to content

[ios]do not nuke user input path when running uiscene integration test#186436

Open
hellohuanlin wants to merge 1 commit into
flutter:masterfrom
hellohuanlin:omg_ui_scene_script_nuked_my_desktop
Open

[ios]do not nuke user input path when running uiscene integration test#186436
hellohuanlin wants to merge 1 commit into
flutter:masterfrom
hellohuanlin:omg_ui_scene_script_nuked_my_desktop

Conversation

@hellohuanlin

@hellohuanlin hellohuanlin commented May 13, 2026

Copy link
Copy Markdown
Contributor

As discussed in #186412 (comment).

It's safer to only delete the folders/files that flutter itself controls. The script can create the project folder under the path (e.g. generated_project). Then when deleting, we only delete generated_project folder (the "Expected" behavior in the description)

Note:

  1. The documentation itself is fine tho, so I will keep it untouched.

  2. It looks like we don't have infra setup to write unit tests for test scripts, so I will leave it as out-of-scope of this PR.

  3. But in the future we should be heading towards dumb logic in test scripts, and leverage Xcode build targets & file memberships instead.

  4. I think this is a broader security issue than just this particular script - I wish our flutter/dart tooling could have asked for permission for dangerous operations like this. I filed [flutter/dart] Is it possible to ask for permission for dangerous operations for Flutter contributors #186419

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

Fixes #186412

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 13, 2026
@hellohuanlin hellohuanlin marked this pull request as ready for review May 13, 2026 04:30
@hellohuanlin hellohuanlin requested a review from a team May 13, 2026 04:31

@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 modifies the iOS UI scene test task to create the generated project within a subfolder named 'flutter_uiscene_test_generated_project' instead of the root destination directory. Feedback includes a likely missing import for the 'path' package which will cause a compilation error, potential regressions in subsequent logic or external tools that rely on the original output path, and the need to update documentation to reflect the new directory structure.

if (destination != null) {
destinationOverride = true;
destinationDir = Directory(destination);
destinationDir = Directory(path.join(destination, 'flutter_uiscene_test_generated_project'));

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.

high

The code uses path.join, which requires the package:path/path.dart library to be imported (typically as path). Since the previous version of this code used the Directory constructor directly with the destination string, this import is likely missing. This will cause a compilation error when the script is run, especially given the note in the PR description that the changes have not been tested locally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wrong

if (destination != null) {
destinationOverride = true;
destinationDir = Directory(destination);
destinationDir = Directory(path.join(destination, 'flutter_uiscene_test_generated_project'));

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.

high

Moving the generated project into a subfolder (flutter_uiscene_test_generated_project) changes the output location. It is critical to ensure that all subsequent logic in this script, as well as any external tools or CI configurations that rely on this task, are updated to look for the project at destinationDir.path rather than the original destination path. If any code still uses the destination variable to construct paths to project files (e.g., to find the .xcodeproj), those references will now be broken.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wrong

if (destination != null) {
destinationOverride = true;
destinationDir = Directory(destination);
destinationDir = Directory(path.join(destination, 'flutter_uiscene_test_generated_project'));

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.

medium

The PR description mentions that the documentation is being kept untouched. However, if the documentation for the --destination parameter or the script's usage instructions states that the project is created at the provided path, it is now inaccurate. The documentation should be updated to reflect that a subfolder is created to prevent accidental data loss in the user-provided directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wrong, the instruction specifically says will save to the destination, not will replace the destination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OMG! My ~/Desktop was nuked!

3 participants