Validates package root URIs (#10096)
* Validates package root URIs
This change validates the detected directory in VmServiceHandler before caching
it or updating DTD, requiring that it:
is a local file:// URI with no authority, query, fragment, or dot-segment
traversal (. / ..), does not point or resolve (via symlinks) to the filesystem
root or the user's home directory (HOME / USERPROFILE), and exists on disk and
contains either pubspec.yaml or .dart_tool/package_config.json.
It also extracts shared isValidLocalFileUri and isValidLocalFileUriString
helpers in file_utils.dart (reused by ExtensionsManager and the extensions API
handler) and adds unit and server API tests covering valid roots, invalid URI
forms, filesystem/home root rejection, missing package markers, and end-to-end
/api/notifyForVmServiceConnection handling.
Makes progress towards:
* https://github.com/flutter/dash-devexp-internal/issues/88
* https://github.com/flutter/dash-devexp-internal/issues/93
* Allow disconnect when path is invalid, fix bug in disconnect code
* Add release note entry
* Address PR #10096 review feedback for local file URI and package root validation.
* Reject encoded slashes (`/` / `%2f`) in `isValidLocalFileUri` path segments and validate raw `root` strings with `isValidLocalFileUriString` before `Uri.parse` in `detectRootPackageForVmService`, with new `%2f` test coverage.
* Simplify `_validateRootPackageUri` to check `dir.existsSync()` first, resolve symlinks once (failing closed on `FileSystemException`), and compare only the resolved path against the filesystem root and resolved home directory.
* Remove duplicate `_validateRootPackageUri` validation from `updateDtdWorkspaceRoots` and move its rejection tests to standalone `isValidRootPackageUri` unit tests without DTD.
* Extract the repeated `runWithRetry` polling blocks in `detectRootPackageForVmService` tests into a shared `detectRootWithRetry` helper.
* Update invalid-URI error messages in `_vm_service.dart` and `_devtools_extensions.dart`, add doc comments to `VmServiceHandler` constants, remove redundant `@visibleForTesting`, and document the new helpers and stricter URI checks in `packages/devtools_shared/CHANGELOG.md`.
* Address PR #10096 review feedback for URI validation and tests.
- Move `_invalidLocalFileUriMessage` to a library-private constant in `server_api.dart` and reuse it in `_devtools_extensions.dart` and `_vm_service.dart` so invalid local file URI error messages stay in sync.
- Expose `VmServiceHandler.validateRootPackageUri` as `@visibleForTesting`, remove `isValidRootPackageUri`, and assert on specific rejection reason messages in `general_api_test.dart`.
- Trim the invalid local file URI test in `general_api_test.dart` to a single query URI case since `file_utils_test.dart` already covers all invalid URI components.
- Restore plain `Uri.parse` fixtures in `updateDtdWorkspaceRoots` tests and remove the unnecessary temporary directory setup and deleted-directory test.
- Document `detectRootWithRetry`'s default `isReady` behavior and simplify its `isReady` callbacks to use null-aware `contains`.
* [agent] Address PR review feedback on URI validation and symlink handling
* Fix Windows path resolution assertions in general_api_test
* [agent] Address PR review feedback on UNC URI validation and symlink checks