MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_change_hashes

Function extract_change_hashes

atomic-remote/src/http/upload.rs:25–32  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
25fn 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
34impl HttpRemote {
35 /// Upload a change file.

Callers 4

upload_changeMethod · 0.85
put_view_manifestMethod · 0.85

Calls 2

lenMethod · 0.45
allMethod · 0.45