From 222edcd07040c1981d49fd62309d278cc9cae13f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 12:50:34 +0100 Subject: [PATCH] =?UTF-8?q?ax(ueps):=20rename=20uepsError=20to=20sentinelE?= =?UTF-8?q?rror=20=E2=80=94=20redundant=20package=20prefix=20on=20private?= =?UTF-8?q?=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The type name uepsError used the package abbreviation as a prefix, which adds no semantic value inside the ueps package and violates AX Principle 1 (predictable names over short names). sentinelError names what the type IS: an immutable, comparable error value. Co-Authored-By: Charon --- pkg/ueps/packet.go | 6 +++--- pkg/ueps/reader.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/ueps/packet.go b/pkg/ueps/packet.go index 67886c5..b6394e5 100644 --- a/pkg/ueps/packet.go +++ b/pkg/ueps/packet.go @@ -10,11 +10,11 @@ import ( // writeTLV(buffer, TagPayload, oversized) → errTLVValueTooLarge // if err == errTLVValueTooLarge { /* value exceeded 255-byte TLV length limit */ } -var errTLVValueTooLarge = uepsError("TLV value too large for 1-byte length header") +var errTLVValueTooLarge = sentinelError("TLV value too large for 1-byte length header") -type uepsError string +type sentinelError string -func (uepsErrorValue uepsError) Error() string { return string(uepsErrorValue) } +func (sentinelErrorValue sentinelError) Error() string { return string(sentinelErrorValue) } // writeTLV(buffer, TagVersion, []byte{0x09}); writeTLV(buffer, TagHMAC, hmacSignature); buffer.WriteByte(TagPayload) const ( diff --git a/pkg/ueps/reader.go b/pkg/ueps/reader.go index 1a5accf..3523100 100644 --- a/pkg/ueps/reader.go +++ b/pkg/ueps/reader.go @@ -11,11 +11,11 @@ import ( // packet, err := ReadAndVerify(bufio.NewReader(conn), secret) // if err == errMissingHMAC { /* no HMAC tag found in frame */ } -var errMissingHMAC = uepsError("UEPS packet missing HMAC signature") +var errMissingHMAC = sentinelError("UEPS packet missing HMAC signature") // packet, err := ReadAndVerify(bufio.NewReader(conn), wrongSecret) // if err == errIntegrityViolation { header.ThreatScore += 100; /* reject packet */ } -var errIntegrityViolation = uepsError("integrity violation: HMAC mismatch") +var errIntegrityViolation = sentinelError("integrity violation: HMAC mismatch") // dispatch(packet.Header.IntentID, packet.Header.ThreatScore, packet.Payload) type ParsedPacket struct {