Full-depth rename per the approved plan; the 'claw' product vocabulary (claws, /claws routes, clawId, Claw Chat) stays — it is now the brand. - Display brand: Clawmates (manifest, titles, hero, login/rail logo 'clawmates'); default host app.clawmates.work; registry ghcr.io/clawmates - Crates tc-* -> cm-* (16 crates + all imports); binaries clawmates-server/broker/bundler; images clawmates/*; env prefix CLAWMATES_* (+ CM_TEST_DATABASE_URL / CM_LIVE_LLM); config clawmates.toml; helm chart deploy/helm/clawmates with clawmates-* resources; db names clawmates*; sockets /run/clawmates; cookie cm_session; kind cluster clawmates-test; seccomp node profile clawmates-agent-profile.json - All 9 Playwright brand assertions updated in lockstep; historical spec document left untouched as the only remaining 'TeamClaw' - Local env migrated: dev pg clawmates-dev-pg/clawmates_dev, shared test server clawmates-test-pg, kind cluster recreated with image + profile, compose images rebuilt under clawmates/* Verified end to end: 161 Rust + 68 frontend tests, 29 Playwright journeys, 4 live kind tests, helm/install/LOC/placeholder gates, and the clean-room install rehearsal serving the clawmates login page from a signed bundle of the rebuilt images. Co-Authored-By: Claude Fable 5 <[email protected]>
61 lines
1.9 KiB
Rust
61 lines
1.9 KiB
Rust
use cm_files::{BlobError, BlobStore, LocalBlobStore};
|
|
|
|
fn store() -> (LocalBlobStore, std::path::PathBuf) {
|
|
let root = std::env::temp_dir().join(format!("tc-blobs-{}", uuid::Uuid::now_v7()));
|
|
(LocalBlobStore::new(root.clone()), root)
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn put_get_delete_round_trip() {
|
|
let (store, _root) = store();
|
|
store
|
|
.put("ws1/documents/agent1/report.md", b"# Q2 Report")
|
|
.await
|
|
.unwrap();
|
|
let bytes = store.get("ws1/documents/agent1/report.md").await.unwrap();
|
|
assert_eq!(bytes, b"# Q2 Report");
|
|
|
|
store
|
|
.delete("ws1/documents/agent1/report.md")
|
|
.await
|
|
.unwrap();
|
|
let gone = store.get("ws1/documents/agent1/report.md").await;
|
|
assert!(matches!(gone, Err(BlobError::NotFound)));
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn nested_keys_create_directories() {
|
|
let (store, _root) = store();
|
|
store.put("a/b/c/d/deep.txt", b"x").await.unwrap();
|
|
assert_eq!(store.get("a/b/c/d/deep.txt").await.unwrap(), b"x");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn overwrite_replaces_content() {
|
|
let (store, _root) = store();
|
|
store.put("k", b"one").await.unwrap();
|
|
store.put("k", b"two").await.unwrap();
|
|
assert_eq!(store.get("k").await.unwrap(), b"two");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn path_traversal_is_rejected() {
|
|
let (store, root) = store();
|
|
let escape = store.put("../outside.txt", b"nope").await;
|
|
assert!(matches!(escape, Err(BlobError::InvalidKey(_))));
|
|
let sneaky = store.put("ok/../../outside.txt", b"nope").await;
|
|
assert!(matches!(sneaky, Err(BlobError::InvalidKey(_))));
|
|
let absolute = store.put("/etc/passwd", b"nope").await;
|
|
assert!(matches!(absolute, Err(BlobError::InvalidKey(_))));
|
|
assert!(!root.parent().unwrap().join("outside.txt").exists());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn deleting_missing_blobs_is_not_found() {
|
|
let (store, _root) = store();
|
|
assert!(matches!(
|
|
store.delete("never-existed").await,
|
|
Err(BlobError::NotFound)
|
|
));
|
|
}
|