Repository navigation
fix(desktop): validate Windows install paths before cleanup - #773
yuzhiyang1 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Approve (0 findings)
Scope: base main, merge base 38174d1a, 1 commit, 3 files (apps/desktop/AGENTS.md, apps/desktop/src/main/local-server.ts, apps/desktop/src/main/local-server.test.ts) reviewed at 64bdcff0. I didn't load the helper skills (coderbook, ponytail-review, karpathy-guidelines). The checklist from the review instructions was applied directly. Ran in a separate session.
Findings
None.
Verified as fine
- The refusal happens before any install state changes. In
#install, the only steps before the Windows private-path preflight are progress/sign-in resets (local-server.ts:1330-1334).#adoptSourceKeys, which moves.envkeys intoinstances/<local>/user.env(local-server.ts:2522), and#pruneSourcesnow run only aftercheckPrivate(home)and the daemon-directory check succeed (local-server.ts:1339-1372). - The preflight is non-destructive.
windowsPrivateLocationsendsrepair: falseto the ACL worker and only throws on a non-zero result (packages/local-installation/src/windows-private.ts:755-775). Moving it earlier doesn't create or alter folders. - The disk check now runs after pruning, so space reclaimed from unused sources is counted (
local-server.ts:1373-1387). Pruning still keeps the runningrecord.repoand the current archive prefix (local-server.ts:1366-1371), so a disk-space refusal afterwards removes nothing in use. - The
#locationErrorgate (local-server.ts:1335) applies on every platform and to every picker rejection, including disk space. This matches the setup page, which already disables Install wheneverlocation.erroris set (apps/desktop/src/shell/setup.html:4066-4070). The server now enforces what the UI already shows.chooseLocation(null)clears the error (local-server.ts:856-858). The only caller ofbeginissetup-window.ts:311. - The tests fail without the fix. I ran the two new or changed tests against the merge-base
local-server.ts, and both failed. The refusal test got past the preflight and failed later on the Node download. The unsafe-selection test did not blockbegin(). At the head, the focused Windows / install-location subset passes: 22 passed. - Daemon-directory refusal is still covered after the old home-refusal test was rewritten (
local-server.test.ts:3696). - The Windows quick-install test now stubs
checkPrivateLocation(local-server.test.ts:4094). This is needed because the private check now runs before the disk check. It doesn't hide a real side effect, since the real check is read-only. - Docs:
apps/desktop/AGENTS.mddescribes the new order and the blocking behavior. The PR body's claims (refuse before migrating or pruning, block until a valid pick or reset, disk check after cleanup) match the diff. - No CJK in added lines or the commit message. No merge or fixup commits.
Process notes
- The branch is 3 commits behind
main, which requires up-to-date branches, so it needs a rebase before merge. - GitHub reports no CI checks on
codex/windows-install-preflight. Make sure the required checks run after the rebase.
CI
No checks reported for this branch. Locally I ran vitest run src/main/local-server.test.ts -t "Windows|install location|unsafe" in apps/desktop: 22 passed, 162 skipped. The same two new tests fail on the merge-base source, as expected. I didn't run Desktop typecheck, lint, or the full suite.
Automated review by Claude Code
Automated review of 64bdcff by Claude Code.
What and why
Windows setup already checks the selected installation path. Run that check again before migrating settings or pruning older sources so a refused path leaves those files intact. When the picker rejects a new location, block installation until the user picks a valid folder or explicitly resets to the default.
The disk-space check still runs after source cleanup so it includes reclaimed space. This complements the picker guidance in #666 and uses the volume-root ACL policy already on main.
How it was verified
Boundary
Desktop setup only. Updated the Desktop contributor notes to document install validation order.