Harden view bootstrap setup#18
Open
slideep wants to merge 11 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the Android live view bootstrap flow by making prerequisites executable (view-setup / view setup, view-doctor --fix), validating/installing/verifying the helper APK, and emitting structured view_startup_phase JSONL events during startup to improve diagnosability.
Changes:
- Added
view-setup(andview setupalias) plusview-doctor --fixto run fixable setup checks and helper install/verification. - Hardened helper APK resolution with file fingerprinting (size + SHA-256) and added device-side verification of required MediaProjection components.
- Added view startup phase reporting (JSONL events) and propagated ADB command timeout into view transport bootstrap.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/luotsi.sh | POSIX wrapper to run Luotsi CLI from source via dotnet run. |
| scripts/luotsi.ps1 | PowerShell wrapper to run Luotsi CLI from source via dotnet run. |
| Luotsi.Cli/View/ViewHostPathResolver.cs | Refactors repository-relative candidate resolution into a shared helper for file/dir probing. |
| Luotsi.Cli/View/Transport/NullViewTransport.cs | Updates transport bootstrap interface to accept optional startup phase reporting callback. |
| Luotsi.Cli/View/Session/ViewSession.cs | Emits view_startup_phase JSONL events and improves MediaProjection consent failure handling + fallback behavior. |
| Luotsi.Cli/View/Diagnostics/ViewSetup.cs | Introduces view setup runner that can resolve/build helper, install/verify it, and return structured setup results. |
| Luotsi.Cli/View/Diagnostics/ViewDoctor.cs | Enhances helper package check detail to include resolution source and fingerprint info. |
| Luotsi.Cli/View/Contracts/ViewAbstractions.cs | Adds CommandTimeout propagation, startup phase abstractions, and bootstrap callback API. |
| Luotsi.Cli/Models/SessionEventTypes.cs | Adds view_startup_phase inspect/view event type constant. |
| Luotsi.Cli/Hosts/Android/View/MediaProjectionConsentException.cs | Adds a dedicated exception type for MediaProjection consent failures. |
| Luotsi.Cli/Hosts/Android/View/AndroidViewBootstrap.cs | Hardens helper resolution (size/SHA-256), installs/verifies helper, adds phased startup reporting, and refines consent approval logic. |
| Luotsi.Cli/Cli/ViewSessionCommandPreparer.cs | Resolves ADB command timeout from CLI/env and passes it into view options for transport startup. |
| Luotsi.Cli/Cli/ViewProfileCoordinator.cs | Extends --profile applicability to view-setup. |
| Luotsi.Cli/Cli/ViewCommandOptionsFactory.cs | Threads resolved command timeout into constructed ViewOptions. |
| Luotsi.Cli/Cli/Help.cs | Documents new source wrappers and adds view setup / view-setup + view-doctor --fix usage text. |
| Luotsi.Cli/Cli/DeviceHostLauncher.cs | Replaces inline timeout parsing with shared AdbCommandTimeoutResolver. |
| Luotsi.Cli/Cli/CliOptions.cs | Registers view-setup command and --fix flag as known tokens. |
| Luotsi.Cli/Cli/AppDependencies.cs | Adds optional IViewSetupFactory dependency injection slot. |
| Luotsi.Cli/Cli/AppCommandHost.cs | Implements view-setup execution and view-doctor --fix behavior. |
| Luotsi.Cli/Cli/AppCommandFamilyRouter.cs | Routes view-setup and view setup alias to the setup runner. |
| Luotsi.Cli/Cli/App.cs | Wires default ViewSetupFactory and passes environment into view session preparation for timeout resolution. |
| Luotsi.Cli/Cli/AdbCommandTimeoutResolver.cs | Centralizes parsing of --adb-timeout-sec / LUOTSI_ADB_TIMEOUT_SEC. |
| Luotsi.Cli.Tests/ViewTransportTests.cs | Updates/extends transport tests to assert startup phase reporting and MediaProjection verification steps. |
| Luotsi.Cli.Tests/ViewSessionOptionsTests.cs | Adds coverage ensuring view sessions receive resolved ADB command timeout (default and env override). |
| Luotsi.Cli.Tests/ViewSessionLifecycleTests.cs | Adds coverage for streaming startup phases and explicit MediaProjection consent failures returning usage errors. |
| Luotsi.Cli.Tests/ViewDoctorTests.cs | Adds coverage for injected setup factory usage and view-doctor --fix invoking setup. |
| Luotsi.Cli.Tests/TestSupport.cs | Extends fakes to support setup and startup phase callback behavior in tests. |
Contributor
Author
|
Addressed the Copilot/github-code-quality review threads in e1279b7. Changes:
Validation:
|
| private readonly IDeviceHost _deviceHost = deviceHost ?? throw new ArgumentNullException(nameof(deviceHost)); | ||
| private readonly IAndroidViewHelperPackageLocator _helperPackageLocator = helperPackageLocator ?? throw new ArgumentNullException(nameof(helperPackageLocator)); | ||
| private readonly AndroidViewHelperSetupProvisioner _helperProvisioner = new( | ||
| helperPackageLocator ?? throw new ArgumentNullException(nameof(helperPackageLocator)), |
| fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)), | ||
| processRunner ?? throw new ArgumentNullException(nameof(processRunner))); | ||
| private readonly IViewDoctorFactory _viewDoctorFactory = viewDoctorFactory ?? throw new ArgumentNullException(nameof(viewDoctorFactory)); | ||
| private readonly IProcessRunner _processRunner = processRunner ?? throw new ArgumentNullException(nameof(processRunner)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
view-setup/view setupandview-doctor --fixto turn view prerequisites into executable setup checksview_startup_phaseJSONL events during helper resolution/install/verify, adb forward, MediaProjection activity launch, and consent approvalValidation
dotnet test Luotsi.Cli.Tests\Luotsi.Cli.Tests.csproj(214/214 before final callback API refinement, 215/215 after)dotnet build -c Releaseview-setup --device 192.168.0.134:5555 --fixreturnedready: truewith helper install/verify succeeding