Skip to content
Merged
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
16 changes: 12 additions & 4 deletions pkgs/id/crates/id-sync/src/fileops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
//! want to be forgiving trim before calling in.
//! - **The archive namespace is reserved at the writer.** A name for which
//! `is_archive_tag_name` holds (`{stem}.archive.{digits}`, unsigned ASCII
//! digits) is refused with [`FileOpError::ReservedArchiveName`]. Non-numeric
//! lookalikes such as `a.archive.notes` remain valid user files.
//! digits that fit in u64, the [`archive_tag_timestamp`] rule readers share)
//! is refused with [`FileOpError::ReservedArchiveName`]. Non-numeric or
//! overflowing lookalikes such as `a.archive.notes` remain valid user files.
//! - **Archive references are ownership.** `archive.rename` and
//! `archive.replace` on a live file name the archives it owns; `archive.owner`
//! on an archive names the file it belongs to. These stay on the live name
Expand Down Expand Up @@ -861,15 +862,22 @@ mod archive_name_tests {
for name in [
"report.archive.0",
"report.archive.1700000000",
"report.archive.18446744073709551616",
"report.archive.18446744073709551615",
] {
assert!(matches!(
FileOps::validate_name(name),
Err(FileOpError::ReservedArchiveName(found)) if found == name
));
}

for name in ["a.archive.notes", "a.archive.+1", "a.archive.١"] {
// A digit suffix past u64::MAX is not archive-shaped (#11790: one
// rule for writer and reader), so it stays a valid user file name.
for name in [
"a.archive.notes",
"a.archive.+1",
"a.archive.١",
"a.archive.18446744073709551616",
] {
assert!(FileOps::validate_name(name).is_ok(), "{name:?}");
}
}
Expand Down