hawdb-storage 0.41.0

An embedded Rust graph database for local data-plane workloads
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
// Copyright 2026 Nowledge
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;
use crate::branch_catalog::{BranchName, CreateRequest};
use crate::branch_project::ProjectSelector;
use crate::file_descriptors::ProjectFileDescriptors;
use std::sync::atomic::{AtomicU64, Ordering};

struct Fixture {
    files: ProjectFileDescriptors,
    child: BranchId,
}

impl Fixture {
    fn new() -> Self {
        static NEXT: AtomicU64 = AtomicU64::new(0);
        let root = std::env::temp_dir().join(format!(
            "hawdb-abandonment-{}-{}",
            std::process::id(),
            NEXT.fetch_add(1, Ordering::Relaxed)
        ));
        Self {
            files: ProjectFileDescriptors::acquire_with_capacity_limit(&root, 32, true).unwrap(),
            child: BranchId::new(Uuid::from_u128(3)).unwrap(),
        }
    }

    fn initialize(&self) -> ProjectMetadata {
        let project = BranchId::new(Uuid::from_u128(1)).unwrap();
        let main = BranchId::new(Uuid::from_u128(2)).unwrap();
        let directory = self.directory();
        fs::create_dir_all(directory.join(self.child.as_uuid().to_string())).unwrap();
        fs::create_dir_all(directory.join("objects/objects/sealed-root")).unwrap();
        let mut catalog = Catalog::bootstrap(project, main).unwrap();
        catalog.branches[0].base_root_digest = Some([7; 32]);
        catalog
            .reserve_create(CreateRequest {
                id: self.child,
                name: BranchName::new("pending").unwrap(),
                parent_id: main,
                source_commit_epoch: 1,
                base_root_digest: [8; 32],
                owner: None,
                request_key: "pending-request".into(),
                request_fingerprint: [9; 32],
            })
            .unwrap();
        branch_catalog::write_catalog(&directory.join("catalog.hawdb"), &catalog).unwrap();
        for (path, bytes) in [
            (
                self.files.root().join("manifest.hawdb"),
                ProjectSelector::new(project, main).unwrap().encode(),
            ),
            (
                directory
                    .join(self.child.as_uuid().to_string())
                    .join("branch.head"),
                b"damaged head".to_vec(),
            ),
            (
                directory
                    .join("objects/objects/sealed-root")
                    .join("8".repeat(64)),
                b"damaged root".to_vec(),
            ),
        ] {
            fs::write(&path, bytes).unwrap();
            sync_file(&path).unwrap();
            durability::sync_directory_ancestors(path.parent().unwrap()).unwrap();
        }
        ProjectMetadata::from_files(self.files.clone()).unwrap()
    }

    fn directory(&self) -> PathBuf {
        self.files.root().join("branches")
    }
}

impl Drop for Fixture {
    fn drop(&mut self) {
        std::fs::remove_dir_all(self.files.root()).unwrap();
    }
}

#[test]
fn reclamation_verifies_archives_without_holding_the_publication_barrier() {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let plan = metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .unwrap();
    metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .unwrap();
    let catalog_path = fixture.directory().join("catalog.hawdb");
    let snapshot = prepare_reclamation_with_verifier(&catalog_path, true, |directory, catalog| {
        let project = directory.to_path_buf();
        std::thread::spawn(move || {
            let _publisher = CatalogMetadataLease::acquire(&project).unwrap();
        })
        .join()
        .unwrap();
        reclamation_evidence(directory, catalog, Default::default())
    })
    .unwrap();
    let directory = fixture.directory();
    assert_eq!(
        std::thread::spawn(move || CatalogMetadataLease::acquire(&directory)
            .unwrap_err()
            .kind())
        .join()
        .unwrap(),
        io::ErrorKind::WouldBlock,
    );
    drop(snapshot);
}

#[test]
fn catalog_changes_during_quarantine_verification_refuse_the_sweep() {
    let fixture = Fixture::new();
    fixture.initialize();
    let catalog_path = fixture.directory().join("catalog.hawdb");
    let result = prepare_reclamation_with_verifier(&catalog_path, true, |directory, catalog| {
        let proofs = reclamation_evidence(directory, catalog, Default::default())?;
        let mut changed = catalog.clone();
        changed.revision += 1;
        branch_catalog::write_catalog(&catalog_path, &changed).unwrap();
        Ok(proofs)
    });
    assert!(matches!(result, Err(HawDBError::BranchBusy { .. })));
}

#[test]
fn quarantine_budget_refusal_is_a_resource_error_and_preserves_the_archive() {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let plan = metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .unwrap();
    let report = metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .unwrap();
    let before = fs::read(report.quarantine_directory.join("intent.json")).unwrap();
    let error = prepare_reclamation(
        &fixture.directory().join("catalog.hawdb"),
        BranchAbandonmentLimits {
            max_bytes: 1,
            ..Default::default()
        },
    )
    .err()
    .unwrap();
    assert!(matches!(
        error,
        HawDBError::BranchEvidenceBudgetExceeded {
            resource: "bytes",
            limit: 1,
            ..
        }
    ));
    assert_eq!(
        fs::read(report.quarantine_directory.join("intent.json")).unwrap(),
        before
    );
    prepare_reclamation(
        &fixture.directory().join("catalog.hawdb"),
        Default::default(),
    )
    .unwrap();
}

#[test]
fn abandonment_retries_each_publication_boundary_and_freezes_recovery() {
    for destination in ["intent.json", "file-0", "catalog.hawdb", "committed"] {
        let fixture = Fixture::new();
        let metadata = fixture.initialize();
        let plan = metadata
            .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
            .unwrap();
        let acknowledgement = plan.acknowledge_potential_data_loss();
        let failure = durability::fail_durable_replace_for_destination(destination);
        assert!(
            metadata
                .abandon_pending_branch(acknowledgement.clone())
                .is_err(),
            "{destination}"
        );
        drop(failure);
        let catalog =
            branch_catalog::read_catalog(&fixture.directory().join("catalog.hawdb")).unwrap();
        assert!(reclamation_evidence(&fixture.directory(), &catalog, Default::default()).is_err());
        let terminal = destination == "committed";
        assert_eq!(catalog.branches[1].state == BranchState::Deleted, terminal);
        if !terminal {
            let error = branch_catalog::recover_create_from_head_file(
                &fixture.directory().join("catalog.hawdb"),
                fixture.child,
                &fixture
                    .directory()
                    .join(fixture.child.as_uuid().to_string())
                    .join("branch.head"),
                1024,
            )
            .unwrap_err();
            assert!(
                error.to_string().contains("operator abandonment intent"),
                "{error}"
            );
            // An unrelated catalog transition requires a fresh CAS approval,
            // while the original evidence snapshot remains reusable.
            let mut advanced = catalog.clone();
            advanced.revision += 1;
            branch_catalog::write_catalog(&fixture.directory().join("catalog.hawdb"), &advanced)
                .unwrap();
            assert!(metadata.abandon_pending_branch(acknowledgement).is_err());
        }
        let refreshed = metadata
            .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
            .unwrap();
        let report = metadata
            .abandon_pending_branch(refreshed.acknowledge_potential_data_loss())
            .unwrap();
        assert_eq!(report.replayed, terminal);
        let catalog =
            branch_catalog::read_catalog(&fixture.directory().join("catalog.hawdb")).unwrap();
        reclamation_evidence(&fixture.directory(), &catalog, Default::default()).unwrap();
        // Metadata keeps its original directory authority, but no child handle.
        assert_eq!(fixture.files.metrics().open, 1);
        assert_eq!(fixture.files.metrics().transient_handles, 1);
        assert_eq!(fixture.files.metrics().reserved, 0);
        drop(metadata);
        assert_eq!(fixture.files.metrics().open, 0);
    }
}

#[cfg(unix)]
#[test]
fn abandonment_rejects_symlinked_sources_and_archive_directories() {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let source = fixture.directory().join("objects/escape");
    std::os::unix::fs::symlink(fixture.files.root().join("manifest.hawdb"), &source).unwrap();
    assert!(metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .is_err());
    std::fs::remove_file(source).unwrap();
    let plan = metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .unwrap();
    std::os::unix::fs::symlink(
        fixture.directory().join("objects"),
        fixture.directory().join("quarantine"),
    )
    .unwrap();
    assert!(metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .is_err());
    assert!(!fixture
        .directory()
        .join("objects")
        .join(fixture.child.as_uuid().to_string())
        .exists());
}

#[cfg(unix)]
#[test]
fn abandonment_power_loss_never_publishes_a_tombstone_without_durable_evidence() {
    use crate::power_loss::image::{CrashPlan, ImageLimits, PersistOperation};
    use crate::power_loss::{IoEvent, ObservationBoundary, ObservationPoint, PowerLossModel};

    let mut schedules = 0;
    let mut torn_schedules = 0;
    for case in 0..9 {
        for boundary in [ObservationBoundary::Before, ObservationBoundary::After] {
            let fixture = Fixture::new();
            let model = PowerLossModel::attach(&fixture.files, ImageLimits::default()).unwrap();
            let metadata = fixture.initialize();
            let plan = metadata
                .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
                .unwrap();
            let archive =
                PathBuf::from("branches/quarantine").join(fixture.child.as_uuid().to_string());
            let (event, path) = match case {
                0 => (IoEvent::Write, archive.join("intent.partial")),
                1 => (IoEvent::FileSync, archive.join("intent.partial")),
                2 => (IoEvent::Rename, archive.join("intent.json")),
                3 => (IoEvent::Write, archive.join("file-0.partial")),
                4 => (IoEvent::FileSync, archive.join("file-0.partial")),
                5 => (IoEvent::Rename, archive.join("file-0")),
                6 => (IoEvent::Rename, PathBuf::from("branches/catalog.hawdb")),
                7 => (IoEvent::Rename, archive.join("committed")),
                8 => (IoEvent::DirectorySync, archive.clone()),
                _ => unreachable!(),
            };
            model
                .observe(ObservationPoint {
                    event,
                    relative_path: path.clone(),
                    boundary,
                    skip_matches: 0,
                    include_descendants: false,
                    keep_last: case == 8,
                })
                .unwrap();
            metadata
                .abandon_pending_branch(plan.acknowledge_potential_data_loss())
                .unwrap();
            let acknowledged = model.capture().unwrap();
            let cut = model
                .take_observation()
                .unwrap()
                .expect("publication cut must execute");
            let complete = cut.persist_all_plan();
            let mut plans = vec![
                CrashPlan::default(),
                complete.clone(),
                CrashPlan {
                    persistence: complete.persistence.iter().rev().cloned().collect(),
                },
            ];
            for operation in &complete.persistence {
                plans.push(CrashPlan {
                    persistence: vec![operation.clone()],
                });
            }
            if matches!(event, IoEvent::Write | IoEvent::FileSync) {
                for write in cut.uncovered_writes(&path).unwrap() {
                    if write.length > 1 {
                        let mut persistence = complete.persistence.clone();
                        persistence.retain(|operation| {
                            *operation != PersistOperation::Whole(write.operation)
                        });
                        persistence.push(PersistOperation::TornWrite {
                            operation: write.operation,
                            bytes: 0..write.length / 2,
                        });
                        plans.push(CrashPlan { persistence });
                        torn_schedules += 1;
                    }
                }
            }
            for (snapshot, crash) in plans
                .into_iter()
                .map(|crash| (&cut, crash))
                .chain([(&acknowledged, CrashPlan::default())])
            {
                let image = fixture
                    .files
                    .root()
                    .with_extension(format!("image-{schedules}"));
                snapshot.crash(&crash).unwrap().materialize(&image).unwrap();
                let recovered = ProjectMetadata::open(&image, 32).unwrap();
                let catalog = recovered.catalog();
                let image_archive = image.join(&archive);
                let terminal = catalog.branches[1].state == BranchState::Deleted;
                if terminal {
                    let manifest = load_intent(&image_archive)
                        .unwrap()
                        .expect("tombstone requires durable intent");
                    manifest.matches(catalog, true).unwrap();
                    verify_archive(&image_archive, &manifest).unwrap();
                }
                // A published commit marker authorizes only a durable terminal
                // catalog. Without it the collector must retain the originals.
                if image_archive.join("committed").exists() {
                    assert!(terminal);
                    reclamation_evidence(&image.join("branches"), catalog, Default::default())
                        .unwrap();
                } else if image_archive.exists() {
                    assert!(reclamation_evidence(
                        &image.join("branches"),
                        catalog,
                        Default::default()
                    )
                    .is_err());
                }
                let refreshed = recovered
                    .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
                    .unwrap();
                recovered
                    .abandon_pending_branch(refreshed.acknowledge_potential_data_loss())
                    .unwrap();
                drop(recovered);
                std::fs::remove_dir_all(image).unwrap();
                schedules += 1;
            }
        }
    }
    assert!(
        torn_schedules >= 4,
        "torn writes must actually be exercised"
    );
    eprintln!("branch-abandonment-power-v1 schedules={schedules} torn={torn_schedules}");
}

#[test]
fn abandonment_preserves_descriptor_errors_and_rejects_completed_creates() {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let plan = metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .unwrap();
    let held: Vec<_> = (0..31)
        .map(|_| File::open(fixture.files.root().join("manifest.hawdb")).unwrap())
        .collect();
    let error = metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .unwrap_err();
    assert!(matches!(error, HawDBError::FileDescriptors(_)), "{error:?}");
    drop(held);
    assert!(!fixture.directory().join("quarantine").exists());
    let path = fixture.directory().join("catalog.hawdb");
    let mut catalog = branch_catalog::read_catalog(&path).unwrap();
    catalog
        .complete_create(fixture.child, plan.metadata_revision())
        .unwrap();
    branch_catalog::write_catalog(&path, &catalog).unwrap();
    let before = std::fs::read(&path).unwrap();
    assert!(metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .is_err());
    assert!(metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .is_err());
    assert_eq!(std::fs::read(&path).unwrap(), before);
    assert!(!fixture.directory().join("quarantine").exists());
}

#[test]
fn abandonment_revalidates_empty_directories_with_the_inspected_entry_budget() {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let child = fixture
        .directory()
        .join(fixture.child.as_uuid().to_string());
    for index in 0..1100 {
        fs::create_dir(child.join(format!("empty-{index}"))).unwrap();
    }
    let plan = metadata
        .inspect_pending_branch_abandonment(
            fixture.child.as_uuid(),
            BranchAbandonmentLimits {
                max_files: 1200,
                ..Default::default()
            },
        )
        .unwrap();
    assert_eq!(plan.evidence_files(), 3);
    metadata
        .abandon_pending_branch(plan.acknowledge_potential_data_loss())
        .unwrap();
    let catalog = branch_catalog::read_catalog(&fixture.directory().join("catalog.hawdb")).unwrap();
    reclamation_evidence(&fixture.directory(), &catalog, Default::default()).unwrap();
}

#[cfg(unix)]
fn reject_dangling_archive_entry(destination: &str) {
    let fixture = Fixture::new();
    let metadata = fixture.initialize();
    let plan = metadata
        .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
        .unwrap();
    let acknowledgement = plan.acknowledge_potential_data_loss();
    let failure = durability::fail_durable_replace_for_destination(destination);
    assert!(metadata
        .abandon_pending_branch(acknowledgement.clone())
        .is_err());
    drop(failure);
    let path = archive_directory(&fixture.directory(), fixture.child).join(destination);
    std::os::unix::fs::symlink("absent-evidence", &path).unwrap();
    let catalog_path = fixture.directory().join("catalog.hawdb");
    let before = std::fs::read(&catalog_path).unwrap();
    assert!(metadata
        .abandon_pending_branch(acknowledgement.clone())
        .is_err());
    assert!(std::fs::symlink_metadata(&path)
        .unwrap()
        .file_type()
        .is_symlink());
    assert_eq!(std::fs::read(&catalog_path).unwrap(), before);
    std::fs::remove_file(&path).unwrap();
    metadata.abandon_pending_branch(acknowledgement).unwrap();
}

#[cfg(unix)]
#[test]
fn abandonment_rejects_dangling_evidence_copy() {
    reject_dangling_archive_entry("file-0");
}

#[cfg(unix)]
#[test]
fn abandonment_rejects_dangling_commit_marker() {
    reject_dangling_archive_entry("committed");
}

#[test]
fn abandonment_bounds_encoded_json_including_escape_expansion() {
    let fits = "\n".repeat(MAX_MANIFEST_BYTES as usize / 2 - 1);
    let encoded = bounded_json(&fits).unwrap();
    assert_eq!(encoded.len() as u64, MAX_MANIFEST_BYTES);
    drop(encoded);
    let oversized = "\n".repeat(MAX_MANIFEST_BYTES as usize / 2);
    assert!((oversized.len() as u64) < MAX_MANIFEST_BYTES);
    assert!(bounded_json(&oversized)
        .unwrap_err()
        .to_string()
        .contains("encoding limit"));
}

/// Automatic post-checkpoint passes (#1736) verify a committed archive once
/// per process instead of on every checkpoint, and an archive beyond the
/// budget protects its quarantined sources instead of failing every pass.
#[test]
fn automatic_evidence_verifies_each_archive_once_and_protects_unverifiable_sources() {
    let damaged_root = |fixture: &Fixture| {
        fixture
            .directory()
            .join("objects/objects/sealed-root")
            .join("8".repeat(64))
    };
    let abandon = |fixture: &Fixture| {
        let metadata = fixture.initialize();
        let plan = metadata
            .inspect_pending_branch_abandonment(fixture.child.as_uuid(), Default::default())
            .unwrap();
        metadata
            .abandon_pending_branch(plan.acknowledge_potential_data_loss())
            .unwrap()
    };

    // Verified once, then served from the cache even after the archive bytes
    // change; explicit reclamation still re-verifies and refuses.
    let fixture = Fixture::new();
    let report = abandon(&fixture);
    let catalog = branch_catalog::read_catalog(&fixture.directory().join("catalog.hawdb")).unwrap();
    let first =
        automatic_reclamation_evidence(&fixture.directory(), &catalog, Default::default()).unwrap();
    let source = damaged_root(&fixture);
    assert!(first.preserves(&source).unwrap());
    assert!(!first.protects(&source));
    let evidence = report.quarantine_directory.join("file-0");
    let mut bytes = fs::read(&evidence).unwrap();
    bytes[0] ^= 1;
    fs::write(&evidence, bytes).unwrap();
    assert!(reclamation_evidence(&fixture.directory(), &catalog, Default::default()).is_err());
    let cached =
        automatic_reclamation_evidence(&fixture.directory(), &catalog, Default::default()).unwrap();
    assert!(cached.preserves(&source).unwrap());

    // Over budget: the automatic pass succeeds and only protects the archived
    // source; the sweep keeps it and reports it, removing everything else.
    let fixture = Fixture::new();
    abandon(&fixture);
    let catalog = branch_catalog::read_catalog(&fixture.directory().join("catalog.hawdb")).unwrap();
    let tiny = BranchAbandonmentLimits {
        max_bytes: 1,
        ..Default::default()
    };
    assert!(reclamation_evidence(&fixture.directory(), &catalog, tiny).is_err());
    let protected = automatic_reclamation_evidence(&fixture.directory(), &catalog, tiny).unwrap();
    let source = damaged_root(&fixture);
    assert!(protected.protects(&source));
    assert!(!protected.preserves(&source).unwrap());
    let objects = fixture.directory().join("objects");
    let mut store = crate::immutable_object::ImmutableObjectStore::open(&objects).unwrap();
    let garbage = crate::immutable_object::ObjectReference::for_bytes(
        crate::immutable_object::ObjectKind::CheckpointArtifact,
        1,
        b"unreachable",
    );
    store.publish(garbage, b"unreachable").unwrap();
    let swept = store
        .sweep_unreachable_bounded(
            &[],
            &protected,
            crate::immutable_object::ObjectSweepBudget {
                max_objects: 100,
                max_bytes: 1 << 20,
                max_verified_reachable_bytes: 0,
                skip_unverifiable: true,
            },
            &mut || Ok(()),
        )
        .unwrap();
    assert_eq!(swept.skipped_quarantine_objects, 1, "{swept:?}");
    assert_eq!(swept.reclaimed_objects, 1, "{swept:?}");
    assert!(source.exists());
    assert!(store.read(garbage).is_err());
}