Skip to content

Add sandfs update: move a workspace onto a newer source - #156

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-wdmsae
Oct 26, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-wdmsae

Conversation

@lydakis

@lydakis lydakis commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Requested by George · project thread

What changes

sandfs update NAME [SOURCE] moves an unmounted workspace onto a newer version of its source and keeps only the workspace's own changes.

  • Choosing the newer source. Without SOURCE, the source is looked up again as it was recorded, independent of the current folder. A git: source or URL moves to the newest commit of its branch. SOURCE can be another commit of the same repository, or another folder.
  • Forks of plain folders. A fork of a plain folder (fork of a plain folder: a frozen copy, its files cloned #158) moves onto a new copy of the folder as it is now. The old copy goes once nothing is over it.
  • Files. A file the newer source changed and the workspace didn't now reads as it is there.
  • Matching changes. A saved change that matches the newer source is forgotten, so it stops counting as a change. Files and folders that a git pull in the mount checked out are forgotten too, even ones upstream changed again since. Only the commit HEAD resolves to counts as pulled.
  • Changes on both sides. A path changed on both sides is printed as C path and keeps the workspace's version.
  • Refusals. A newer source with a file where a folder holding a change was is refused. So is a hard link whose other name the newer source changed.
  • Nothing is copied. Saved files keep their objects, and forks keep the base they had.
  • Times. Base files the newer commit changed report the update's time as their mtime, with sub-second precision, so builds redo only them.
  • Git.
    • The saved .git/index is dropped and rebuilt.
    • HEAD and branches follow the new commit when they sit at the old commit or between the old and the new one. Packed branches follow too, except lines a loose ref has replaced.
    • Branches older than the old commit stay where they are.
    • A branch or HEAD at a commit made in the workspace is refused.
    • A HEAD naming a branch that would disappear is replaced by the new commit's own.
    • Read-only paths don't block these internal writes.
    • History is fetched deeper only in sandfs's own copy of a URL, never in a repository on this machine.
  • Mounted workspaces are refused ("unmount it first"). Updating in place is a follow-up.

This is the sandfs feature that Graft's gft sync needs.

API changes

CLI only:

  • a new update command
  • a new optional updated field in workspace.json
  • folder sources are now recorded as absolute paths (links kept).

The core is unchanged. New internal helpers:

  • Saved::links, Saved::forget
  • Home::set_record, Home::holds_copy
  • store::open_base
  • git::changed_between, git::Move

sandfs fork from a workspace now re-reads the source record after copying its changes, so it stays consistent with a concurrent update.

Tests

  • cargo test -p sandfs-cli --test cli update: git (file://) and folder workspaces, conflicts, matches, relative sources, refusals.
  • cargo test -p sandfs-cli --test mount update, run on FUSE:
    • a git pull in the mount, then update
    • a URL mount with packed refs and an upstream undo
    • hard links
    • pulled-only detection (another branch at the pulled commit, a packed own branch reset, a pulled folder that becomes a file).
  • a_fork_of_a_plain_folder_keeps_it_as_it_was now also updates the fork. It was run here on a btrfs loop mount, since ext4 can't clone.
  • cargo test --workspace, clippy -D warnings and fmt pass locally on Linux.
    • One exception: sandfs-bench's a_process_tree_counts_its_running_children failed once under the full parallel run and passes alone. That crate isn't touched here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

@lydakis lydakis self-assigned this Oct 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T01:59:41.373768Z a927e5a New commits
🔒 Security Review ✅ Completed 2026-10-26T02:00:14.884071Z a927e5a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4ac79894c

ℹ️ 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".

Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2bd5a07981

ℹ️ 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".

Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89693f4d95

ℹ️ 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".

Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a7aca7fcf

ℹ️ 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".

Comment thread crates/sandfs-cli/src/update.rs Resolved
Comment thread crates/sandfs-cli/src/git.rs Resolved
Comment thread crates/sandfs-cli/src/update.rs Resolved
`sandfs update NAME [SOURCE]` moves an unmounted workspace onto a newer
version of its source: another folder, or another commit of its
repository. Saved changes the newer source matches, or that a pull in
the workspace brought in, are forgotten; paths changed on both sides are
reported and keep the workspace's version. Branches and HEAD follow the
new commit; ones at commits of the workspace's own are refused.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq
@lydakis
lydakis force-pushed the claude/project-thread-wdmsae branch from 95ca2ac to 8b2bdc7 Compare October 26, 2026 01:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b2bdc7393

ℹ️ 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".

Comment thread crates/sandfs-cli/src/update.rs Resolved
@lydakis
lydakis merged commit e9af8e3 into main Oct 26, 2026
23 checks passed
@lydakis lydakis mentioned this pull request Oct 26, 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.

2 participants