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(extensions): keep Windows settings saves atomic while a reader is active - #995
Saving Desktop extension settings can fail on Windows while a reader still has settings.json open. Keep the complete replacement file beside its destination and retry the atomic rename on Windows sharing errors. Five bounded delays allow 560 ms for a reader to finish. A persistent failure reaches the caller and the temporary file is cleaned up.
Related issues
Observed in the Windows check on #948 after the Desktop extensions merge in #992. The same failure reproduced locally against main with a real open file handle.
Test plan
Added a Windows regression test that holds the old settings file open, releases it during save, and checks the persisted revision and directory contents. It failed with EPERM before the change and passed after it.
Ran the harness-plugin-files Vitest suite on Windows x64. 76 passed and one was skipped.
Package TypeScript build, ESLint for both changed files, and git diff --check passed.
The change is confined to saving Desktop extension settings and can be reverted without a data migration.
The branch inherits the nine TypeScript errors on main tracked in #994. As an integration check, I combined #994, this change, and the heads of #948, #978, and #990 in a disposable worktree. npm run typecheck, npm run lint, and npm run format:check all passed.
This change makes saving Desktop extension settings on Windows tolerate a reader briefly holding the old settings file open. The retries are bounded, so a persistent failure still reaches the caller. Rollback is simple and needs no data migration. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
标题“fix(extensions): keep Windows settings saves atomic while a reader is active”描述了主要变更:当读取器仍打开设置文件时,Windows 上的设置保存保持原子替换。变更集中在 desktop-extension-data.ts 中为设置文件重命名增加 Windows 共享冲突重试,并新增对应的 Windows 回归测试…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
标题“fix(extensions): keep Windows settings saves atomic while a reader is active”描述了主要变更:当读取器仍打开设置文件时,Windows 上的设置保存保持原子替换。变更集中在 desktop-extension-data.ts 中为设置文件重命名增加 Windows 共享冲突重试,并新增对应的 Windows 回归测试,二者与标题一致。标题清晰、具体,可判定为通过。
Full details: Description check
Explanation
PR 描述与变更集直接相关。描述说明了问题:Windows 上读取器仍打开 settings.json 时保存 Desktop 扩展设置会失败。描述还说明了修复方式:保留完整替换文件、对 Windows 共享错误重试原子重命名、使用五个有界延迟(共 560 ms),并在持续失败时把错误抛给调用方并清理临时文件。测试计划也与 desktop-extension-data.test.ts 中新增的 Windows 回归测试相符。
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
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.
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
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.
Summary
Saving Desktop extension settings can fail on Windows while a reader still has
settings.jsonopen. Keep the complete replacement file beside its destination and retry the atomic rename on Windows sharing errors. Five bounded delays allow 560 ms for a reader to finish. A persistent failure reaches the caller and the temporary file is cleaned up.Related issues
Observed in the Windows check on #948 after the Desktop extensions merge in #992. The same failure reproduced locally against
mainwith a real open file handle.Test plan
EPERMbefore the change and passed after it.git diff --checkpassed.The change is confined to saving Desktop extension settings and can be reverted without a data migration.
The branch inherits the nine TypeScript errors on
maintracked in #994. As an integration check, I combined #994, this change, and the heads of #948, #978, and #990 in a disposable worktree.npm run typecheck,npm run lint, andnpm run format:checkall passed.