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

Function normalize_token

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

Map a bare word to a placeholder when it looks like an identifier. Only length and shape are used — a token is not identified by its spelling, so nothing sensitive is retained in the grouping key.

(word: &str)

Source from the content-addressed store, hash-verified

584/// Only length and shape are used — a token is not identified by its
585/// spelling, so nothing sensitive is retained in the grouping key.
586fn normalize_token(word: &str) -> String {
587 let has_digit = word.chars().any(|c| c.is_ascii_digit());
588 let long = word.len() >= 16;
589 if has_digit && long {
590 "ID".to_string()
591 } else if has_digit && word.chars().all(|c| c.is_ascii_alphanumeric()) {
592 "N".to_string()
593 } else {
594 word.to_ascii_lowercase()
595 }
596}
597
598fn truncate_detail(s: &str) -> String {
599 let flat = s.split_whitespace().collect::<Vec<_>>().join(" ");

Callers 1

error_signatureFunction · 0.85

Calls 2

lenMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected