Skip to content

Comments

Make VFS locking APIs explicit by removing default lock/unlock implementations#70

Merged
carlsverre merged 2 commits intomainfrom
copilot/make-locking-vfs-methods-mandatory
Feb 20, 2026
Merged

Make VFS locking APIs explicit by removing default lock/unlock implementations#70
carlsverre merged 2 commits intomainfrom
copilot/make-locking-vfs-methods-mandatory

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

This change removes implicit locking behavior from the Vfs trait to reduce accidental misuse. lock, unlock, and check_reserved_lock are now required trait methods, marking an intentional breaking change for the next major/minor incompatible release (0.7.0).

  • Trait API (breaking)

    • Removed default bodies for:
      • Vfs::lock
      • Vfs::unlock
      • Vfs::check_reserved_lock
    • Implementers must now define locking semantics explicitly.
  • Internal/example implementers updated

    • Updated MockVfs test implementation to provide the required methods.
    • Updated examples/memvfs.rs to implement check_reserved_lock in addition to existing lock/unlock methods.
  • Changelog

    • Added 0.7.0 (unreleased) entry documenting the incompatible API change and what downstream implementers must do.
pub trait Vfs: Send + Sync {
    // ...
    fn lock(&self, handle: &mut Self::Handle, level: LockLevel) -> VfsResult<()>;
    fn unlock(&self, handle: &mut Self::Handle, level: LockLevel) -> VfsResult<()>;
    fn check_reserved_lock(&self, handle: &mut Self::Handle) -> VfsResult<bool>;
    // ...
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Make locking VFS methods mandatory</issue_title>
<issue_description>This will result in an incompatible release, but will make it less of a footgun to use. If users want existing behavior, they can stub back in the default methods.</issue_description>

<agent_instructions>remove the default implementations of lock, unlock, and check locked methods on the vfs trait. fix the example vfs and tests if needed. add changelog entry for 0.7.0 (unreleased) with a clear message on the incompatible version bump</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: carlsverre <82591+carlsverre@users.noreply.github.com>
Copilot AI changed the title [WIP] Make locking VFS methods mandatory for improved safety Make VFS locking APIs explicit by removing default lock/unlock implementations Feb 20, 2026
Copilot AI requested a review from carlsverre February 20, 2026 17:10
@carlsverre carlsverre marked this pull request as ready for review February 20, 2026 17:36
@carlsverre carlsverre merged commit c1e8d57 into main Feb 20, 2026
3 checks passed
@carlsverre carlsverre deleted the copilot/make-locking-vfs-methods-mandatory branch February 20, 2026 17:36
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.

Make locking VFS methods mandatory

2 participants