From a4c4d64a989a458dc66ca17ea7ccc782475ffdf0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 07:42:21 +0100 Subject: [PATCH] ax(node): replace prose comment with usage example on safeKeyPrefix AX Principle 2: comments show HOW with real values, not WHAT the signature says. Co-Authored-By: Charon --- pkg/node/peer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/node/peer.go b/pkg/node/peer.go index 85335aa..a8801a1 100644 --- a/pkg/node/peer.go +++ b/pkg/node/peer.go @@ -56,7 +56,8 @@ const ( // peerNameRegex validates peer names: alphanumeric, hyphens, underscores, and spaces var peerNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-_ ]{0,62}[a-zA-Z0-9]$|^[a-zA-Z0-9]$`) -// safeKeyPrefix returns a truncated key for logging, handling short keys safely +// safeKeyPrefix("abc123def456xyz789") // "abc123def456xyz7..." +// safeKeyPrefix("") // "(empty)" func safeKeyPrefix(key string) string { if len(key) >= 16 { return key[:16] + "..."