Repository navigation
Preserve file destinations when migrations fail - #263
Merged
Mark Brown (markjbrown) merged 5 commits intoOct 31, 2026
Merged
Conversation
Stage overwrite output beside the destination, finalize before replacement, preserve access permissions, and report cleanup and append failures. Reject symbolic-link overwrite destinations and add deterministic file/CLI regression coverage for failures, cancellation, compression, and successful publication. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Distinguish staged local overwrite output from nontransactional append, cloud, and database sinks, and link the common lifecycle documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical Unix flaws can expose private migration data through initially permissive staging files and replace FIFO or device destinations with regular output files.
2 open issues
What changed in this PR
Addresses #251 by staging local file-sink overwrites and publishing them only after successful completion, protecting existing destinations from failed migrations.
Changes:
- Adds staged publication, permission handling, cleanup, and append-failure diagnostics.
- Adds shared-sink and real JSON/CLI regression coverage for failures, cancellation, compression, and destination preservation.
- Documents temporary-file lifecycle and the limits of overwrite protection.
| File | Description |
|---|---|
| Interfaces/Cosmos.DataTransfer.Common/README.md | Documents overwrite, permissions, cleanup, and append policies. |
| Interfaces/Cosmos.DataTransfer.Common/FileDataSink.cs | Implements staging, publication, validation, and failure handling. |
| Interfaces/Cosmos.DataTransfer.Common.UnitTests/FileDataSinkFailureTests.cs | Tests publication, failure preservation, permissions, and cleanup. |
| Extensions/Json/README.md | Clarifies local overwrite protection versus nontransactional sinks. |
| Core/Cosmos.DataTransfer.Core.UnitTests/RunCommandFileOutputTests.cs | Tests JSON pipeline output preservation and CLI exit codes. |
| Core/Cosmos.DataTransfer.Core.UnitTests/Cosmos.DataTransfer.Core.UnitTests.csproj | References the JSON extension for pipeline tests. |
Review effort: Balanced
Create Unix staging atomically with owner-only permissions and pass existing Windows DACLs during creation. Inspect Unix file types without opening destinations, reject nonregular entries, and cover creation-time permissions, FIFOs, sockets, and packaged overwrite behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the runtime's libSystem.Native import name and exercise owner-only container outputs under the host UID. Document bind-mount ownership without broadening output permissions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Summary
Fixes #251.
.dmt-*.tmpfile. Publish only after source enumeration, serialization, compression and stream disposal succeed; clean up staging files on handled failures.Copilot review fixes
Both findings were valid and are addressed in
51ee288and6b8da22:0600permissions, subject to umask, before applying any existing destination mode. New Unix overwrite outputs remain owner-only. Windows destination DACLs are supplied at creation rather than applied afterward. Tests inspect permissions immediately when creation returns, before formatting.libSystem.Nativelstat ABI, avoiding platform-specific libc struct layouts and any open/read of special files. Disposable FIFO/socket tests verify rejection before staging and preservation of the original entry.Validation
Current head:
6b8da227453b994f0ec35af1aaa87d8666df8fa5.No cloud accounts/resources or valuable data were used. This change does not add transactions to append, cloud-storage or database sinks. Existing dependency/analyzer warnings and integration-skip policies are unchanged.