[deeplink] add safe guards around api request - #10022
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces caching for Android build variants and iOS Xcode build options within DeeplinkManager, enabling validation of build variants, configurations, and targets before executing Flutter commands. Additionally, it updates process execution to run within the project's root directory rather than passing the path as an argument. The review feedback identifies two critical issues where JSON parsing errors during cache population are silently ignored, which can result in misleading error messages during subsequent validation steps. It is recommended to catch these exceptions and return descriptive error maps.
| assert(controller.currentAppLinkSettings?.error != null); | ||
| final error = [ | ||
| controller.currentAppLinkSettings?.error, | ||
| controller.currentUniversalLinkSettings?.error, |
There was a problem hiding this comment.
Since this pr introduced a new way things can return error, I make sure both android and ios error will surface to the ui.
| /// | ||
| /// Populated by [getAndroidBuildVariants] and used to validate `buildVariant` | ||
| /// in [getAndroidAppLinkSettings]. | ||
| static final _androidBuildVariantsCache = <String, Set<String>>{}; |
There was a problem hiding this comment.
This unfortunately means the server api handler will be stateful, but this is needed to filter bad request
| return _runFlutterCommand( | ||
| <String>['analyze', '--android', '--list-build-variants', rootPath], | ||
| <String>['analyze', '--android', '--list-build-variants'], | ||
| workingDirectory: rootPath, |
There was a problem hiding this comment.
convert to use working directory to avoid bad path or non path argument.
This pr rejects unrecongized build variants as well as pass in package root path.
related b/555370339
Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcomeorgood-first-issuelabel.contributions-welcomeorgood-first-issuelabel. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.If you need help, consider asking for help on Discord.