fix: state 读路径瞬态 IO 有界重试,消除 Windows 防病毒 flaky(CI 假阴性) - #28
Merged
Conversation
根因:合并 #27 后 main 的 Launcher Test(windows-latest)偶发失败,断言 readState 在 writeState 成功后读回 ok=false。经核对,合并提交只改动 dsh-hotplug-hub 侧文件(client/market/paths/test),未触碰 launcher;同一代码在特性分支 CI 通过、本地 300 次回环全通过,判定为 Windows 防病毒/过滤驱动瞬时占用刚落盘文件导致 readFileSync 抛 EPERM/EACCES/EBUSY/EAGAIN/EINTR 的瞬态失败,readState 误判为 state.json 损坏。 修复: - launcher/infra/store.js 新增 readFileSyncRetry:仅对瞬态 IO 错误码(EPERM/EACCES/EBUSY/EAGAIN/EINTR)做有界重试(默认 5 次、线性退避),确定性失败(JSON 解析、schema 校验、EISDIR 等)立即抛出,绝不掩盖真实损坏。 - 新增 3 个回归测试:瞬态 EPERM 恢复、持久 EPERM 有界耗尽、非瞬态错误不重试。 本地验证:launcher 全量 523 测试通过(+3)、lint/depcheck 通过、fs-fault-injection 15/15、concurrency 13/13。
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
合并 #27 后,
main的 Launcher Test(windows-latest) 偶发失败:根因
ad75113只改动dsh-hotplug-hub/(client.js / market.js / paths.js / market.test.mjs),未触碰 launcher;同一代码在特性分支 CI 通过、本地 300 次 write→read 回环全通过 → 判定为 Windows 防病毒/过滤驱动瞬时占用刚落盘文件,导致readFileSync抛EPERM/EACCES/EBUSY/EAGAIN/EINTR,readState误判为 "state.json 损坏"。修复
launcher/infra/store.js:新增readFileSyncRetry,仅对瞬态 IO 错误码(EPERM/EACCES/EBUSY/EAGAIN/EINTR)做有界重试(默认 5 次、线性退避);确定性失败(JSON 解析、schema 校验、EISDIR 等)立即抛出,绝不掩盖真实损坏。验证