Skip to content

fix: state 读路径瞬态 IO 有界重试,消除 Windows 防病毒 flaky(CI 假阴性) - #28

Merged
YisfL merged 1 commit into
mainfrom
fix/v1.0.1-flaky-state-read
Aug 23, 2026
Merged

fix: state 读路径瞬态 IO 有界重试,消除 Windows 防病毒 flaky(CI 假阴性)#28
YisfL merged 1 commit into
mainfrom
fix/v1.0.1-flaky-state-read

Conversation

@YisfL

@YisfL YisfL commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

问题

合并 #27 后,mainLauncher Test(windows-latest) 偶发失败:

FAIL test/qa3-store-atomic.test.js > writeState:成功写入后可 readState 读回且 schemaVersion 正确
AssertionError: expected false to be true

根因

  • 合并提交 ad75113 只改动 dsh-hotplug-hub/(client.js / market.js / paths.js / market.test.mjs),未触碰 launcher;同一代码在特性分支 CI 通过、本地 300 次 write→read 回环全通过 → 判定为 Windows 防病毒/过滤驱动瞬时占用刚落盘文件,导致 readFileSyncEPERM/EACCES/EBUSY/EAGAIN/EINTRreadState 误判为 "state.json 损坏"。
  • 重跑同一 job 后立即通过(瞬态 flake 实证,非合并引入的回归)。

修复

  • 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
  • 版本号维持 1.0.1(本次为缺陷修复,不 bump 版本)

根因:合并 #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。
@YisfL
YisfL requested a review from ARFCON as a code owner August 23, 2026 14:02
@YisfL
YisfL merged commit fdf9228 into main Aug 23, 2026
21 of 22 checks passed
@YisfL
YisfL deleted the fix/v1.0.1-flaky-state-read branch August 23, 2026 14:15
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