[PR #957] [MERGED] fix(windows): remove cancelled snapshot outputs #2533

Closed
opened 2026-10-17 21:07:15 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/957
Author: @morluto
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @morluto

Base: main ← Head: codex/windows-snapshot-cancel-cleanup


📝 Commits (3)

  • 30ebd6d fix(windows): remove cancelled snapshot outputs
  • 4b33cc8 fix(windows): allow readback of retained runtime files
  • e020465 test(windows): verify retained runtime file protection

📊 Changes

2 files changed (+73 additions, -5 deletions)

View changed files

📝 native/windows/src/filesystem.cc (+22 -5)
📝 scripts/verify-windows-native.mjs (+51 -0)

📄 Description

Summary

When an admitted Windows snapshot is cancelled or fails during asynchronous copying, its promise rejects but the FILE_CREATE destination previously remained in the private runtime until runtime close. The completion callback now deletes that incomplete destination through its retained handle before rejecting. If deletion fails, the error reports both the snapshot failure and the cleanup failure. The Windows native verifier checks that cancelled.bin is absent before runtime close.

Successful runtime writes and snapshots retain handles with write and delete access. Windows requires later read handles to share those access categories, so runtime readback now requests read, write, and delete sharing. The retained handles themselves still omit write and delete sharing, blocking competing mutation. The verifier exercises the production WindowsPrivateRuntime.readFile() path for both a written file and a completed snapshot while their runtimes remain open, then verifies overwrite, rename, and deletion are rejected and the data remains readable.

This covers asynchronous completion failures and cancellation; synchronous setup failures before the worker is queued remain outside this change.

Verification

  • npm run format:check
  • npm run build:cached
  • npm run check:fast
  • npm run test:local -- src/windows/WindowsNativeLoader.test.ts src/windows/WindowsOwnedProcess.test.ts — 21 tests
  • node --check scripts/verify-windows-native.mjs
  • git diff --check origin/main...HEAD

The hosted Windows x64 build and verify:windows-native lane validate native compilation, cancellation cleanup, readback, and retained-file mutation denial.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/957 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/windows-snapshot-cancel-cleanup` --- ### 📝 Commits (3) - [`30ebd6d`](https://github.com/morluto/rea/commit/30ebd6dcfe2f07dbedb54e6199de77822dafd668) fix(windows): remove cancelled snapshot outputs - [`4b33cc8`](https://github.com/morluto/rea/commit/4b33cc8b06d283c8aa71aeabdc77ce7e6f4d2613) fix(windows): allow readback of retained runtime files - [`e020465`](https://github.com/morluto/rea/commit/e020465e6c05782e3c0ddfa57fc9f61968508501) test(windows): verify retained runtime file protection ### 📊 Changes **2 files changed** (+73 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `native/windows/src/filesystem.cc` (+22 -5) 📝 `scripts/verify-windows-native.mjs` (+51 -0) </details> ### 📄 Description ## Summary When an admitted Windows snapshot is cancelled or fails during asynchronous copying, its promise rejects but the `FILE_CREATE` destination previously remained in the private runtime until runtime close. The completion callback now deletes that incomplete destination through its retained handle before rejecting. If deletion fails, the error reports both the snapshot failure and the cleanup failure. The Windows native verifier checks that `cancelled.bin` is absent before runtime close. Successful runtime writes and snapshots retain handles with write and delete access. Windows requires later read handles to share those access categories, so runtime readback now requests read, write, and delete sharing. The retained handles themselves still omit write and delete sharing, blocking competing mutation. The verifier exercises the production `WindowsPrivateRuntime.readFile()` path for both a written file and a completed snapshot while their runtimes remain open, then verifies overwrite, rename, and deletion are rejected and the data remains readable. This covers asynchronous completion failures and cancellation; synchronous setup failures before the worker is queued remain outside this change. ## Verification - `npm run format:check` - `npm run build:cached` - `npm run check:fast` - `npm run test:local -- src/windows/WindowsNativeLoader.test.ts src/windows/WindowsOwnedProcess.test.ts` — 21 tests - `node --check scripts/verify-windows-native.mjs` - `git diff --check origin/main...HEAD` The hosted Windows x64 build and `verify:windows-native` lane validate native compilation, cancellation cleanup, readback, and retained-file mutation denial. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:15 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2533
No description provided.