Skip to content

feat: add filesystem snapshots and readonly zip mounts#47

Closed
ivarvong wants to merge 4 commits into
mainfrom
feat/fs-to-tree
Closed

feat: add filesystem snapshots and readonly zip mounts#47
ivarvong wants to merge 4 commits into
mainfrom
feat/fs-to-tree

Conversation

@ivarvong

@ivarvong ivarvong commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Adds two filesystem capabilities on top of the VFS-backed JustBash filesystem.

Summary

  • Add JustBash.FS.to_tree/2 to snapshot regular files under a root into a %{path => content} tree.
  • Add JustBash.FS.Zip, an eager read-only VFS.Mountable backend for ZIP archives.
  • Support from_binary/2 and from_url/3 ZIP construction, with URL fetches going through JustBash.Network and the configured HTTP client.
  • Harden ZIP archive handling with structured VFS errors, unsafe path rejection, file/directory collision checks, empty directory support, UTF-8 paths, and construction limits.
  • Add ZIP-specific POSIX behavior so mutation-like operations such as chmod fail with :erofs.
  • Prepare output redirections before command execution so failed writes to read-only mounts prevent command side effects.
  • Resolve relative HTTP redirects through the shared network policy.

Verification

  • mix test test/just_bash/fs_zip_test.exs
  • mix test
  • mix compile --warnings-as-errors
  • mix credo
  • Live R2 smoke test against https://fieldvault.2fsk.com/zip_mount_demo.zip

Notes

JustBash.FS.Zip.from_url/3 enforces archive limits before decompression, after the configured HTTP client returns the response body. A future streaming HTTP client path could enforce :max_archive_bytes before materializing remote response bytes.

@ivarvong ivarvong changed the title feat: add FS.to_tree/2 — snapshot the filesystem as a path=>content tree feat: add filesystem snapshots and readonly zip mounts Jul 2, 2026
@ivarvong ivarvong closed this Jul 2, 2026
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