Repository navigation
App updates, favorites polish, in-app name dialog, drag & drop - #4
Conversation
- App updates from GitHub releases: startup/manual checks, NSIS in-place install, portable release-page notification, settings controls, and a tag-driven Windows release workflow (27 tests) - Favorites: order-preserving rename, picker rename/remove controls, and a path action that toggles Add/Remove (+2 tests) Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
Electron never implements window.prompt, so New Folder, New File, Rename (F2) and favorite naming silently did nothing in the packaged app. Replace all five prompt sites with a validated in-app dialog (inline errors, Enter/Esc, focus trap); new folders land selected. Add drag & drop inside and between panes, reusing the F5/F6 move/copy IPC: drag = move, Ctrl = copy, Shift = force move, cross-drive defaults to copy; folder rows/tiles, pane background, ".." and breadcrumbs are drop targets; whole-selection drag with an item-count chip; live target highlight and a Move/Copy hint; both panes refresh and ops log to the transcript. Same-folder moves and drops into a folder's own subtree are no-ops. 24 new tests (188 total); verified in a real Electron window: 14/14 UI checks. Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Review Summary
This is a large, well-structured PR covering auto-updates, favorites rename, the in-app text dialog replacing window.prompt, and drag-and-drop. The architecture is clean — pure modules with testable logic separated from DOM/IPC, the update flow is consent-based, and the security posture (IPC origin checks, navigation blocking, safeReleaseUrl validation) is solid.
Three issues require attention before merge:
Must Fix
-
src/main/update-service.ts— If the fallbacklookUpRelease()call inside theinstall-mode catch block throws (e.g., a secondary network error), the exception escapes unhandled and the service is permanently stuck in'checking'state. The user can never retry. Needs its own try/catch. (Comment posted on the relevant lines with a suggested fix.) -
.github/workflows/release.yml— The prerelease heuristic*-*matches any tag containing a hyphen, not just SemVer prerelease tags. A stable tag likev1.0-hotfixwould be incorrectly published as a prerelease. The check should anchor to SemVer format (v1.2.3-…). (Comment posted with a suggested fix.) -
src/main/favorites-store.ts—renameFavoriteuses.toLowerCase()on both sides when looking up the favorite by path, which is incorrect on POSIX (Linux/macOS) where paths are case-sensitive. This can cause false matches or miss the correct entry. The lookup should only be case-insensitive on Windows paths. (Comment posted.)
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| const nextLabel = typeof label === 'string' ? label.trim() : ''; | ||
| if (!nextLabel) throw new Error('Favorite name cannot be empty.'); | ||
| const current = await listFavorites(); | ||
| if (!current.some((favorite) => favorite.path.toLowerCase() === resolved.toLowerCase())) { |
There was a problem hiding this comment.
🛑 Logic Error: The case-insensitive path comparison using .toLowerCase() will incorrectly match distinct case-sensitive paths on POSIX systems (Linux/macOS). For example, /home/user/Docs and /home/user/docs are two different directories on Linux, but this check treats them as the same favorite, causing renameFavorite to find a false match (or miss the real one). Only Windows paths should be compared case-insensitively. This is inconsistent with the sameLocation utility in drag-drop.ts which applies lowercasing only for Windows paths.
| shopt -s nullglob | ||
| assets=(release-assets/*) | ||
| release_flags=() | ||
| if [[ "${GITHUB_REF_NAME}" == *-* ]]; then release_flags+=(--prerelease); fi |
There was a problem hiding this comment.
🛑 Logic Error: The prerelease detection heuristic *-* matches any tag containing a hyphen, not just SemVer prerelease identifiers. This will incorrectly flag a stable tag like v1.0-hotfix or v2.0-windows as a prerelease. The pattern should check for a hyphen in the version part after the patch number only (e.g., v1.2.3-beta.1), not anywhere in the tag name.
| if [[ "${GITHUB_REF_NAME}" == *-* ]]; then release_flags+=(--prerelease); fi | |
| if [[ "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+- ]]; then release_flags+=(--prerelease); fi |
| } catch (error) { | ||
| // A release published without its update manifest (latest.yml), or one | ||
| // the installer cannot read, should still be announced: fall back to | ||
| // the release page, and offer the download link instead of an install. | ||
| const fallback = await this.lookUpRelease(); | ||
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | ||
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); |
There was a problem hiding this comment.
🛑 Logic Error: When lookUpRelease() itself throws (e.g., a secondary network error during the fallback), the exception propagates up and is caught by the outer catch (error) block at line 104. At that point, error is the original checkForUpdates exception, not the error from lookUpRelease — but the actual runtime failure was in lookUpRelease. The error message shown to the user will describe the wrong failure, making diagnosis difficult. Additionally, lookUpRelease is not awaited in a try/catch of its own here, so a throw from it silently replaces the error context. Consider catching errors from lookUpRelease separately.
| } catch (error) { | ||
| // A release published without its update manifest (latest.yml), or one | ||
| // the installer cannot read, should still be announced: fall back to | ||
| // the release page, and offer the download link instead of an install. | ||
| const fallback = await this.lookUpRelease(); | ||
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | ||
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); | ||
| } |
There was a problem hiding this comment.
🛑 Crash Risk: If lookUpRelease() throws (e.g., a network error during the fallback fetch), the exception escapes the outer catch block unhandled, leaving the service permanently in the 'checking' state. The user will see the spinner forever and cannot re-trigger a check, because check() guards against re-entry when status === 'checking'.
Wrap lookUpRelease() in its own try/catch so a failure there still transitions the state to 'error'.
| } catch (error) { | |
| // A release published without its update manifest (latest.yml), or one | |
| // the installer cannot read, should still be announced: fall back to | |
| // the release page, and offer the download link instead of an install. | |
| const fallback = await this.lookUpRelease(); | |
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | |
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); | |
| } | |
| } catch (error) { | |
| // A release published without its update manifest (latest.yml), or one | |
| // the installer cannot read, should still be announced: fall back to | |
| // the release page, and offer the download link instead of an install. | |
| try { | |
| const fallback = await this.lookUpRelease(); | |
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | |
| } catch { | |
| // fallback also failed; fall through to report the original error | |
| } | |
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); | |
| } |
Review follow-up: favorite path keys lowercase only Windows paths, so POSIX directories differing by case stay distinct (matches drag-drop's sameLocation rule). The release workflow marks a tag prerelease only when a hyphen follows the patch version, not anywhere in the tag name. Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
|
Review follow-up merged (60dbac6): favorite path keys now lowercase only Windows paths (POSIX case-distinct directories stay separate, matching drag-drop's sameLocation rule; +2 tests), and the release workflow marks prerelease only when a hyphen follows the patch version (v1.0-hotfix stays stable). The two update-service flags were checked against the code and are false positives: lookUpRelease() has its own try/catch and always returns an UpdateState, so it cannot throw into the outer catch or leave the service stuck in 'checking'. Merged as 8a071f2. |
What's in here
Two commits covering the verified-but-uncommitted work from the last two batches:
1. Consent-based app updates + favorites polish (
046eacc)2. In-app name dialog + Explorer-style drag & drop (
df40d10)window.prompt(), so New Folder, New File (type + name), Rename (F2) and favorite naming silently did nothing in the packaged app — in both panes. All five prompt sites now use a validated in-app dialog (inline errors, Enter/Esc, focus trap, autofocus + select); new folders land selected. Delete already usedwindow.confirm(supported) and is unchanged...row, breadcrumb segments — in either pane. Whole-selection drag with an item-count chip, live drop-target highlight and a Move/Copy hint in the pane footer. Both panes refresh and each op logs to the transcript. Same-folder moves and drops into a folder's own subtree are no-ops; same-folder Ctrl-copy gets the existing "(n)" clash suffix.src/shared/text-dialog.tsandsrc/shared/drag-drop.tsfollow the existingpane-*testable-module pattern (24 new tests).Verification
npm run cigreen on the final tree: typecheck + 188 tests (was 164) + build;git diff --checkclean.Notes
v*tag.webUtils.getPathForFile) — easy follow-up.npm auditfindings in the Vitest/electron-builder chains unchanged; no forced upgrades.