Skip to content

fix: write metas file atomically - #105

Merged
weixiao-huang merged 1 commit into
MoonshotAI:mainfrom
WangXukang-cypher:fix/atomic-metas-file-write
Sep 4, 2026
Merged

fix: write metas file atomically#105
weixiao-huang merged 1 commit into
MoonshotAI:mainfrom
WangXukang-cypher:fix/atomic-metas-file-write

Conversation

@WangXukang-cypher

Copy link
Copy Markdown
Contributor

Summary

Write the exported metas file atomically in examples/update.py by writing to a temporary file, fsyncing it, and replacing the target path only after the write completes.

Also wrap metas file loading errors with a clearer message so interrupted or truncated saves are reported as corrupted metadata instead of surfacing a low-level JSON validation error.

Test Plan

  • python -m py_compile examples\update.py
  • git diff --check
  • python -m pre_commit run --all-files --show-diff-on-failure
    • ruff: Passed
    • ruff format: Passed
    • codespell: Passed

Comment thread examples/update.py Outdated
@WangXukang-cypher
WangXukang-cypher force-pushed the fix/atomic-metas-file-write branch from 10da00d to b44c816 Compare September 4, 2026 12:03
@weixiao-huang
weixiao-huang merged commit 03126b8 into MoonshotAI:main Sep 4, 2026
2 checks passed
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.

2 participants