You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(desktop): SnapShot shortcut setup says why it couldn't prepare or save the changes - #42154
When SnapShot shortcut setup couldn't prepare or save a Niri or Hyprland config change, the Advanced section showed only a generic "Couldn't prepare your capture shortcut changes." and hid the reason, such as a shortcut already used by Hyprland or a config that changed since the preview. The desktop error message now adds the underlying reason after the summary, so the setup screen's Advanced detail shows it.
Commit f692811 (origin/main). Built the desktop app with vp run build:desktop. A Playwright Electron script launched dist-electron/main.cjs under headless-desktop (Xvfb) with --no-sandbox --disable-gpu --ozone-platform=x11 and a faked Niri Wayland session: XDG_SESSION_TYPE=wayland, XDG_CURRENT_DESKTOP=niri, NIRI_SOCKET set to an absolute path, NIRI_CONFIG pointing at a config.kdl that contains a NUL byte, and an isolated HOME and T3CODE_HOME. In the app window it called window.desktopBridge.previewSnapShotConfig({operation:'install', shortcut:'Ctrl+Shift+2', chooseFile:false}). The promise rejected with only "Error invoking remote method 'desktop:preview-snap-shot-config': DesktopSnapShotSetupError: Couldn't prepare your capture shortcut changes." The desktop.trace.ndjson span desktop.snapShot.previewConfig held the real reason as [cause]: Error: Couldn't read your settings file. Choose a different file in Advanced. This was the bridge call the setup screen makes; the setup screen itself was not driven. A unit test on branch factory/repro-42146 shows the same for apply-config: the message stays 'Couldn't save your capture shortcut.' and leaves out the cause.
Evidence
Built and drove the real Electron app on Linux/Xvfb, with fresh isolated state, a simulated Niri Wayland session, a version-only synthetic Niri socket, identical 1100×780 windows and light theme. No error results were mocked. Stills show stable dialog crops; recordings have file paths redacted.
Steps on both commits: Settings → SnapShots → enable → Shortcut (Ctrl+Shift+2). For prepare, use a NUL-containing config, click Review changes, then Advanced. For save, preview a valid config, change it externally, click Save shortcut, then Advanced.
Base hides both causes. Head shows the unreadable-settings reason and the changed-since-preview reason in Advanced.
Not shown:
Hyprland shortcut-conflict errors and other filesystem failure causes were not individually exercised; the captures cover prepare failure from a malformed Niri config and save failure after external config modification.
Actual window capture and real Niri compositor integration were not exercised; this proof concerns setup error reporting and uses a simulated session with a version-only socket.
Tests
vp test run src/snapShot/DesktopSnapShot.test.ts (apps/desktop), before the fix: 2 failed (the repro tests), 50 passed
vp test run src/snapShot/DesktopSnapShot.test.ts (apps/desktop), after the fix: 52 passed
vp run check:changed: knip, typecheck, tests, fmt and lint all passed
The renderer's step headline still says 'Check Advanced for help.' even for reasons that don't mention Advanced. I left it as it is because changing it would be a wording change, not part of the bug.
Raw fs errors from reading the config (for example ENOENT) are not turned into friendlier wording before they are shown.
Who did the work
Written by Claude Opus 5.5, in Claude Code
Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5
No actionable comments were generated in the recent review.
Walkthrough
Preview and apply setup errors now include a nonempty cause message in their error text. Tests verify both actions.
Changes: Snapshot setup error messages
Layer / File(s)
Summary
Setup error messages and tests apps/desktop/src/snapShot/DesktopSnapShot.ts, apps/desktop/src/snapShot/DesktopSnapShot.test.ts
Preview and apply setup errors append the cause message when it is a nonempty Error.message. Tests check that both error messages include their supplied causes.
Setup errors for preparing or saving a shortcut change now include the underlying reason, such as a shortcut already in use or a config that changed since preview. This is a small, easily reversible message change and no merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the desktop SnapShot shortcut setup error change: setup now says why it could not prepare or save the changes. This matches the main change, which appends the underlying cause to previ…
Linked Issues check
[#42146] The issue requires that SnapShot setup show the reason a preview or apply fails. At head 1fa338e, DesktopSnapShotSetupError.message (apps/desktop/src/snapShot/DesktopSnapShot.ts) appends `…
Out of Scope Changes check
The whole-PR diff against merge base f692811 changes one source file, DesktopSnapShot.ts, plus its test file. Both changes serve #42146 directly. The PR description states that the renderer headline …
Description check
The description follows the repository template closely. It explains the problem (Advanced section shows only a generic summary, hiding the cause), the change (the desktop error message appends the un…
Full details: Title check
Explanation
The title names the desktop SnapShot shortcut setup error change: setup now says why it could not prepare or save the changes. This matches the main change, which appends the underlying cause to preview-config and apply-config setup error messages, and the added test covers both paths. The title is specific and follows a conventional commit format.
Full details: Linked Issues check
Explanation
[#42146] The issue requires that SnapShot setup show the reason a preview or apply fails. At head 1fa338e, DesktopSnapShotSetupError.message (apps/desktop/src/snapShot/DesktopSnapShot.ts) appends cause.message to the action summary for preview-config and apply-config failures. Only message crosses IPC, so the reason now reaches the Advanced detail. Other setup-error paths are unchanged, and unsupported-session still returns its own message. The PR adds a parameterized test in DesktopSnapShot.test.ts covering a Hyprland shortcut conflict and a stale preview for both actions. The issue does not require changing the underlying failure conditions, and the PR does not change them. The renderer was not driven, so the end-to-end display in Advanced is not verified by this review. The PR's Evidence section is still pending. That is a non-coding item and does not affect this verdict.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against merge base f692811 changes one source file, DesktopSnapShot.ts, plus its test file. Both changes serve #42146 directly. The PR description states that the renderer headline and raw fs error wording are unchanged. Those are exclusions, not extra changes. No unrelated change was found in the reviewed diff.
Full details: Description check
Explanation
The description follows the repository template closely. It explains the problem (Advanced section shows only a generic summary, hiding the cause), the change (the desktop error message appends the underlying reason after the summary), and links issue #42146 in scope. Verification is thorough: a reproduction on main, before/after screenshots and recordings, specific test commands with before/after counts, and a CI result. It also lists what was not checked and names the models used. Minor gaps: the Scope section does not say why the fix needs no issue (it links one, so this is fine), and the template's "Solve one underlying problem" requirement is met. The author's own note that the Hyprland conflict path was not exercised is disclosed.
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
Reviewing files that changed from the base of the PR and between 3b829b6 and 1fa338e.
Files selected for processing: 2
apps/desktop/src/snapShot/DesktopSnapShot.test.ts
apps/desktop/src/snapShot/DesktopSnapShot.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
1 participant
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.
When SnapShot shortcut setup couldn't prepare or save a Niri or Hyprland config change, the Advanced section showed only a generic "Couldn't prepare your capture shortcut changes." and hid the reason, such as a shortcut already used by Hyprland or a config that changed since the preview. The desktop error message now adds the underlying reason after the summary, so the setup screen's Advanced detail shows it.
Fixes #42146
Reproduction on main
Commit f692811 (origin/main). Built the desktop app with
vp run build:desktop. A Playwright Electron script launched dist-electron/main.cjs under headless-desktop (Xvfb) with --no-sandbox --disable-gpu --ozone-platform=x11 and a faked Niri Wayland session: XDG_SESSION_TYPE=wayland, XDG_CURRENT_DESKTOP=niri, NIRI_SOCKET set to an absolute path, NIRI_CONFIG pointing at a config.kdl that contains a NUL byte, and an isolated HOME and T3CODE_HOME. In the app window it called window.desktopBridge.previewSnapShotConfig({operation:'install', shortcut:'Ctrl+Shift+2', chooseFile:false}). The promise rejected with only "Error invoking remote method 'desktop:preview-snap-shot-config': DesktopSnapShotSetupError: Couldn't prepare your capture shortcut changes." The desktop.trace.ndjson span desktop.snapShot.previewConfig held the real reason as[cause]: Error: Couldn't read your settings file. Choose a different file in Advanced.This was the bridge call the setup screen makes; the setup screen itself was not driven. A unit test on branch factory/repro-42146 shows the same for apply-config: the message stays 'Couldn't save your capture shortcut.' and leaves out the cause.Evidence
Built and drove the real Electron app on Linux/Xvfb, with fresh isolated state, a simulated Niri Wayland session, a version-only synthetic Niri socket, identical 1100×780 windows and light theme. No error results were mocked. Stills show stable dialog crops; recordings have file paths redacted.
Steps on both commits: Settings → SnapShots → enable → Shortcut (Ctrl+Shift+2). For prepare, use a NUL-containing config, click Review changes, then Advanced. For save, preview a valid config, change it externally, click Save shortcut, then Advanced.
Drivers: prepare, save, video redaction.
Base hides both causes. Head shows the unreadable-settings reason and the changed-since-preview reason in Advanced.
Not shown:
Tests
vp test run src/snapShot/DesktopSnapShot.test.ts(apps/desktop), before the fix: 2 failed (the repro tests), 50 passedvp test run src/snapShot/DesktopSnapShot.test.ts(apps/desktop), after the fix: 52 passedvp run check:changed: knip, typecheck, tests, fmt and lint all passedNot in this change
Who did the work
Run by the t3code factory in T3 Code.