test(modules): pin orphan-sweep coverage of group-shared blobs (§11.6 files review)
The §11.6 files slice relies on the orphan sweeper covering the new `files/groups/<group_id>/...` subtree "for free" via its recursive walk of `<root>/files/`, with no sweeper code change. Lock that guarantee with an explicit test so a future sweeper refactor can't silently drop group-shared tmp files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -165,6 +165,23 @@ mod tests {
|
||||
assert!(tmp.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sweeps_group_shared_tmp_files() {
|
||||
// §11.6 group-shared files shard under `files/groups/<group_id>/...`,
|
||||
// a disjoint subtree from the per-app `files/<app_id>/...`. The walk is
|
||||
// recursive from `<root>/files/`, so an orphan there is reaped without
|
||||
// any group-specific sweeper change — this pins that "covered for free"
|
||||
// guarantee against a future refactor.
|
||||
let root = tmp_root();
|
||||
let group_shard = root.join("files/groups/6f693a33-9ae5-485b-804e-191e9fd33524/assets/ab");
|
||||
std::fs::create_dir_all(&group_shard).unwrap();
|
||||
let tmp = group_shard.join("uuid.tmp.123-0");
|
||||
touch(&tmp);
|
||||
let stats = sweep_orphan_tmp_files(&root, Duration::ZERO);
|
||||
assert_eq!(stats.files_deleted, 1, "group-shared orphan must be reaped");
|
||||
assert!(!tmp.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keeps_non_tmp_files() {
|
||||
let root = tmp_root();
|
||||
|
||||
Reference in New Issue
Block a user