Skip to content

Trim unused rules from the editor's same-file check (keep WSL folding for discard holds) - #31669

Merged
nwparker merged 2 commits into
mainfrom
nwparker/editor-identity-trim
Oct 21, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/editor-identity-trim

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51 $\color{#cf222e}{\Huge{\mathbf{−}}}$​88 $\color{#cf222e}{\Huge{\mathbf{−}}}$​37
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37 $\color{#cf222e}{\Huge{\mathbf{−}}}$​65 $\color{#cf222e}{\Huge{\mathbf{−}}}$​28

ELI5

Removes rules from the editor's "is this the same file?" module that the plan no longer needs, so there's less code to keep correct. Nothing changes for users.

What Changed

  • editor-buffer-identity.ts no longer takes host facts, a captured SSH endpoint or a remote path flavor. SSH files are keyed by their connection target; if a connection is pointed at a different machine, the existing check that refuses to save over a file that changed on disk catches it.
  • Buffer identity keeps \\wsl$ and \\wsl.localhost paths apart (it no longer folds them).
  • The Source Control discard hold and the one-write-at-a-time lock still treat those two WSL forms as the same file on a local Windows client, through a small helper used only by them, so a discard through one form still pauses autosave of a tab opened through the other.

Why

The plan for sharing one buffer per file was simplified to rely on the guarded save rather than per-tab endpoint fingerprints and path-flavor rules. Nothing uses buffer identity for sharing yet, so trimming it now is behaviour-neutral and keeps the next step smaller. The WSL folding stays where it protects a discard: the guarded write isn't atomic against git, so the hold must cover both forms.

Linked Issue

Follow-up to #31272.

Visual Proof

N/A: no visible change.

Testing

  • Identity tests keep the protections against merging distinct files (exact case, POSIX backslash vs slash, UNC share case, UNC server folding, // only on a Windows client) and check SSH keys by target.

  • New regression: a discard through \\wsl$\Ubuntu\repo holds a \\wsl.localhost\ubuntu\repo\a.ts tab, while a case-different file and a real \\wsl\... share are not held.

  • 223 tests across identity, holds, autosave, save queue, write lock and combined diff pass; pnpm tc, check:code-quality:changed, oxfmt --check pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

No wire or persisted-state change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

nwparker and others added 2 commits October 21, 2026 14:25
…g from buffer identity

SSH files are keyed by connection target; the guarded save catches a retarget.
\\wsl$ and \\wsl.localhost stay distinct, including for discard holds and the
per-file write lock: main compares WSL writes at write time.

Co-Authored-By: Claude <noreply@anthropic.com>
A discard via \\wsl$ must hold autosave of a tab opened via \\wsl.localhost:
the local guarded write is not atomic against git. Buffer identity stays
unfolded; only the hold/lock key folds, on the local Windows client.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f6e364f3-d43a-49d8-801e-7713ad5ba4ea
📥 Commits

Reviewing files that changed from the base of the PR and between d6c9396 and 6caab71.

📒 Files selected for processing: 4
  • src/renderer/src/components/editor/editor-autosave-holds.test.ts
  • src/renderer/src/components/editor/editor-autosave-holds.ts
  • src/renderer/src/store/slices/editor/buffers/editor-buffer-identity.test.ts
  • src/renderer/src/store/slices/editor/buffers/editor-buffer-identity.ts

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

📝 Walkthrough

Editor buffer identity now derives path keys from the resolved owner and no longer uses host-fact or remote path-flavor arguments. Autosave hold keys normalize local Windows WSL UNC paths using the distro and Linux path. Tests cover identity behavior, WSL path matching, and path distinctions.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 6caab

WSL aliases match for discard holds without colliding with ordinary paths. No merge-blocking issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: removing unused editor same-file rules while preserving WSL folding for discard holds.
Description check Passed The description is complete and matches the requested template. It explains the change, rationale, issue reference, testing, visual impact, compatibility considerations, and scope. The full lint, type…
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.
Full details: Description check

Explanation

The description is complete and matches the requested template. It explains the change, rationale, issue reference, testing, visual impact, compatibility considerations, and scope. The full lint, typecheck, test, and build checklist remains unchecked, although partial validation is documented.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit f63e56a into main Oct 21, 2026
32 checks passed
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