Skip to content

Fix relative paths, optional-app dependencies, and launcher -Source detection - #2

Merged
Softhe merged 1 commit into
mainfrom
fix/paths-optional-deps-cmd-source
Oct 17, 2026
Merged

Softhe merged 1 commit into
mainfrom
fix/paths-optional-deps-cmd-source

Conversation

@Softhe

@Softhe Softhe commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes four issues found while reviewing the current installer on main.

  1. Relative paths resolved against the wrong folder. -WorkDir, -LogDir and -DownloadDir were made absolute with [IO.Path]::GetFullPath, which uses the process directory, not the PowerShell location. For example, cd D:\ followed by -DownloadOnly -DownloadDir StorePkgs could write to another folder. Paths now resolve against $PWD through Resolve-UserPath.
  2. The elevated relaunch lost the caller's folder. Paths are now resolved before the UAC or 64-bit relaunch, and the child receives the resolved values. This matters because an elevated powershell.exe starts in System32. Before this fix, irm … | iex with -Source Local (no -WorkDir) would look for packages in C:\Windows\System32.
  3. A companion app's missing dependency blocked the Store. On the real 2026-09 package set without NET.Native, which only Xbox Identity Provider needs, the run exited 4 and installed nothing. Optional and additional apps with unmet dependencies are now skipped with a warning and counted as a partial failure (exit 5). Missing Store dependencies still stop the run before installation (exit 4).
  4. Install-Store.cmd matched "-source" inside other text. findstr /c:"-Source" matched paths like D:\my-source-pkgs. The launcher then dropped its -Source Auto default, so the script downloaded packages instead of using the local ones. It now matches only a whole -Source / -Source: option.

The dependency check is split into Get-PackageDependencyState, which Get-DependencyInstallOrder and the new Test-OptionalAppDependency both use. README and docs/installer-reliability.md are updated to match.

Tests

  • New tests/Test-CmdLauncher.ps1 runs the real detection line from Install-Store.cmd.
  • Test-InstallerFlow.ps1 adds cases for a relative -WorkDir, -Source Local with no -WorkDir, and an optional app with a missing dependency.
  • Test-ScopeAndCleanup.ps1 checks that relaunch forwards resolved paths.
  • The full suite passes under Windows PowerShell 5.1 and PowerShell 7 (5/5 scripts).
  • Each new test fails against the previous install.ps1 and Install-Store.cmd.

Not covered: real deployment, UAC, and SYSTEM runs on a disposable LTSC 2021/2024 machine.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • The installer now recognizes explicit -Source options without mistaking paths or longer option names for them.
    • Relative work, log, and download paths are resolved before relaunch, including paths supplied through defaults.
  • Installer Behavior
    • Missing Microsoft Store dependencies and framework dependency cycles stop installation. Optional companion or additional apps with missing dependencies are skipped and reported as a partial failure.
    • For local installs without a work directory, the current PowerShell location is used.
  • Documentation
    • Updated local-package and reliability guidance to describe dependency handling and path resolution.

…etection

- Resolve -WorkDir, -LogDir and -DownloadDir against the PowerShell
  location instead of the process directory, before any relaunch, and
  forward the resolved paths so the elevated child (which starts in
  System32) uses the folders the user meant. -Source Local without
  -WorkDir now keeps the caller's folder across UAC.
- Skip a companion or additional app whose dependencies are missing and
  report a partial failure, instead of aborting before the Store is
  installed. Missing Store dependencies still stop the run (exit 4).
- Match -Source in Install-Store.cmd only as a whole option, so paths
  such as D:\my-source-pkgs no longer suppress the -Source Auto default.
- Add regression tests for each case, including a launcher test that
  runs the real detection line from Install-Store.cmd.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 566ee1da-cc55-4aad-bf6e-f06b2d4c1b6a
📥 Commits

Reviewing files that changed from the base of the PR and between fb29c01 and 14c9a08.

📒 Files selected for processing: 8
  • Install-Store.cmd
  • README.md
  • docs/installer-reliability.md
  • install.ps1
  • tests/Test-CmdLauncher.ps1
  • tests/Test-InstallerFlow.ps1
  • tests/Test-PackageSelection.ps1
  • tests/Test-ScopeAndCleanup.ps1

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The installer resolves paths before relaunch and forwards them to the child process. Shared dependency checks now distinguish missing framework dependencies, which stop ordering, from missing optional-app dependencies, which cause those apps to be skipped and counted as partial failures.

Changes: Installer flow

Layer / File(s) Summary
Resolve paths and relaunch
Install-Store.cmd, install.ps1, tests/Test-CmdLauncher.ps1, tests/Test-InstallerFlow.ps1, tests/Test-ScopeAndCleanup.ps1, docs/installer-reliability.md
The launcher clears the default -Source Auto only for an explicit -Source option. The installer resolves relative paths before relaunch and forwards resolved paths to the child. Tests cover source detection, path resolution, and relaunch parameters.
Check dependencies and filter optional apps
install.ps1, tests/Test-PackageSelection.ps1, tests/Test-InstallerFlow.ps1, README.md, docs/installer-reliability.md
Shared dependency checks support framework ordering and optional-app validation. Missing framework dependencies stop ordering; optional apps with missing dependencies are skipped and counted as partial failures. Tests and documentation describe these outcomes.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant Get_PackageDependencyState
  Installer->>Get_PackageDependencyState: Check package dependencies
  Get_PackageDependencyState-->>Installer: Return missing dependencies
  Installer->>Installer: Skip affected optional apps or stop framework ordering
Loading
Merge Risk: ⚪ Minimal · up to 14c9a

The change resolves relative paths before relaunch, skips optional apps with unmet dependencies, and fixes -Source detection in the launcher. No actionable merge-blocking risk remains. Real UAC and SYSTEM deployment runs were not covered by the supplied tests.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the three main changes: relative path handling, optional-app dependency handling, and launcher -Source detection.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (8 skipped: 8 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Softhe
Softhe merged commit 43c9e85 into main Oct 17, 2026
5 checks passed
@Softhe
Softhe deleted the fix/paths-optional-deps-cmd-source branch October 17, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant