Repository navigation
fix: Windows 选路径、文件占用重试、主循环退出事件、潜影盒 #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6b6fb34
fix(webui): Windows 选路径脚本改回 [Console],选中的路径能传回来
Phantivia 953a298
fix(core): 状态与定时器落盘遇到 Windows 文件占用时退避重试
Phantivia aaa7d68
fix(protocol): 会话记录追加与重写遇到 Windows 文件占用时退避重试
Phantivia 1fa206e
fix(worlds/minecraft): 潜影盒进箱子族名单,能找到、取放、记账
Phantivia fbf49fc
feat(core): 主循环异常退出的日志带 event loop-exit,宿主据此重启
Phantivia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Windows 上杀毒软件、索引器、同步盘会在文件刚写完时短暂独占打开它,这时 rename 与 open | ||
| * 报 EBUSY、EPERM 或 EACCES。做法同 graceful-fs:只在 Windows 上对这三种错误退避重试, | ||
| * 这里是同步调用,总共等约半秒;仍失败就照原样抛出。其他平台与其他错误立即抛出。 | ||
| */ | ||
| const BUSY_CODES = new Set(['EBUSY', 'EPERM', 'EACCES']); | ||
| const BACKOFF_MS = [10, 30, 60, 120, 250]; | ||
| const sleeper = new Int32Array(new SharedArrayBuffer(4)); | ||
|
|
||
| export function retryBusy<T>(op: () => T): T { | ||
| for (const ms of BACKOFF_MS) { | ||
| try { | ||
| return op(); | ||
| } catch (e) { | ||
| if (process.platform !== 'win32' || !BUSY_CODES.has((e as NodeJS.ErrnoException).code ?? '')) throw e; | ||
| Atomics.wait(sleeper, 0, 0, ms); | ||
| } | ||
| } | ||
| return op(); | ||
| } |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两处 bug 修复的 diff 里没有能在修复前失败的测试。
CONTRIBUTING.md「What is accepted」要求:Bug fixes in the runtime, the WebUI, the extension loader and the bundled Worlds and providers, with a test that fails before the fix.
src/worlds/minecraft/chests.ts第 15 行:17 种潜影盒进入CHEST_BLOCKS(chestsIn/CONTAINER_FIND/ take 都读这份名单)。tests/worlds/minecraft/chests.test.ts已有「chestsIn 只回箱子族」用例,本 diff 没给潜影盒加上对应断言。src/web/path-picker.ts第 160、182、184 行:[WebUI]::改回[Console]::。diff 里没有覆盖WINDOWS_SCRIPT的测试。请补上修复前会失败的测试,或把不测的理由写进 PR 说明。
— Cortico PR Gate via Cursor Cloud Agent