utopia-ia/elffuss-braid public
Changesets · Branches · Tags · Compare
| Changeset | 52e22f93c9da7ca9d64a4ea4b61cbbc307c0fcf26a0573606cee1fe24ca59bee |
|---|---|
| Author | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-21 16:45 +02:00 |
| Committer | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-21 16:45 +02:00 |
| Parents | 8e35586609e3 |
1 file changed
modified crates/cli/src/verify.rs +11 −5
| @@ -68,9 +68,11 @@ | ||
| 68 | 68 | /// the last hour, at most. |
| 69 | 69 | const HISTORY_DEPTH: usize = 10_000; |
| 70 | 70 | |
| 71 | -/// The longest record file name made of the branch's name in hex; a longer | |
| 72 | -/// name is hashed instead. | |
| 73 | -const MAX_HEX_NAME: usize = 200; | |
| 71 | +/// The longest branch name in hex that a record file is named with; a | |
| 72 | +/// longer name is hashed instead. With `.json`, and the `.new` of the | |
| 73 | +/// scratch file the record is written through, a file name stays under 143 | |
| 74 | +/// bytes, the most some encrypted file systems take. | |
| 75 | +const MAX_HEX_NAME: usize = 128; | |
| 74 | 76 | |
| 75 | 77 | /// What the watchdog says once it runs, before braid starts any test. The |
| 76 | 78 | /// number changes with the protocol, so that another braid's watchdog is |
| @@ -1407,8 +1409,12 @@ | ||
| 1407 | 1409 | format!("b3-{}.json", blake3::hash(longer.as_bytes()).to_hex()) |
| 1408 | 1410 | ); |
| 1409 | 1411 | assert_ne!(name(&format!("{longest}y")), hashed); |
| 1410 | - // Even the longest branch name a ref can have fits a file name. | |
| 1411 | - assert!(name(&"z".repeat(4096)).len() < 100); | |
| 1412 | + // The longest file names, with the scratch file's `.new`, stay under | |
| 1413 | + // 143 bytes, whatever the length of the branch's name. | |
| 1414 | + for branch in [longest, longer, "z".repeat(4096)] { | |
| 1415 | + let scratch = format!("{}.new", name(&branch)); | |
| 1416 | + assert!(scratch.len() < 143, "{scratch}"); | |
| 1417 | + } | |
| 1412 | 1418 | } |
| 1413 | 1419 | |
| 1414 | 1420 | #[test] |