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

Function error_signature

atomic-agent/src/hook_health.rs:554–580  ·  view source on GitHub ↗

Collapse a message to a grouping key. Session ids, turn numbers, hashes and paths all vary between occurrences of the same underlying failure. Normalizing them is what turns 546 separate lines into one actionable row.

(message: &str)

Source from the content-addressed store, hash-verified

552/// of the same underlying failure. Normalizing them is what turns 546
553/// separate lines into one actionable row.
554fn error_signature(message: &str) -> String {
555 let chars: Vec<char> = message.chars().collect();
556 let mut out = String::with_capacity(chars.len());
557 let mut i = 0;
558
559 while i < chars.len() {
560 let c = chars[i];
561 if c.is_ascii_digit() {
562 while i < chars.len() && chars[i].is_ascii_digit() {
563 i += 1;
564 }
565 out.push('N');
566 } else if c.is_ascii_alphanumeric() || c == '_' {
567 let start = i;
568 while i < chars.len() && (chars[i].is_ascii_alphanumeric() || chars[i] == '_') {
569 i += 1;
570 }
571 let word: String = chars[start..i].iter().collect();
572 out.push_str(&normalize_token(&word));
573 } else {
574 out.push(c);
575 i += 1;
576 }
577 }
578
579 out.split_whitespace().collect::<Vec<_>>().join(" ")
580}
581
582/// Map a bare word to a placeholder when it looks like an identifier.
583///

Callers 2

aggregateFunction · 0.85

Calls 5

normalize_tokenFunction · 0.85
collectMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45
iterMethod · 0.45