Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ clap_complete = { version = "=4.5.61", features = ["unstable-dynamic"] }
criterion = { version = "0.5", features = ["async_tokio"] }
dirs = "6"
filetime = "0.2"
globset = "0.4"
hex = "0.4"
libc = "0.2"
lru = "0.12"
Expand All @@ -50,6 +51,7 @@ rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.147"
sha1 = "0.10"
sha2 = "0.10"
smallvec = "1.6"
tempfile = "3.23.0"
thiserror = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions crates/vfs-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ serde = { workspace = true }
parking_lot = { workspace = true }
clap_complete = { workspace = true }
dirs = { workspace = true }
globset = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
chrono = { workspace = true }
Expand Down
16 changes: 16 additions & 0 deletions crates/vfs-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,20 @@ fn main() {
.unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_string());

println!("cargo:rustc-env=VFS_VERSION={}", version);

let commit = Command::new("git")
.current_dir(repo_root)
.args(["rev-parse", "HEAD"])
.output()
.ok()
.and_then(|output| {
if output.status.success() {
String::from_utf8(output.stdout).ok()
} else {
None
}
})
.map(|value| value.trim().to_string())
.unwrap_or_default();
println!("cargo:rustc-env=BUILD_COMMIT={commit}");
}
14 changes: 7 additions & 7 deletions crates/vfs-cli/src/cmd/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use vfs_core::{
schema, SchemaVersion, VfsOptions,
};

use super::safety::{build_local_database, ReadOnlyOpenSidecars};
use super::safety::{build_local_database, sidecar_path, ReadOnlyOpenSidecars};

const S_IFMT: i64 = 0o170000;
const S_IFREG: i64 = 0o100000;
Expand Down Expand Up @@ -275,6 +275,8 @@ async fn copy_migrate_to_current(
copy_optional_whiteouts(&source_conn, &target_conn).await?;
copy_optional_table_common_columns(&source_conn, &target_conn, "fs_origin").await?;
copy_optional_table_common_columns(&source_conn, &target_conn, "fs_overlay_config").await?;
copy_optional_table_common_columns(&source_conn, &target_conn, "fs_session_metadata")
.await?;
copy_table_common_columns(&source_conn, &target_conn, "kv_store").await?;
copy_table_common_columns(&source_conn, &target_conn, "tool_calls").await?;
Ok(())
Expand Down Expand Up @@ -757,6 +759,7 @@ async fn verify_migration_equivalence(
compare_optional_whiteouts(source, target).await?;
compare_optional_table_rows(source, target, "fs_origin", &["delta_ino", "base_ino"]).await?;
compare_optional_table_rows(source, target, "fs_overlay_config", &["key", "value"]).await?;
compare_optional_table_rows(source, target, "fs_session_metadata", &["key", "value"]).await?;
compare_table_rows(
source,
target,
Expand Down Expand Up @@ -1295,10 +1298,6 @@ fn remove_db_family(path: &Path) -> AnyhowResult<()> {
Ok(())
}

fn sidecar_path(path: &Path, suffix: &str) -> PathBuf {
PathBuf::from(format!("{}{}", path.display(), suffix))
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -2025,16 +2024,17 @@ mod tests {
("0.0", "my-agent"),
("0.2", "/tmp/old.db"),
("0.4", "other-agent"),
("0.5", "pack-agent"),
] {
let guidance = schema_upgrade_guidance(found, "0.5", id_or_path);
let guidance = schema_upgrade_guidance(found, "0.6", id_or_path);
assert!(
guidance.contains(&format!("vfs migrate {id_or_path}")),
"{found}: {guidance}"
);
assert!(!guidance.contains("migrate-v0-5"), "{found}: {guidance}");
}

let future = schema_upgrade_guidance("user_version 7", "0.5", "my-agent");
let future = schema_upgrade_guidance("user_version 7", "0.6", "my-agent");
assert!(
!future.contains("vfs migrate"),
"future versions must not promise migrate can fix them: {future}"
Expand Down
3 changes: 3 additions & 0 deletions crates/vfs-cli/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ pub mod fs;
pub mod init;
pub mod mcp_server;
pub mod migrate;
pub mod pack;
pub mod profiling;
pub mod ps;
pub mod safety;
mod session_lock;
pub mod sync;
pub mod timeline;
pub mod version;

#[cfg(unix)]
pub mod mount;
Expand Down
9 changes: 9 additions & 0 deletions crates/vfs-cli/src/cmd/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,15 @@ mod tests {
)
.await
.unwrap();
conn.execute(
"CREATE TABLE fs_session_metadata (
key TEXT PRIMARY KEY,
value TEXT NOT NULL
)",
(),
)
.await
.unwrap();
conn.execute(
"INSERT INTO fs_whiteout (path, created_at) VALUES ('/dir/deleted', 123)",
(),
Expand Down
Loading
Loading