Skip to main content

humanize_tail

Function humanize_tail 

Source
pub fn humanize_tail(stderr: &str) -> String
Expand description

Extract the actionable part of a kopia stderr tail: drop progress/noise lines, strip volatile temp-path fragments, and keep at most the last few salient lines (newest last), joined with ; so the result stays a single line.

Deterministic and volatile-free: the same failure yields the same string, and no per-attempt .tmp.<hex> / .shards fragment survives — safe to render into any operator-facing surface.

use kopiur_kopia::humanize::humanize_tail;

// Progress noise is dropped; the error line is kept and de-noised.
let raw = "| 3 hashing, 12 hashed (2.1 GB), uploaded 1.9 GB (95.0%) 12s left\n\
           ERROR unable to create directory /repo/.shards.tmp.9f3ac1: permission denied";
let out = humanize_tail(raw);
assert_eq!(out, "unable to create directory /repo: permission denied");
assert!(!out.contains(".tmp"));
assert!(!out.contains(".shards"));