Skip to content

fix(web): open editors when saving their preference fails - #34308

Open
romil-bijarnia wants to merge 1 commit into
pingdotgg:mainfrom
romil-bijarnia:publish/editor-storage-isolation
Open

romil-bijarnia wants to merge 1 commit into
pingdotgg:mainfrom
romil-bijarnia:publish/editor-storage-isolation

Conversation

@romil-bijarnia

Copy link
Copy Markdown
Contributor

Problem

Open in editor awaits an optional preference read/write before issuing its launch command. Invalid JSON in t3code:last-editor, or a full browser storage quota, therefore prevents opening the editor even though a valid editor is available and the action is authorized.

Change

Treat preference reads as optional and preference writes as best effort. Fall back to an available editor and continue the existing launch command; permission checks and editor routing are unchanged.

Scope and approval

This is a focused fix for an existing behavior, submitted under the small obvious-bug exception in CONTRIBUTING.md. It adds no setting, contract or new workflow. Current open-PR searches and relevant patches were checked before submission.

#33015 changes local/remote routing; #33558 passes a project root for JetBrains; #30660 adds terminal editors. Their paths still call the throwing preference helper. This does not duplicate those changes.

Verification

The extended unit cases fail before the fix and pass afterward. A separate Chromium run used the production storage helpers and hook in a real React root, with actual browser localStorage:

Storage state Before After
Invalid stored JSON decode failure, launch RPC not called Success, one launch RPC
Quota filled in an isolated browser origin QuotaExceededError, launch RPC not called Success, one launch RPC

The browser's quota was actually filled; this was not a mocked QuotaExceededError. Authorization and the final launch RPC were test doubles. No real editor process was launched, and no user browser profile was touched. This is action/error-path evidence, not a claim of a full desktop launch test.

Current publication branch is based on upstream d835e430dbc2863fb5bd9f2c76456e4773b0e0ef. vp run check:changed d835e430dbc2863fb5bd9f2c76456e4773b0e0ef --concurrency 2 passes formatting, lint, Knip, affected-package typechecks and the selected tests; applicable GraphQL/React compiler checks also pass. No repository-wide suite was substituted for the focused reproduction.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 11, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 8285502

Macroscope's review found this PR approvable — Editor launches can continue when reading or saving the preferred editor fails, using the existing fallback selection. Authorization and editor-selection defaults remain unchanged, keeping the change narrowly scoped.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The preferred-editor resolver now handles local-storage read and write failures without blocking editor selection. Tests verify that opening a path succeeds when either storage operation throws.

Changes: Preferred editor fallback

Layer / File(s) Summary
Fallback selection and launch validation
apps/web/src/editorPreferences.ts, apps/web/src/editorPreferences.test.ts
The resolver warns when reading or saving the preferred editor fails, then uses an available editor when needed. Tests check that opening the requested path succeeds after either failure.

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

Change: Bug fix

Possibly related PRs

Suggested labels: bugfix, size:S

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 82855

Opening an editor no longer fails when saved-preference storage is unreadable or full. The change is narrow and tested, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main fix: editor opening continues when saving the editor preference fails. It uses the expected conventional commit format.
Description check Passed The description includes all required sections. It explains the problem, change, scope rationale, focused verification, observed results, limitations, and broader check results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • 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 54a5c51 and 8285502.

Files selected for processing: 2

  • apps/web/src/editorPreferences.test.ts
  • apps/web/src/editorPreferences.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant