Skip to content

Switch to explicit file system Contexts - #1231

Open
Jay Bosamiya (Microsoft) (jaybosamiya-ms) wants to merge 7 commits into
mainfrom
jayb/file-system-contexts
Open

Switch to explicit file system Contexts#1231
Jay Bosamiya (Microsoft) (jaybosamiya-ms) wants to merge 7 commits into
mainfrom
jayb/file-system-contexts

Conversation

@jaybosamiya-ms

Copy link
Copy Markdown
Member

This PR switches the file system resolver to explicit Contexts, so that the underlying file system(s) and the context that they are used in are separated. Essentially, this means that nothing within the file system is itself aware of CWD (current working dir) or acting user now, and the Context object explicitly carries this. This means that the Linux shim no longer needs to maintain its own cwd: String field and manipulation of it, allowing resolution + permission decisions to live in one place.

Along with this, I also updated the in-mem backend to use the resolver context rather than maintain its own user management, closing out yet another place of unnecessary duplication and potential inconsistency.

Finally, as a drive-by fix: getcwd no longer returns a trailing /, making it more consistent with Linux.

@jaybosamiya-ms

Copy link
Copy Markdown
Member Author

Again, easiest to review one commit at a time :)

@jaybosamiya-ms
Jay Bosamiya (Microsoft) (jaybosamiya-ms) marked this pull request as ready for review August 27, 2026 21:03
@github-actions

Copy link
Copy Markdown

ℹ️ Note: This semver check was run against the jayb/retire-filesystem-trait branch, not main or ulitebox.

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters, not counting the receiver (self) parameter.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/method_parameter_count_changed.ron

Failed in:
  litebox::fs::resolver::Resolver::open takes 3 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:438, but now takes 4 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:469
  litebox::fs::resolver::Resolver::chmod takes 2 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:787, but now takes 3 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:833
  litebox::fs::resolver::Resolver::chown takes 3 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:800, but now takes 4 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:848
  litebox::fs::resolver::Resolver::unlink takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:818, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:869
  litebox::fs::resolver::Resolver::mkdir takes 2 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:843, but now takes 3 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:893
  litebox::fs::resolver::Resolver::rmdir takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:868, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:926
  litebox::fs::resolver::Resolver::file_status takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-jayb_retire_filesystem_trait/9974d69755a0316e6af624bb51f0b21013463175/litebox/src/fs/resolver.rs:932, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox/src/fs/resolver.rs:989

Base automatically changed from jayb/retire-filesystem-trait to main August 28, 2026 13:39
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.

1 participant