Skip to content

fix(desktop): SnapShot shortcut setup says why it couldn't prepare or save the changes - #42154

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-42146
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-42146

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

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.

Before After
f692811b95 1fa338e912
Before: prepare error hides cause After: prepare error explains unreadable settings
Prepare recording Prepare recording
Before: save error hides cause After: save error explains changed config
Save recording Save recording

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:

  • 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
  • PR CI on 1fa338e: all 38 checks passed

Not in this change

  • 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

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 24, 2026 13:00
…enderer

Failing repro for #42146.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… save the changes

Fixes #42146

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · up to 1fa33

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed [#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 Passed 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 Passed 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
Recent review info

Run configuration

Commits

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.

@juliusmarminge
juliusmarminge merged commit 9bce884 into main Nov 24, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-42146 branch November 24, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SnapShot shortcut setup hides why it couldn't prepare or save the changes

1 participant