Skip to content

Releases

sandfs 0.9.0

Choose a tag to compare

@lydakis lydakis released this 28 Oct 04:11
16ce565

The main changes:

  • A fork of a plain folder on another disk than sandfs's home is a frozen copy on that disk, in .sandfs/copies at its top, instead of being refused.
  • A file that shrinks in a folder under a mount is never shown padded with zeros, and git in a linked worktree of a mounted or forked folder stays inside the workspace.
  • A mount keeps its caches within a budget and gives memory back: after a minute unused, on sandfs trim, and when unmounted, freed memory goes back to the system instead of staying with the process.
  • A mount keeps less memory per file it is asked about, and a fork of a git clone on a Linux disk that clones files is a real folder.

API changes in the sandfs crate: Changes has a new field, committed, so code that builds a Changes itself needs it. CrossDevice comes up far less often, now that a folder on another disk is copied there. Home::trim and Trimmed are new. In sandfs-core, Source has two new methods with defaults, entry_now and trim, and Workspace has recheck and trim.

  • sandfs, folders on another disk: sandfs fork of a plain folder on another disk than sandfs's home, such as an external volume, was refused (CrossDevice), since a file is cloned only within one disk, and a program fell back to mounting the folder itself, which shows the folder as it changes and has written zeros over files. The copy is now made on the folder's own disk, in .sandfs/copies at that disk's top: a frozen copy as on the home's disk, which takes no space until a file in it changes. sandfs makes that folder the first time, leaves it out of every copy and mount of the disk, and deletes it once it holds no copy. It does so only where no one else can move that folder: .sandfs and .sandfs/copies are this user's and writable by no one else, at a top where others can't rename them (a sticky one, as /dev/shm is, will do). CrossDevice is left for a folder mounted inside the one forked, or a disk whose top sandfs can't use that way.
  • sandfs, sandfs-core and sandfs-git, giving memory back: the process serving mounts grew with every file a walk asked about and never shrank: about 1 GB after a walk of a 700,000-file folder on macOS, and even after the unmount it held 337 MB, freed but kept by macOS's allocator. Now the folder listings, directories found and file bytes a workspace keeps to answer faster stay within a budget (32 MiB of listings, 16 MiB of file bytes), the least used going first, and are read again when needed. A mount nobody has used for a minute is trimmed: its changes are saved, those caches go, idle git cat-file readers exit, and the allocator is asked to hand the freed memory back to the system (on macOS malloc_zone_pressure_relief, on glibc malloc_trim; this one call is the only code sandfs runs that Rust can't check). sandfs trim [NAME] trims at once, and in the library Home::trim does, for a program to call when a task goes idle. The memory is handed back after every unmount too. On macOS, walks (find and ls -lR) of a 706,605-file folder peaked at 404 MB where they peaked at 1,028 MB, and after the unmount the process kept 48 MB where it kept 337 MB. On Linux, a walk of 50,000 files peaked at 25 MB where it peaked at 31 MB, and a trim took it to 13 MB. The price is time on walks of folders whose listings don't fit the budget: a folder listed again is read again, so on macOS those two walks of 706,605 files took 59 s where they took 43 s; walks of smaller folders, and work within one part of a large one, are as fast as before. What stays is a record of each file the system asked about: a mount's table of files now holds each path once, not twice, and on macOS, whose NFS client never says it is done with a file, that table lasts until the unmount. In sandfs-core this is Workspace::trim and Source::trim, with a default that does nothing, which GitSource implements.
  • sandfs and sandfs-core, less memory per file: a mount keeps less for each file it is asked about. After a walk of 200,000 files (find and ls -lR), the process serving the mount held 89 MB where it held 147 MB, and walks take as long as before. Three changes do it. The record of each file the kernel knows is smaller. Files are found through their folder's listing, and only folders are kept in the table that resolves paths in one lookup. The table of files the kernel knows gives its room back once the kernel forgets most of them, which took a further 14 MB off after the kernel forgot the walk. A git mount also keeps at most 64 MiB of whole files read lately, down from 256 MiB.
  • sandfs and sandfs-cli, linked worktrees in a folder: a git worktree's .git is a file naming its repository by full path, so git in a mount or fork of a folder holding one wrote that repository on the disk: a commit landed in the real repository while the files it was made from stayed in the workspace, and the real worktree then looked changed. A mount and a fork now show such a file with the path the repository has there: relative, when the repository is in the folder too, so the commit stays in the workspace; otherwise a path that isn't there, so git stops instead of writing outside it, and the file says "this worktree's repository is outside this folder, at PATH". sandfs changes now says which folders hold a repository with commits made in the workspace, which copies leave out with the rest of .git; in the library that is the new Changes::committed.
  • sandfs and sandfs-core, a file that shrank in the folder under a mount: a mount of a folder lists each file once and reads its bytes from the folder as they are. When a file got shorter in the folder after that (a copy onto it truncates it first), a read came back short of the listed size, and macOS's NFS client filled the rest with zeros: copying files from a mount onto the folder under it wrote zeros into them. Now a read that comes back short makes the mount ask the folder again for that file's size and time alone. On Linux the read is the file's end and a later stat gives the new size. On macOS, whose client won't take a smaller size from a read, the read fails ("Stale NFS file handle") and the file gets a new inode, which the client looks up within a second or so and then reads as the file is now. A read never gives zeros. In sandfs-core this is Workspace::recheck and a new Source::entry_now with a default that changes nothing, which DirSource implements. Errors from a folder now name the path they happened at ("source error: PATH: Permission denied").
  • sandfs and sandfs-cli, real folders on Linux: sandfs fork of a git clone (or of a fork kept as a folder) into a folder on a disk that clones files, btrfs or XFS, now keeps the fork there as a real folder of clones of the clone's files, as on macOS, instead of mounting it. It takes no space for the files, about 30 ms to make, and builds and git run in it at the disk's own speed, where a mount ran a build after an edit 25-40% slower and created small files 2-5 times slower. sandfs finds out by cloning one file next to the folder and removing it. On ext4, or with --read-only or --mount, the fork is mounted as before.

sandfs 0.8.0

Choose a tag to compare

@lydakis lydakis released this 27 Oct 02:32
a5db594

The main changes:

  • On macOS, a fork of a git clone is a real folder of APFS clones rather than a mount, so programs and git run in it at the disk's own speed.
  • A fork of a plain folder on another disk than sandfs's home can copy its files (--allow-copy) instead of being refused, and the refusal is an error a program can match on.
  • Forks, changes and small-file writes in a mount are faster, and a slow first read on a macOS mount waits instead of failing.

API changes in the sandfs crate: ForkOptions has two new fields, real_folder and allow_copy, and Forked has real_folder, so code that builds ForkOptions without ..Default::default() needs to add them. sandfs::CrossDevice is new. sandfs-core and the Python API are unchanged.

  • sandfs and sandfs-cli, a fork of a clone kept as a real folder: on macOS a mount goes through the system's NFS client, which makes work on many small files 4 to 10 times slower than in a worktree. sandfs fork CLONE DIR (or a fork of such a fork) is now a real folder there by default: its files are clones of the clone's, with their times and modes, ignored files left out, and its .git is what a mount would show (same commit, --branch, origin). sandfs brings the workspace up to date from the folder before changes and fork, running git in a private repository of its own, so settings written into the folder's .git never make sandfs changes run a program; .git/config edits and hooks are still reported. --real-folder makes one on any platform (copying files where the disk can't clone), --mount forces a mount, and --read-only implies one. rm --unmount deletes the folder; mount, update, unmount, serve --mcp and shell refuse one and say why. In the library this is ForkOptions::real_folder and Forked::real_folder. A fork of a real folder carries its files but not commits made in it.
  • sandfs and sandfs-cli, forking a folder on another disk: a fork of a plain folder clones its files into the home, and a file is cloned only within one disk that can clone, so a folder on another disk (such as a separate APFS volume on macOS) was refused with "can't clone ...: Cross-device link", which read like a fault of the disk. It is now refused with "FOLDER is on another disk than sandfs's home (HOME)", and in the library with a sandfs::CrossDevice { folder, home } error, found with err.downcast_ref::<sandfs::CrossDevice>(). ForkOptions::allow_copy (sandfs fork --allow-copy) copies the files that can't be cloned in full instead, on another disk or on one that doesn't clone files such as ext4, and update of such a fork copies the same way. Files that can be cloned still are. Without it, nothing changed: the fork is refused rather than copied.
  • sandfs-cli, faster forks and changes: small files (64 KiB or less) written in a mount stay in memory until a save packs them, instead of going through a file on disk first (Linux, 1,000 files: rewrite 511 to 65 ms, create 576 to 110 ms). macOS sees an unmount at once rather than at its next half-second check. A fork of a local clone runs fewer git processes, and the ones left at once (Linux: 31 to 17 ms); changes on a real folder skips files unchanged since it last looked and reuses the source its update opened (macOS CI: 113 to about 60 ms, and 84 to 97 ms after an edit).
  • sandfs-cli, a slow first read on macOS: a macOS mount was soft, so the system gave up on a call after at most about 30 s, and a first read waiting on a slow download failed with an I/O error. It is now hard,intr,deadtimeout=60: slow reads wait, and if the mount process dies, calls fail after a minute without answers.
  • Benchmarks: sandfs-bench --only copies compares a git worktree, a copy-on-write copy of a clone and sandfs fork at the work an agent does in a task's copy, on Linux and macOS for every pull request.

sandfs 0.7.1

Choose a tag to compare

@github-actions github-actions released this 26 Oct 06:05
a46bb09

The sandfs crate's README and docs.rs page now say how to build on it, and git's file monitor no longer prints an error in a git worktree added from a mount. No API changes.

  • sandfs, documentation for building on it: the README has a "Build on sandfs" section, and the sandfs crate's README and docs.rs page say what the library gives a program, the one line it needs in main, what to weigh before depending on it (the API may change before 1.0; writes in a mount cost more, most of all on macOS) and who uses it. examples/attempts.rs runs a whole round trip in a temporary folder: two copies of a folder, changed two ways, compared, and one written back.
  • sandfs and sandfs-cli, git's file monitor outside a mount: a git worktree added from a git mount shares the mount's settings, so git ran sandfs git-fsmonitor there too, and it failed with "is neither a workspace name nor a mounted workspace" on every git command, often several times per command. Outside a mount it now answers that any file may have changed, the same fallback git already took, without the error.

sandfs 0.7.0

Choose a tag to compare

@github-actions github-actions released this 26 Oct 03:35
9b493d0

The main changes:

  • A new sandfs crate, the library behind the command: a program can mount, fork, update and list changes of saved workspaces, and serve their mounts, without sandfs installed.
  • sandfs update works on a mounted workspace, in place, so a shell or agent working in it carries on.

The sandfs command works as in 0.6.0; sandfs-core and the Python API are unchanged.

  • sandfs, a library of everything the command does: the new sandfs crate holds what only the command could do before: the home of saved workspaces, the folder, git and GitHub sources, fork, update, changes with --copy-to, clean, and mounting with its background process. Each command is a method of sandfs::Home that returns what it found (Changes, Updated, Forked and so on) instead of printing it, so a program builds on workspaces without running sandfs or parsing its output. Home::locate finds the same home the command uses; Home::at takes another. The mount process outlives whoever asked for a mount, so sandfs starts it by running the program again: a program embedding sandfs calls sandfs::handle_relaunch(&["sandfs"]) first thing in main, and runs of PROGRAM sandfs ... are then sandfs's. The sandfs command is now a thin layer over the library and works as before. sandfs-core stays the in-memory engine underneath.
  • sandfs-cli, update on a mounted workspace: sandfs update NAME no longer asks to unmount first. A mounted workspace moves in place: its changes are saved, and the mount reads as the newer source from then on, while a shell in one of its folders and files left open carry on (an open file the newer source removed still reads as it was). On Linux the kernel is told what to forget. On macOS, whose NFS client can't be told, files that may have changed get new file handles, folders' attributes are asked for again after a second, and update waits that second before returning.

sandfs 0.6.0

Choose a tag to compare

@github-actions github-actions released this 26 Oct 02:47
1dcfeab

The main changes:

  • sandfs fork is the one command for a task's copy: from a workspace or its mount, from a clone on this machine (its HEAD plus uncommitted files, with --branch to push work back), or from any folder (cloned, so it takes no space, on APFS, btrfs or XFS).
  • changes --copy-to refuses to overwrite a file edited where it copies since the workspace started.
  • sandfs update moves a workspace onto a newer commit or folder, keeping only its own changes.
  • One process serves thousands of mounts, and commands in a mount stay fast however many there are.
  • sandfs never runs git with the settings of a mount's .git.

Only the sandfs command changed; the Rust and Python APIs are as in 0.5.1.

  • sandfs-cli, task copies: sandfs fork makes the copy to hand one task, wherever it starts. FROM can now be a folder of a git repository on this machine, such as a clone: the fork is its HEAD plus what its folder has changed since (changed, staged, new and deleted files, links and modes, but not ignored files), copied once, so the copy keeps its starting point while work goes on in the folder, and changes lists them from the start; what was staged shows as unstaged in the copy, and the repository is only read. FROM can also be any folder inside a mount. --branch NAME starts git in the fork on a new branch at FROM's commit, keeping its files and index, so its commits go back with git push origin NAME; a name the repository or FROM already has is refused. --read-only PATH adds read-only paths. sandfs rm --unmount NAME (or the mount's directory) unmounts a workspace and deletes it in one step. README gains a git-to-sandfs table.
  • sandfs-cli, git settings in a mount never run as you: sandfs asked a server for its branches (mount git:URL, fork --branch) by running git in the folder it was started in, so started inside a mount, it took that mount's .git/config, which any program writing to the mount can set to run a command (a remote rewritten to an ext:: program, say). It now asks from an empty folder, and fork --branch asks a partial clone's remote by its URL, not through the repository's settings. mount git:PATH refuses a repository inside a mounted workspace, pointing to sandfs fork instead.
  • sandfs-cli, changes --copy-to keeps work done where it copies: a file in DIR that differs from both what the workspace started from and what the copy would write, such as one edited there since, now refuses the copy before anything is written, naming each such file; --force overwrites as before. A deleted file below a link, or replaced by a folder, in DIR is left alone instead of failing the copy.
  • sandfs-cli, many mounts at once: commands run inside a mount, and every git command there (git asks sandfs git-fsmonitor), found their workspace by reading the system's mount table once per workspace, so they slowed down as mounts were added. With 10,000 copies of one repository mounted, git status in one of them took 86 s and sandfs list 95 s; they now take 0.06 s and 0.13 s, as with one mount.
  • sandfs-cli, more mounts per process: the one process that serves a home's mounts stopped at a few hundred mounts on a system that limits a process to 1,024 open files (most Linux systems; macOS allows 256), and on Linux it crashed at about 3,100, taking every mount down with it, once its threads used up the memory maps a process may have (vm.max_map_count). It now raises its open-file limit as far as the system allows, saves every mount's changes from 4 shared threads instead of one per mount, tells the kernel about stale folder listings from one shared thread, and refuses a new mount it has no room for with an error naming the limit. On Linux each mount now takes 2 threads instead of 4, so one process serves about 7,000 mounts with the default limit (more with sysctl -w vm.max_map_count=262144).
  • sandfs-cli, a fork of a plain folder: sandfs fork FOLDER DIR now takes any folder, not only a workspace or a git repository: the fork is the folder as it is now, its files cloned with their modes and times into $SANDFS_HOME/copies (no space for their contents; 20,000 files in 1.8 s on btrfs), so later edits in the folder stay out and changes --copy-to FOLDER can tell an edit made there since. The copy is deleted with the last workspace over it, or by sandfs clean. It needs the folder and $SANDFS_HOME on one disk that clones files (APFS, btrfs, XFS) and is refused elsewhere, such as on ext4, rather than copied in full. --branch is refused for a plain folder.
  • sandfs-cli, many mounts on macOS: each mount ran mount twice a second to see whether it was still mounted, so 100 mounts started 200 processes a second while doing nothing; one thread now checks for every mount of the process, with one mount per half second. Each mount is served by one thread instead of three or more.
  • sandfs-cli, moving a workspace onto a newer source: sandfs update NAME [SOURCE] moves an unmounted workspace onto the newest commit of its branch, or onto SOURCE (another commit of the same repository, or another folder; a fork of a plain folder takes a new copy of it), and keeps only the workspace's own changes. Its changes that match the newer source, such as files a git pull in the mount brought in (even ones upstream changed again since), stop counting as changes; paths changed on both sides are printed as C path and keep the workspace's version. Base files the newer commit changed report the update's time, so builds redo only them. Git's index is built again (what was staged shows unstaged), HEAD and branches in the mount (packed ones too) follow the new commit, and a branch holding commits made in the workspace is refused, as is a newer source with a file where a folder holding a change was. Forks aren't moved.

sandfs 0.5.1

Choose a tag to compare

@github-actions github-actions released this 22 Oct 05:13
aece7ac

The same code as 0.5.0, released again so that it reaches PyPI. The 0.5.0 crates and GitHub release (with the sandfs downloads) came out, but the PyPI upload failed because the release workflow handed PyPI the sandfs archives along with the Python packages. It now uploads only the Python packages.

sandfs 0.5.0

Choose a tag to compare

@github-actions github-actions released this 22 Oct 04:52
aae0b28

The main changes:

  • sandfs mount works on macOS with nothing to install.
  • A repository mounts from a plain URL, and listing it, stat and git status download almost nothing.
  • Git works inside a git mount.
  • Workspaces and mounts hold symbolic and hard links.
  • Read-only paths, sandfs shell and changes --copy-to let a workspace be all the files an agent has.
  • Forks, saves and memory cost far less after a large build.
  • Each GitHub release now carries the sandfs command, ready to run, for Linux and macOS.

Breaking changes for Rust code that matches on these types or builds their entries:

  • Kind has a new variant, Kind::Symlink, so a match over it needs an arm for links.
  • Error has a new variant, Error::ReadOnly, so a match over it needs one too.
  • SourceEntry has a new field, modified, so a source that builds entries field by field must set it (None is fine).

Every change:

  • Prebuilt sandfs command: each GitHub release has sandfs built for Linux (x86_64 and aarch64, linked statically against musl so it runs on any distribution) and macOS (Apple silicon, Intel), so the command needs no Rust toolchain. Download the archive for your machine from the release page, unpack it and put sandfs on your PATH. sandfs-cli's license is now MIT AND BSD-3-Clause, since it carries nfsserve's NFS server.
  • sandfs-cli, writes kept under memory pressure: on Linux, a file written and closed could lose what was written if the kernel, short of memory, forgot it within a quarter second of the last write. Git's index was the usual victim (index file smaller than expected). Such writes are now kept.
  • sandfs-cli, quicker unmount: unmounting no longer waits out the quarter second the mount gives a burst of writes to settle before saving it; the final save at unmount does that work. Unmounting a copy after git status in it went from 270 ms to 5 ms.
  • sandfs-cli, folders listed again: on Linux the kernel now keeps each folder's listing once read and lists it again without asking the mount, until something changes that folder through the mount. A walk over folders already seen (find, an editor's file tree, git looking for new files) no longer costs four requests per folder. On a VS Code mount from GitHub, find over the whole tree takes 0.04 s instead of 0.66 s once it has run, as fast as on a clone; in the benchmark, a second walk of 10,000 files takes 5.6 ms instead of 32 ms and listing a 10,000-file folder again 1.5 ms instead of 6.7 ms.
  • sandfs-cli, listings and inode numbers agree: once the kernel forgot a file it had seen in a kept folder listing, that listing went on giving the file's old inode number while stat gave a new one, so ls -i and tools that match the two disagreed. The mount now has the kernel drop such listings.
  • Benchmarks: small/walk-warm lists every folder of the small-file tree a second time.
  • Benchmarks, tracked: sandfs-bench --compare BEFORE AFTER compares two saved runs. It lists each number that moved beyond a threshold and both runs' spread, and how far each is from what it has to beat in its own run (the host folder, overlayfs, a clone). --skip NAME leaves workloads out. CI now runs the quick suite on main and on each pull request that changes the Rust code, on the same machine, and puts the comparison in the run's summary. Pushes to main keep their results as artifacts.
  • Benchmarks on macOS: sandfs-bench runs on a Mac, with the NFS mount as its sandfs NFS column; overlayfs is skipped there. Memory comes from getrusage, ps and vmmap instead of /proc.
  • Benchmarks, a day of work: the --remote table also times the first git status in the second copy, find over the whole copy, a second grep -r, and removing the second copy.
  • Read-only paths: Workspace::set_read_only(path, true) makes a path and everything below it read-only in a workspace and its later forks, so whoever it is handed to can read but not change it, even in their own copy. Writes, deletes, moves and new entries there fail with the new Error::ReadOnly, and so does removing or moving a folder that holds the path; is_read_only and read_only_paths report them. Python: set_read_only(path), is_read_only(path) and mount(..., read_only=True), raising OSError with errno EROFS. sandfs-mcp --read-only PATH does the same over MCP and names the paths in its instructions to the agent. Matching on Error needs the new variant.
  • sandfs-cli, confined shells: sandfs shell NAME [-- COMMAND...] runs a shell or a command in a mounted workspace that can't reach the machine's other files: not your home folder, other folders or the workspace's source. It has no network unless --network is given, HOME is an empty folder outside the mount, and only a few harmless environment variables pass through. Bubblewrap does the confining on Linux, and the system's own sandbox on macOS, so an agent working through a shell gets the mount as its only files.
  • sandfs-cli, read-only paths: sandfs mount SOURCE DIR --read-only PATH and sandfs serve --mcp SOURCE --read-only PATH make a file or folder of the source read-only in a new workspace, and its forks keep it. In a mount, changes there fail with EROFS (NFS3ERR_ROFS on macOS) and its files show without write permission. The paths are kept in workspace.json; workspaces saved before have none.
  • sandfs-cli, git settings in reviews: sandfs changes on a git: mount still leaves .git out of its listing, but names any change to .git/config or .git/hooks on stderr. Git runs the programs those name, so whoever reviews an agent's work sees such a change before running git in the mount.
  • sandfs-cli, keeping changes: sandfs changes NAME [PATH...] --copy-to DIR writes a workspace's changes into a folder: added and modified files and links are copied with their executable bit, deleted ones removed, and only where DIR points. PATH arguments limit changes, with or without --copy-to, to some files or folders. It never writes through a link it finds in DIR, so links an agent made can't carry a later file out of it, and leaves out changes in a .git folder (also .GIT or git~1, which a Mac or Windows disk reads as one), since git runs the programs named there. This replaces the loop over changes output that broke on unusual names (#41).
  • Changes since a checkpoint: Workspace::changes_since(base) lists the files that differ from another workspace, reported like changes(): what an attempt did after a fork kept as a checkpoint, or how two attempts forked from one checkpoint differ. It skips everything the two still share, so the cost follows what changed after they split. Python: changes(since=other). MCP: Server::changes_since(checkpoint) makes the changes tool compare against a checkpoint. CLI: sandfs changes NAME --since OTHER for two workspaces of the same source.
  • Hard links: a file can have several names (Workspace::hard_link, hard_links and has_hard_links; hard_link(src, dst) and hard_links(path) in Python). A write through any name is seen through all of them, removing one leaves the others, and a move keeps the link while a copy or a fork gets its own file. changes() reports each name on its own. The Linux mount supports link(2) with one inode per file, and saved workspaces keep links, so rustc's incremental cache and cargo, which link their files, no longer copy them through the mount. The macOS mount supports them too (NFS LINK), which makes small cargo rebuilds there about three times faster.
  • Symbolic links: a workspace can hold symbolic links (Kind::Symlink; Workspace::symlink and read_link, symlink(path, target) and read_link(path) in Python). A link is stored as its target and never followed by the workspace: read, write and set_executable refuse one instead. changes() reports links like files. A host folder's links are now listed as links instead of skipped, and still never lead a read outside the folder; each keeps the meaning it has on the host wherever the workspace is mounted, except that a link into the folder reaches the workspace's copy. Mounted folders support ln -s and readlink on Linux and macOS, so python3 -m venv and npm's .bin links work in a mount, and saved workspaces keep their links. A source may list links too: its read of one returns the target. Matching on Kind needs the new variant.
  • Mounting on macOS: sandfs mount works on macOS with nothing to install. The mount's process serves the workspace over NFS on localhost and macOS's own NFS client mounts it, with no kernel extension, macFUSE or sudo. Writes are saved by the same rule as on Linux, except that fsync doesn't reach the server and saves nothing by itself. It answers only the user who mounted it and root.
  • sandfs-cli, root and containers on Linux: a Linux mount lets root in as well as the user who made it, whenever /etc/fuse.conf has user_allow_other (or root made the mount). Before, a mount made by a user refused root, so Docker couldn't bind the folder into a container.
  • README: rewritten for newcomers. It explains what sandfs is for in plain terms, starts with one short example, then covers each kind of source (with a git example), giving a workspace to an agent, mounting it as a folder, performance tables (parallel attempts, and mounting VS Code and Chromium from GitHub against cloning them) and the limits.
  • sandfs-cli speed: the FUSE mount tells the kernel it needn't open or close files, so a first read of a small file is about a quarter faster and rereads and overwrites take about 40% less time.
  • sandfs-cli saving: closing a file no longer commits it. A write is saved once its file has gone 250 ms without a write, on fsync, or at unmount, fork or changes. A program that writes a file, closes it and exits still has it saved a moment later, but no...
Read more

sandfs v0.4.0

Choose a tag to compare

@lydakis lydakis released this 19 Oct 03:28
feac67a

A rewrite. sandfs is now a general-purpose sandbox filesystem with a Rust core, and the Python package is a thin binding over it. Nothing from the 0.2 API carries over.

  • Workspaces: mount read-only sources at paths, keep every write, directory and deletion in a copy-on-write overlay, and fork in O(1). Forks share everything already read but never see each other's changes.
  • Sources: a host directory (DirSource), in-memory files (MemorySource), a git commit read without a checkout (GitSource, faster in a partial clone), or any Python object with list(path) and read(path).
  • Changes: changes() lists every added, modified or deleted file. The harness decides what to keep and writes it back.
  • Bytes first: files are bytes of any kind. stat always reports an exact size and a version, and write(..., expected_version=...) rejects a write to a file that changed since it was read.
  • Large files: read(path, offset=..., length=...) reads one range without caching the whole file. A source can define read_range to serve ranges itself.
  • Concurrency: calls release the GIL, and forks reading the same uncached file fetch it from the source once.
  • sandfs-mcp: an MCP server exposing a copy-on-write workspace as nine file tools (read, list, glob, grep, write, edit, move, delete, changes); sandfs-mcp --dir MOUNT=PATH. A path holding a control character or line separator is shown as a quoted JSON string, so one name can't read as two lines.
  • sandfs-cli: the sandfs command mounts a workspace as a real directory over FUSE on Linux; sandfs mount, fork, changes, unmount. Sources are a host folder or git:<path or url>[@rev]; a remote repository mounts in about a second, since only the mounted commit and its folder listings are fetched, with no history. File contents are fetched when first read. A branch or tag name is looked up on the server at every mount; a commit id mounted before also mounts offline. Changes are saved on disk between mounts. sandfs serve --mcp NAME serves a workspace to an agent as MCP file tools instead.
  • sandfs-cli speed: the FUSE mount keeps the kernel's cache for files that haven't changed, lists directories with their attributes, skips flushes on files opened read-only and polls for mounts in milliseconds, so rereading small files takes half the time, stat after a listing is 25× faster and sandfs fork returns in 7 ms instead of 54.
  • sandfs-core speed: workspaces resolve a path in one lookup instead of one per directory and host-folder reads check the file they opened instead of resolving each parent folder first, so a stat 64 folders deep is about 12× faster and creates and deletes about a third faster.
  • sandfs-cli concurrency: one process serves a workspace at a time. A second mount or serve --mcp of a workspace in use is refused instead of saving over the first, as is a second mount on the same directory. unmount fails if the final save failed, serve --mcp undoes and reports a change it couldn't save, and changes reads a workspace safely while another process is saving it. Building sandfs-cli now needs Rust 1.89 (the library crates still build with 1.85).
  • Benchmarks: sandfs-bench, an unpublished crate, times sandfs through the Rust API and the FUSE mount against the host filesystem and overlayfs, including a workflow of parallel attempts that search, edit and check their files (--only workflow); cargo run --release -p sandfs-bench -- --scratch /dev/shm.
  • sandfs-cli on macOS and Windows: the sandfs command builds there with everything but the mount, and sandfs serve --mcp SOURCE creates a workspace over a source. The library crates and the Python package are tested on macOS and Windows in CI.
  • Packaging: one abi3 wheel per platform covers Python 3.11 and later. The Rust crates sandfs-core, sandfs-git, sandfs-mcp and sandfs-cli are published alongside.
  • Removed: the bash-like shell, host-command bridge, Python executor, access policies, storage adapters, write hooks, symlinks, text edit and unified diffs.