Extract base32 change-hash tokens from a server error message. A "missing dependency/change" error from the manifest apply names the offending change(s) as full base32 hashes (e.g. `change ABC… depends on DEF…`). Pulling those out lets the CLI report *which* dependency is missing instead of the useless "requires 0 dependencies". A Blake3 change hash is 52 base32 chars (`[A-Z2-7]`); we accept any
(msg: &str)
| 23 | /// base32 chars (`[A-Z2-7]`); we accept any run of ≥ 40 such chars so ordinary |
| 24 | /// words never match while remaining robust to hash-length changes. |
| 25 | fn extract_change_hashes(msg: &str) -> Vec<String> { |
| 26 | msg.split(|c: char| !(c.is_ascii_uppercase() || c.is_ascii_digit())) |
| 27 | .filter(|tok| { |
| 28 | tok.len() >= 40 && tok.bytes().all(|b| matches!(b, b'A'..=b'Z' | b'2'..=b'7')) |
| 29 | }) |
| 30 | .map(|s| s.to_string()) |
| 31 | .collect() |
| 32 | } |
| 33 | |
| 34 | impl HttpRemote { |
| 35 | /// Upload a change file. |