Skip to content

fix(desktop): validate Windows install paths before cleanup - #773

Open
yuzhiyang1 wants to merge 1 commit into
simplexai-labs:mainfrom
yuzhiyang1:codex/windows-install-preflight
Open

yuzhiyang1 wants to merge 1 commit into
simplexai-labs:mainfrom
yuzhiyang1:codex/windows-install-preflight

Conversation

@yuzhiyang1

Copy link
Copy Markdown

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

  • Windows install-location regressions, including preserving existing source settings and refusing to launch after an invalid selection.
  • Full Desktop fast checks. Desktop lint, formatting, and commit hooks passed. The Desktop test suite had 653 passes, 24 skips, and one Windows resume-fixture failure reproduced on the upstream base. The default typecheck reports the same 108 DOM diagnostics on both revisions. The Desktop typecheck passes when the DOM library is supplied for the check. The cross-platform daemon build was not run locally.
  • Contracts unchanged.

Boundary

Desktop setup only. Updated the Desktop contributor notes to document install validation order.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .env keys into instances/<local>/user.env (local-server.ts:2522), and #pruneSources now run only after checkPrivate(home) and the daemon-directory check succeed (local-server.ts:1339-1372).
  • The preflight is non-destructive. windowsPrivateLocation sends repair: false to 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 running record.repo and the current archive prefix (local-server.ts:1366-1371), so a disk-space refusal afterwards removes nothing in use.
  • The #locationError gate (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 whenever location.error is 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 of begin is setup-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 block begin(). 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.md describes 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.

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