Ensure VFS state is restored after storage conflicts#3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
sandfs/vfs.py
Outdated
| previous_content = node.read(self) | ||
| previous_provider = getattr(node, "_provider", None) |
There was a problem hiding this comment.
Do not force provider read before every write
The new rollback logic in VirtualFileSystem.write_file (sandfs/vfs.py lines 314‑315) now reads the existing file contents via node.read(self) before every write so it can restore them later. For provider‑backed files, VirtualFile.read (sandfs/nodes.py lines 57‑65) calls the provider and raises ProviderError if the provider fails. Before this change, write_file never touched the provider; callers could overwrite a file even if its provider was currently broken. After this change any failure while reading the provider aborts the write before it even attempts to persist, meaning users can no longer replace or repair a provider‑backed file whose provider errors out. To avoid this regression the rollback data should be captured from the node’s cached attributes (_content and _provider) without invoking the provider.
Useful? React with 👍 / 👎.
|
Summary
Testing
|
Summary
Testing
Codex Task