Skip to content

fix(bindings): atomically replace persisted store - #21

Merged
postigodev merged 2 commits into
postigodev:mainfrom
xuyua9:codex/atomic-binding-store
Aug 26, 2026
Merged

fix(bindings): atomically replace persisted store#21
postigodev merged 2 commits into
postigodev:mainfrom
xuyua9:codex/atomic-binding-store

Conversation

@xuyua9

@xuyua9 xuyua9 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Make persisted binding updates resilient to interruption while preserving the existing bindings.json contents until the replacement is ready.

Changes

  • Serialize to a uniquely named file beside bindings.json.
  • Write the complete payload and call sync_all() before replacement.
  • Use an atomic same-directory rename on Unix-like systems.
  • Use Windows MoveFileExW with REPLACE_EXISTING | WRITE_THROUGH so replacing an existing file does not fail on Windows.
  • Clean up the temporary file when preparation or replacement fails.
  • Add a regression test for replacing and reloading persisted bindings.

Verification

  • cargo fmt --check
  • cargo test -p desk_remote_core -- --test-threads=1 (10 passed)
  • cargo check --workspace

The Windows-specific code was statically included behind cfg(windows); this environment does not have a Windows runtime target, so no Windows runtime test is claimed.

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

@xuyua9 is attempting to deploy a commit to the postigodev's projects Team on Vercel.

A member of the Team first needs to authorize it.

Co-authored-by: xuyua9 <15558128926@wo.cn>
@postigodev
postigodev merged commit 4eed317 into postigodev:main Aug 26, 2026
4 of 5 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