fix(checkpoint): 规范化共享锁的文件路径 - #677
Open
Qiyuanqiii wants to merge 1 commit into
Open
Conversation
Signed-off-by: Qiyuanqiii <2297740147@qq.com>
Author
|
YOMXXX老师 |
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.
关联 Issue
Related to #157
背景与定位
#177 是维护者确认的 checkpoint 计数重校准标准修复,#474 负责 Persona 生成期间的并发更新保留。
本 PR 不实现另一套
recalibrate(),而是修复现有 checkpoint 文件锁未覆盖路径别名的问题。问题根因
CheckpointManager使用全局fileLocksMap,按 checkpoint 文件路径字符串共享进程内锁。代码注释声明锁按 resolved file path 管理,但构造函数实际使用
path.join()。因此相对路径与绝对路径即使指向同一个recall_checkpoint.json,仍会产生两个不同的锁键。两个 mutation 可以同时读取相同旧快照。临时文件加原子 rename 只能防止文件撕裂,无法防止 last-write-wins:
total_processed = 21runner_states也会丢失实现方案
CheckpointManager构造阶段使用path.resolve()固定 checkpoint 的绝对路径。..的路径和绝对路径现在共享同一个锁身份。兼容性与边界
本 PR 不包含:
相对
dataDir仍按当前工作目录解析,只是解析结果在构造时固定,避免后续锁身份分裂。修复前证据
新增测试在当前
main上稳定失败:验证
1/1通过10/10通过5个文件、68项测试通过git diff --check:通过验证截图